summaryrefslogtreecommitdiff
path: root/src/input_common/drivers
diff options
context:
space:
mode:
authorGravatar ameerj2022-12-15 22:50:36 -0500
committerGravatar ameerj2022-12-16 18:00:47 -0500
commit7bf4bec257dffb633d818fb1a7ade6b899ec79a5 (patch)
tree79572d3f31bb42d89df8552bd7d45ff37b189814 /src/input_common/drivers
parentMerge pull request #9431 from liamwhite/sixty-five-oh-two (diff)
downloadyuzu-7bf4bec257dffb633d818fb1a7ade6b899ec79a5.tar.gz
yuzu-7bf4bec257dffb633d818fb1a7ade6b899ec79a5.tar.xz
yuzu-7bf4bec257dffb633d818fb1a7ade6b899ec79a5.zip
camera: Use pre-allocated vector for camera data
And avoid an unnecessary copy
Diffstat (limited to 'src/input_common/drivers')
-rw-r--r--src/input_common/drivers/camera.cpp2
-rw-r--r--src/input_common/drivers/camera.h4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/input_common/drivers/camera.cpp b/src/input_common/drivers/camera.cpp
index dceea67e0..fad9177dc 100644
--- a/src/input_common/drivers/camera.cpp
+++ b/src/input_common/drivers/camera.cpp
@@ -17,7 +17,7 @@ Camera::Camera(std::string input_engine_) : InputEngine(std::move(input_engine_)
17 PreSetController(identifier); 17 PreSetController(identifier);
18} 18}
19 19
20void Camera::SetCameraData(std::size_t width, std::size_t height, std::vector<u32> data) { 20void Camera::SetCameraData(std::size_t width, std::size_t height, std::span<const u32> data) {
21 const std::size_t desired_width = getImageWidth(); 21 const std::size_t desired_width = getImageWidth();
22 const std::size_t desired_height = getImageHeight(); 22 const std::size_t desired_height = getImageHeight();
23 status.data.resize(desired_width * desired_height); 23 status.data.resize(desired_width * desired_height);
diff --git a/src/input_common/drivers/camera.h b/src/input_common/drivers/camera.h
index b8a7c75e5..38fb1ae4c 100644
--- a/src/input_common/drivers/camera.h
+++ b/src/input_common/drivers/camera.h
@@ -3,6 +3,8 @@
3 3
4#pragma once 4#pragma once
5 5
6#include <span>
7
6#include "input_common/input_engine.h" 8#include "input_common/input_engine.h"
7 9
8namespace InputCommon { 10namespace InputCommon {
@@ -15,7 +17,7 @@ class Camera final : public InputEngine {
15public: 17public:
16 explicit Camera(std::string input_engine_); 18 explicit Camera(std::string input_engine_);
17 19
18 void SetCameraData(std::size_t width, std::size_t height, std::vector<u32> data); 20 void SetCameraData(std::size_t width, std::size_t height, std::span<const u32> data);
19 21
20 std::size_t getImageWidth() const; 22 std::size_t getImageWidth() const;
21 std::size_t getImageHeight() const; 23 std::size_t getImageHeight() const;