From b80205ec73487c3687e5775907b8116c41d8a7a9 Mon Sep 17 00:00:00 2001
From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com>
Date: Thu, 3 Jun 2021 13:40:42 -0400
Subject: [PATCH] photoboothView: fix the white border in dark mode and the
 photo taken

Change-Id: I24556c668d92a11573a23bab2367a0a470d01750
---
 src/commoncomponents/PhotoboothView.qml | 4 +++-
 src/previewrenderer.cpp                 | 5 ++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/commoncomponents/PhotoboothView.qml b/src/commoncomponents/PhotoboothView.qml
index b8edc565e..4ff0e989b 100644
--- a/src/commoncomponents/PhotoboothView.qml
+++ b/src/commoncomponents/PhotoboothView.qml
@@ -141,7 +141,9 @@ ColumnLayout {
             AvatarImage {
                 id: avatarImg
 
-                anchors.fill: parent
+                anchors.centerIn: avatarLabelBackground
+                width: avatarLabelBackground.width + avatarImg.spinningAnimationWidth
+                height: avatarLabelBackground.height + avatarImg.spinningAnimationWidth
 
                 showPresenceIndicator: false
 
diff --git a/src/previewrenderer.cpp b/src/previewrenderer.cpp
index c76ce79c2..7235c923c 100644
--- a/src/previewrenderer.cpp
+++ b/src/previewrenderer.cpp
@@ -137,9 +137,8 @@ QString
 PhotoboothPreviewRender::takePhoto(int size)
 {
     if (auto previewImage = lrcInstance_->renderer()->getPreviewFrame()) {
-        return Utils::byteArrayToBase64String(Utils::QImageToByteArray(
-            previewImage->copy()
-                .scaled(size, size, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation)));
+        return Utils::byteArrayToBase64String(
+            Utils::QImageToByteArray(Utils::getCirclePhoto(previewImage->copy(), size)));
     }
     return {};
 }
-- 
GitLab