[{"id":3467,"web_url":"https://patchwork.libcamera.org/comment/3467/","msgid":"<20200117002631.GD16210@pendragon.ideasonboard.com>","date":"2020-01-17T00:26:31","subject":"Re: [libcamera-devel] [RFC PATCH] qcam: Support software scaling of\n\tthe ViewFinder","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn Thu, Jan 16, 2020 at 10:50:15PM +0000, Kieran Bingham wrote:\n> Introduce software rescaling of the ViewFinder.\n> When rescaling, this will introduce a performance penalty.\n> \n> The resizing is not limited to the aspect ratio of the image.\n> If supporting software resizing is desireable, we may wish to impose at\n> least mataining the aspect ratio of the capture images.\n\ns/mataining/maintaining/\n\n> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n> \n> I'm not actually expecting this patch to be integrated (maybe we decide it's\n> useful, I'm not sure yet), but I wanted to post it in case it is useful to\n> anyone else.\n> \n> The topic of being able to resize the QCam window (even at the expense of\n> software scaling) came up and we discovered it is only a few lines to remove\n> our fixed size restrictions.\n\nI've had a look at the QLabel implementation, and scaling a QPixmap is\ndone by converting to a QImage, scaling the QImage, and converting back\nto a QPixmap. I don't think we want that :-)\n\nI think we should at least try to paint the image manually. I'll try to\nsubmit a patch.\n\n>  src/qcam/main_window.cpp | 1 -\n>  src/qcam/viewfinder.cpp  | 3 +--\n>  2 files changed, 1 insertion(+), 3 deletions(-)\n> \n> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\n> index 1d9c756f147a..df51fa888342 100644\n> --- a/src/qcam/main_window.cpp\n> +++ b/src/qcam/main_window.cpp\n> @@ -33,7 +33,6 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n>  \n>  \tviewfinder_ = new ViewFinder(this);\n>  \tsetCentralWidget(viewfinder_);\n> -\tviewfinder_->setFixedSize(500, 500);\n>  \tadjustSize();\n>  \n>  \tret = openCamera(cm);\n> diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp\n> index 98a8ab68e5f6..9f92e11d5cf6 100644\n> --- a/src/qcam/viewfinder.cpp\n> +++ b/src/qcam/viewfinder.cpp\n> @@ -14,6 +14,7 @@\n>  ViewFinder::ViewFinder(QWidget *parent)\n>  \t: QLabel(parent), format_(0), width_(0), height_(0), image_(nullptr)\n>  {\n> +\tsetScaledContents(true);\n>  }\n>  \n>  ViewFinder::~ViewFinder()\n> @@ -42,8 +43,6 @@ int ViewFinder::setFormat(unsigned int format, unsigned int width,\n>  \twidth_ = width;\n>  \theight_ = height;\n>  \n> -\tsetFixedSize(width, height);\n> -\n>  \tdelete image_;\n>  \timage_ = new QImage(width, height, QImage::Format_RGB32);\n>","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8780C6075C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jan 2020 01:26:53 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F21339DA;\n\tFri, 17 Jan 2020 01:26:52 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1579220813;\n\tbh=1atDtfwLaaA5KhImkq0vxq8O4EOIutvg8CXijT6xssY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=LMDieKNl3q22hzY4tHhbo+Okz9GtuodwAk6P3c0fnK3aOlLGOR/UBOUQu7Yw4jZTe\n\tFaY8SSIs6c8fAvw3DnoAC/+yfoIWN1zVRSILDDX7gUqGIRytIAvnbXgJlB0o7M73u3\n\t3A2fBkeT7/0dSr6zwp2Tb4x7L3ZrdBDa1KVUZIzs=","Date":"Fri, 17 Jan 2020 02:26:31 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Message-ID":"<20200117002631.GD16210@pendragon.ideasonboard.com>","References":"<20200116225015.27031-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200116225015.27031-1-kieran.bingham@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [RFC PATCH] qcam: Support software scaling of\n\tthe ViewFinder","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 17 Jan 2020 00:26:55 -0000"}}]