summaryrefslogtreecommitdiff
path: root/src/protocols/SinglePixel.cpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2025-07-10 13:11:07 +0200
committerVaxry <43317083+vaxerski@users.noreply.github.com>2025-07-10 14:09:00 +0200
commitb5433bb75324a95dd27eb5492141565466c2cdd6 (patch)
tree0e67a1d504c5f18dc81ea93c90ebd58fb82770e1 /src/protocols/SinglePixel.cpp
parentbcb96c553214d0938289c0fc7d79de82629ccf18 (diff)
singlepixel: move to unique ptrs
less refcounting, move by rvalue.
Diffstat (limited to 'src/protocols/SinglePixel.cpp')
-rw-r--r--src/protocols/SinglePixel.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/protocols/SinglePixel.cpp b/src/protocols/SinglePixel.cpp
index 42c4f8ed..a04cb481 100644
--- a/src/protocols/SinglePixel.cpp
+++ b/src/protocols/SinglePixel.cpp
@@ -79,7 +79,7 @@ bool CSinglePixelBufferResource::good() {
return m_buffer->good();
}
-CSinglePixelBufferManagerResource::CSinglePixelBufferManagerResource(SP<CWpSinglePixelBufferManagerV1> resource_) : m_resource(resource_) {
+CSinglePixelBufferManagerResource::CSinglePixelBufferManagerResource(UP<CWpSinglePixelBufferManagerV1>&& resource_) : m_resource(std::move(resource_)) {
if UNLIKELY (!good())
return;
@@ -87,9 +87,9 @@ CSinglePixelBufferManagerResource::CSinglePixelBufferManagerResource(SP<CWpSingl
m_resource->setOnDestroy([this](CWpSinglePixelBufferManagerV1* r) { PROTO::singlePixel->destroyResource(this); });
m_resource->setCreateU32RgbaBuffer([this](CWpSinglePixelBufferManagerV1* res, uint32_t id, uint32_t r, uint32_t g, uint32_t b, uint32_t a) {
- CHyprColor color{r / (float)std::numeric_limits<uint32_t>::max(), g / (float)std::numeric_limits<uint32_t>::max(), b / (float)std::numeric_limits<uint32_t>::max(),
+ CHyprColor color{r / (float)std::numeric_limits<uint32_t>::max(), g / (float)std::numeric_limits<uint32_t>::max(), b / (float)std::numeric_limits<uint32_t>::max(),
a / (float)std::numeric_limits<uint32_t>::max()};
- const auto RESOURCE = PROTO::singlePixel->m_buffers.emplace_back(makeShared<CSinglePixelBufferResource>(id, m_resource->client(), color));
+ const auto& RESOURCE = PROTO::singlePixel->m_buffers.emplace_back(makeUnique<CSinglePixelBufferResource>(id, m_resource->client(), color));
if UNLIKELY (!RESOURCE->good()) {
res->noMemory();
@@ -108,7 +108,7 @@ CSinglePixelProtocol::CSinglePixelProtocol(const wl_interface* iface, const int&
}
void CSinglePixelProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
- const auto RESOURCE = m_managers.emplace_back(makeShared<CSinglePixelBufferManagerResource>(makeShared<CWpSinglePixelBufferManagerV1>(client, ver, id)));
+ const auto& RESOURCE = m_managers.emplace_back(makeUnique<CSinglePixelBufferManagerResource>(makeUnique<CWpSinglePixelBufferManagerV1>(client, ver, id)));
if UNLIKELY (!RESOURCE->good()) {
wl_client_post_no_memory(client);