Show a patch.

GET /api/patches/3269/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 3269,
    "url": "https://patchwork.libcamera.org/api/patches/3269/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3269/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20200323173559.21109-4-laurent.pinchart@ideasonboard.com>",
    "date": "2020-03-23T17:35:41",
    "name": "[libcamera-devel,v2,03/21] qcam: Use QSize through the code base",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "71b5799e8c65a483345de905e46fe8e03ebeee15",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3269/mbox/",
    "series": [
        {
            "id": 762,
            "url": "https://patchwork.libcamera.org/api/series/762/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=762",
            "date": "2020-03-23T17:35:38",
            "name": "qcam: Bypass format conversion when not required",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/762/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3269/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3269/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7AD3062C75\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 18:36:17 +0100 (CET)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1A204A31\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 18:36:17 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584984977;\n\tbh=H6tP2WiYtQXoW1gr64JmAi7wXT4J3vUVkUPHf2q4zBo=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=jxNR/umzEyeT6CtdBxtYjucpj2Xc9kzlLpv9BSfLi5WuGVj3na6pd/o41hYqkjw75\n\t9kEkBNWniqlh01Q6qQoq6WFEzOGJv3eIweEDEGOU6Y10F0jiZARuHLRdAMcN755ETV\n\tpf/3HP4Y7cA0jwydDPlUypWSQmhaUURYlgEtOhvE=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 23 Mar 2020 19:35:41 +0200",
        "Message-Id": "<20200323173559.21109-4-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200323173559.21109-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200323173559.21109-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 03/21] qcam: Use QSize through the code\n\tbase",
        "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": "Mon, 23 Mar 2020 17:36:17 -0000"
    },
    "content": "Qt has a QSize class to store sizes. Use it to replace width and height\nwhere applicable.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/qcam/format_converter.cpp |  6 +++---\n src/qcam/format_converter.h   |  5 +++--\n src/qcam/main_window.cpp      |  4 ++--\n src/qcam/viewfinder.cpp       | 13 ++++++-------\n src/qcam/viewfinder.h         | 11 +++++------\n 5 files changed, 19 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp\nindex d8962a28c06c..bf887ad446eb 100644\n--- a/src/qcam/format_converter.cpp\n+++ b/src/qcam/format_converter.cpp\n@@ -26,7 +26,7 @@\n #endif\n \n int FormatConverter::configure(const libcamera::PixelFormat &format,\n-\t\t\t       unsigned int width, unsigned int height)\n+\t\t\t       const QSize &size)\n {\n \tswitch (format) {\n \tcase DRM_FORMAT_NV12:\n@@ -139,8 +139,8 @@ int FormatConverter::configure(const libcamera::PixelFormat &format,\n \t};\n \n \tformat_ = format;\n-\twidth_ = width;\n-\theight_ = height;\n+\twidth_ = size.width();\n+\theight_ = size.height();\n \n \treturn 0;\n }\ndiff --git a/src/qcam/format_converter.h b/src/qcam/format_converter.h\nindex 96bde2384ddf..5e28adf0ef63 100644\n--- a/src/qcam/format_converter.h\n+++ b/src/qcam/format_converter.h\n@@ -9,6 +9,8 @@\n \n #include <stddef.h>\n \n+#include <QSize>\n+\n #include <libcamera/pixelformats.h>\n \n class QImage;\n@@ -16,8 +18,7 @@ class QImage;\n class FormatConverter\n {\n public:\n-\tint configure(const libcamera::PixelFormat &format, unsigned int width,\n-\t\t      unsigned int height);\n+\tint configure(const libcamera::PixelFormat &format, const QSize &size);\n \n \tvoid convert(const unsigned char *src, size_t size, QImage *dst);\n \ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 66aaf40c5d45..e0668176e427 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -232,8 +232,8 @@ int MainWindow::startCapture()\n \t}\n \n \tStream *stream = cfg.stream();\n-\tret = viewfinder_->setFormat(cfg.pixelFormat, cfg.size.width,\n-\t\t\t\t     cfg.size.height);\n+\tret = viewfinder_->setFormat(cfg.pixelFormat,\n+\t\t\t\t     QSize(cfg.size.width, cfg.size.height));\n \tif (ret < 0) {\n \t\tstd::cout << \"Failed to set viewfinder format\" << std::endl;\n \t\treturn ret;\ndiff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp\nindex f4602f07c5d2..066ac605e7b4 100644\n--- a/src/qcam/viewfinder.cpp\n+++ b/src/qcam/viewfinder.cpp\n@@ -15,7 +15,7 @@\n #include \"format_converter.h\"\n \n ViewFinder::ViewFinder(QWidget *parent)\n-\t: QWidget(parent), format_(0), width_(0), height_(0), image_(nullptr)\n+\t: QWidget(parent), format_(0), image_(nullptr)\n {\n }\n \n@@ -46,20 +46,19 @@ QImage ViewFinder::getCurrentImage()\n }\n \n int ViewFinder::setFormat(const libcamera::PixelFormat &format,\n-\t\t\t  unsigned int width, unsigned int height)\n+\t\t\t  const QSize &size)\n {\n \tint ret;\n \n-\tret = converter_.configure(format, width, height);\n+\tret = converter_.configure(format, size);\n \tif (ret < 0)\n \t\treturn ret;\n \n \tformat_ = format;\n-\twidth_ = width;\n-\theight_ = height;\n+\tsize_ = size;\n \n \tdelete image_;\n-\timage_ = new QImage(width, height, QImage::Format_RGB32);\n+\timage_ = new QImage(size_, QImage::Format_RGB32);\n \n \tupdateGeometry();\n \treturn 0;\n@@ -73,5 +72,5 @@ void ViewFinder::paintEvent(QPaintEvent *)\n \n QSize ViewFinder::sizeHint() const\n {\n-\treturn image_ ? image_->size() : QSize(640, 480);\n+\treturn size_.isValid() ? size_ : QSize(640, 480);\n }\ndiff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h\nindex 0549f038edd6..a019c3a470ea 100644\n--- a/src/qcam/viewfinder.h\n+++ b/src/qcam/viewfinder.h\n@@ -8,6 +8,7 @@\n #define __QCAM_VIEWFINDER_H__\n \n #include <QMutex>\n+#include <QSize>\n #include <QWidget>\n \n #include <libcamera/pixelformats.h>\n@@ -22,8 +23,7 @@ public:\n \tViewFinder(QWidget *parent);\n \t~ViewFinder();\n \n-\tint setFormat(const libcamera::PixelFormat &format, unsigned int width,\n-\t\t      unsigned int height);\n+\tint setFormat(const libcamera::PixelFormat &format, const QSize &size);\n \tvoid display(const unsigned char *rgb, size_t size);\n \n \tQImage getCurrentImage();\n@@ -33,12 +33,11 @@ protected:\n \tQSize sizeHint() const override;\n \n private:\n-\tlibcamera::PixelFormat format_;\n-\tunsigned int width_;\n-\tunsigned int height_;\n-\n \tFormatConverter converter_;\n \n+\tlibcamera::PixelFormat format_;\n+\tQSize size_;\n+\n \tQImage *image_;\n \tQMutex mutex_; /* Prevent concurrent access to image_ */\n };\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "03/21"
    ]
}