From patchwork Thu Jan 16 22:50:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2653 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 931B960705 for ; Thu, 16 Jan 2020 23:50:19 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C8722D2; Thu, 16 Jan 2020 23:50:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1579215019; bh=p81KOyVTV/HUTvsK0fDzAgfd+FLaJxjAHBj6bXoulqo=; h=From:To:Cc:Subject:Date:From; b=d6tEybR56jEwyblYq7zHfKJj6m36f2BNX4i6DH26bwDuY0iuuXs+iMcM82l4zpLNG b9cfn5Wy+qmVvMd7xmTtiGBdLFunSMxXTX+lNWNPjrNMBQde0aCA6LN2fQzeCvq0Y0 iWp1WoTZ89f+Zb69OhXAel077xRBaJSINpbfoInk= From: Kieran Bingham To: LibCamera Devel Date: Thu, 16 Jan 2020 22:50:15 +0000 Message-Id: <20200116225015.27031-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH] qcam: Support software scaling of the ViewFinder X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jan 2020 22:50:19 -0000 Introduce software rescaling of the ViewFinder. When rescaling, this will introduce a performance penalty. The resizing is not limited to the aspect ratio of the image. If supporting software resizing is desireable, we may wish to impose at least mataining the aspect ratio of the capture images. Suggested-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- I'm not actually expecting this patch to be integrated (maybe we decide it's useful, I'm not sure yet), but I wanted to post it in case it is useful to anyone else. The topic of being able to resize the QCam window (even at the expense of software scaling) came up and we discovered it is only a few lines to remove our fixed size restrictions. src/qcam/main_window.cpp | 1 - src/qcam/viewfinder.cpp | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 1d9c756f147a..df51fa888342 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -33,7 +33,6 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) viewfinder_ = new ViewFinder(this); setCentralWidget(viewfinder_); - viewfinder_->setFixedSize(500, 500); adjustSize(); ret = openCamera(cm); diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp index 98a8ab68e5f6..9f92e11d5cf6 100644 --- a/src/qcam/viewfinder.cpp +++ b/src/qcam/viewfinder.cpp @@ -14,6 +14,7 @@ ViewFinder::ViewFinder(QWidget *parent) : QLabel(parent), format_(0), width_(0), height_(0), image_(nullptr) { + setScaledContents(true); } ViewFinder::~ViewFinder() @@ -42,8 +43,6 @@ int ViewFinder::setFormat(unsigned int format, unsigned int width, width_ = width; height_ = height; - setFixedSize(width, height); - delete image_; image_ = new QImage(width, height, QImage::Format_RGB32);