Make we load rive resource from const uint8_t*, instead of uint8_t* 66/300666/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 31 Oct 2023 05:24:39 +0000 (14:24 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 31 Oct 2023 05:28:04 +0000 (14:28 +0900)
Since we only use const uint8_t* internally, there is no reason to
allow 'only' non-const pointer when we try to load rive resources.

To increase performance by compiler, let we mark bytes as const
so RiveTizen itself never fix inputed buffer internally.

Change-Id: I6723bd9405939cf126177463ec6dfdda50691a90
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
inc/rive_tizen.hpp
src/rive_tizen.cpp

index f61c5d662f2b6f1d3e9b1afadcd97d1119fde876..489292452defac8b82aff126f2483c0fc09f0602 100644 (file)
@@ -16,7 +16,7 @@ class RiveTizen {
         void animationAdvanceApply(rive::LinearAnimationInstance* animation, double elapsed);
         void animationApply(rive::LinearAnimationInstance* animation, double elapsed);
 
-        bool loadRiveResource(uint8_t* bytes, size_t size);
+        bool loadRiveResource(const uint8_t* bytes, size_t size);
         bool createCanvas(unsigned char* buffer, unsigned int width, unsigned int height, unsigned int stride);
         bool render(double elapsed, unsigned int width, unsigned int height);
 
index 7450a9a13735f2fe0a0c9fed1e78b5d9f329e1e0..0fba5659114a14e2a3c912d9b8320e393a277c60 100644 (file)
@@ -104,7 +104,7 @@ void RiveTizen::animationApply(rive::LinearAnimationInstance *animation, double
    animation->time(elapsed);
 }
 
-bool RiveTizen::loadRiveResource(uint8_t *bytes, size_t size)
+bool RiveTizen::loadRiveResource(const uint8_t *bytes, size_t size)
 {
    mFile = nullptr;
    mArtboardInstance = nullptr;