{"id":589,"url":"https://patchwork.libcamera.org/api/patches/589/?format=json","web_url":"https://patchwork.libcamera.org/patch/589/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190220131757.14004-2-jacopo@jmondi.org>","date":"2019-02-20T13:17:53","name":"[libcamera-devel,1/5] libcamera: v4l2_subdevice: Make crop/compose rectangle a reference","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"91bfdfe102af3fe2ccd8fbd5b0477e0d1a973672","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/589/mbox/","series":[{"id":186,"url":"https://patchwork.libcamera.org/api/series/186/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=186","date":"2019-02-20T13:17:52","name":"libcamera: IPU3: create CIO2 and IMGU devices","version":1,"mbox":"https://patchwork.libcamera.org/series/186/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/589/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/589/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 77351601E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Feb 2019 14:17:40 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 033DC4000B;\n\tWed, 20 Feb 2019 13:17:39 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 20 Feb 2019 14:17:53 +0100","Message-Id":"<20190220131757.14004-2-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190220131757.14004-1-jacopo@jmondi.org>","References":"<20190220131757.14004-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/5] libcamera: v4l2_subdevice: Make\n\tcrop/compose rectangle a reference","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Wed, 20 Feb 2019 13:17:40 -0000"},"content":"As the crop/compose rectangle provided to setCrop and setCompose methods\nis never modified, make it a const reference.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/v4l2_subdevice.h |  6 +++---\n src/libcamera/v4l2_subdevice.cpp       | 18 +++++++++---------\n 2 files changed, 12 insertions(+), 12 deletions(-)","diff":"diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\nindex 40becd0ca99b..18000d6ed06b 100644\n--- a/src/libcamera/include/v4l2_subdevice.h\n+++ b/src/libcamera/include/v4l2_subdevice.h\n@@ -44,8 +44,8 @@ public:\n \tstd::string deviceNode() const { return deviceNode_; }\n \tstd::string deviceName() const { return deviceName_; }\n \n-\tint setCrop(unsigned int pad, Rectangle *rect);\n-\tint setCompose(unsigned int pad, Rectangle *rect);\n+\tint setCrop(unsigned int pad, const Rectangle &rect);\n+\tint setCompose(unsigned int pad, const Rectangle &rect);\n \n \tint enumFormat(unsigned int pad, V4L2SubdeviceFormatEnum *formatEnum);\n \tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format);\n@@ -53,7 +53,7 @@ public:\n \n private:\n \tint setSelection(unsigned int pad, unsigned int target,\n-\t\t\t Rectangle *rect);\n+\t\t\t const Rectangle &rect);\n \n \tstd::string deviceNode_;\n \tstd::string deviceName_;\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 4411ffa51460..2e73edee68c9 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -203,11 +203,11 @@ void V4L2Subdevice::close()\n /**\n  * \\brief Set a crop rectangle on one of the V4L2 subdevice pads\n  * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\n- * \\param[inout] rect The rectangle describing crop target area\n+ * \\param[in] rect The rectangle describing crop target area\n  *\n  * \\return 0 on success, or a negative error code otherwise\n  */\n-int V4L2Subdevice::setCrop(unsigned int pad, Rectangle *rect)\n+int V4L2Subdevice::setCrop(unsigned int pad, const Rectangle &rect)\n {\n \treturn setSelection(pad, V4L2_SEL_TGT_CROP, rect);\n }\n@@ -215,11 +215,11 @@ int V4L2Subdevice::setCrop(unsigned int pad, Rectangle *rect)\n /**\n  * \\brief Set a compose rectangle on one of the V4L2 subdevice pads\n  * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\n- * \\param[inout] rect The rectangle describing the compose target area\n+ * \\param[in] rect The rectangle describing the compose target area\n  *\n  * \\return 0 on success, or a negative error code otherwise\n  */\n-int V4L2Subdevice::setCompose(unsigned int pad, Rectangle *rect)\n+int V4L2Subdevice::setCompose(unsigned int pad, const Rectangle &rect)\n {\n \treturn setSelection(pad, V4L2_SEL_TGT_COMPOSE, rect);\n }\n@@ -333,7 +333,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format)\n }\n \n int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n-\t\t\t\tRectangle *rect)\n+\t\t\t\tconst Rectangle &rect)\n {\n \tstruct v4l2_subdev_selection sel = {};\n \n@@ -342,10 +342,10 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n \tsel.target = target;\n \tsel.flags = 0;\n \n-\tsel.r.left = rect->y;\n-\tsel.r.top = rect->x;\n-\tsel.r.width = rect->w;\n-\tsel.r.height = rect->h;\n+\tsel.r.left = rect.y;\n+\tsel.r.top = rect.x;\n+\tsel.r.width = rect.w;\n+\tsel.r.height = rect.h;\n \n \tint ret = ioctl(fd_, VIDIOC_SUBDEV_S_SELECTION, &sel);\n \tif (ret < 0) {\n","prefixes":["libcamera-devel","1/5"]}