aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-12-17 15:11:43 -0500
committerDavid Robillard <d@drobilla.net>2021-12-17 15:11:43 -0500
commitee7078278c0aeb2a41149055ddab1e694f63232b (patch)
tree6e7ce270357f077ba2be4e712230e02aebe9d390
parentc79f6007fa2d60d04f0f754d967fbfce6f09545e (diff)
downloadpugl-ee7078278c0aeb2a41149055ddab1e694f63232b.tar.gz
pugl-ee7078278c0aeb2a41149055ddab1e694f63232b.tar.bz2
pugl-ee7078278c0aeb2a41149055ddab1e694f63232b.zip
Pass const references where appropriate
-rw-r--r--bindings/cpp/include/pugl/pugl.hpp6
-rw-r--r--examples/pugl_vulkan_cpp_demo.cpp15
2 files changed, 11 insertions, 10 deletions
diff --git a/bindings/cpp/include/pugl/pugl.hpp b/bindings/cpp/include/pugl/pugl.hpp
index 0c6065b..98b0108 100644
--- a/bindings/cpp/include/pugl/pugl.hpp
+++ b/bindings/cpp/include/pugl/pugl.hpp
@@ -89,7 +89,7 @@ struct Event final : Base {
/// The `type` field of the corresponding C event structure
static constexpr const PuglEventType type = t;
- explicit Event(Base base)
+ explicit Event(const Base& base)
: Base{base}
{}
@@ -453,7 +453,7 @@ public:
Rect frame() const noexcept { return puglGetFrame(cobj()); }
/// @copydoc puglSetFrame
- Status setFrame(Rect frame) noexcept
+ Status setFrame(const Rect& frame) noexcept
{
return static_cast<Status>(puglSetFrame(cobj(), frame));
}
@@ -541,7 +541,7 @@ public:
}
/// @copydoc puglPostRedisplayRect
- Status postRedisplayRect(const Rect rect) noexcept
+ Status postRedisplayRect(const Rect& rect) noexcept
{
return static_cast<Status>(puglPostRedisplayRect(cobj(), rect));
}
diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp
index 1a3edda..0b34c81 100644
--- a/examples/pugl_vulkan_cpp_demo.cpp
+++ b/examples/pugl_vulkan_cpp_demo.cpp
@@ -53,7 +53,7 @@ struct PhysicalDeviceSelection {
/// Basic Vulkan context associated with the window
struct VulkanContext {
- VkResult init(pugl::VulkanLoader& loader, const PuglTestOptions& opts);
+ VkResult init(const pugl::VulkanLoader& loader, const PuglTestOptions& opts);
sk::VulkanApi vk;
sk::Instance instance;
@@ -1237,8 +1237,8 @@ createInstance(sk::VulkanInitApi& initApi,
}
VkResult
-getDebugReportCallback(sk::VulkanApi& api,
- sk::Instance& instance,
+getDebugReportCallback(const sk::VulkanApi& api,
+ const sk::Instance& instance,
const bool verbose,
sk::DebugReportCallbackEXT& callback)
{
@@ -1675,7 +1675,8 @@ View::onEvent(const pugl::CloseEvent&)
}
VkResult
-VulkanContext::init(pugl::VulkanLoader& loader, const PuglTestOptions& opts)
+VulkanContext::init(const pugl::VulkanLoader& loader,
+ const PuglTestOptions& opts)
{
VkResult r = VK_SUCCESS;
@@ -1693,9 +1694,9 @@ VulkanContext::init(pugl::VulkanLoader& loader, const PuglTestOptions& opts)
}
int
-run(const char* const programPath,
- const PuglTestOptions opts,
- const size_t numRects)
+run(const char* const programPath,
+ const PuglTestOptions& opts,
+ const size_t numRects)
{
PuglVulkanDemo app{programPath, opts, numRects};