From dc5f9f7430df751f8f65755afe020d24149b74a9 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 4 Jun 2020 17:49:10 +0900 Subject: [PATCH] common: retyped the color value size_t -> uint8_t since it's range is 0 - 255. Change-Id: I16e0569341c4a94acab9488d076f235bf90ff4db --- inc/tizenvg.h | 8 ++++---- src/lib/sw_engine/tvgSwRenderer.cpp | 6 +++--- src/lib/tvgShape.cpp | 8 ++++---- src/lib/tvgShapeImpl.h | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/inc/tizenvg.h b/inc/tizenvg.h index c113975..905c3f0 100644 --- a/inc/tizenvg.h +++ b/inc/tizenvg.h @@ -142,13 +142,13 @@ public: //Stroke int stroke(float width) noexcept; - int stroke(size_t r, size_t g, size_t b, size_t a) noexcept; + int stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept; int stroke(const size_t* dashPattern, size_t cnt) noexcept; int stroke(StrokeCap cap) noexcept; int stroke(StrokeJoin join) noexcept; //Fill - int fill(size_t r, size_t g, size_t b, size_t a) noexcept; + int fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept; //Transform int rotate(float degree) noexcept override; @@ -158,11 +158,11 @@ public: //Getters size_t pathCommands(const PathCommand** cmds) const noexcept; size_t pathCoords(const Point** pts) const noexcept; - int fill(size_t* r, size_t* g, size_t* b, size_t* a) const noexcept; + int fill(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept; int bounds(float* x, float* y, float* w, float* h) const noexcept override; float strokeWidth() const noexcept; - int strokeColor(size_t* r, size_t* g, size_t* b, size_t* a) const noexcept; + int strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept; size_t strokeDash(const size_t** dashPattern) const noexcept; StrokeCap strokeCap() const noexcept; StrokeJoin strokeJoin() const noexcept; diff --git a/src/lib/sw_engine/tvgSwRenderer.cpp b/src/lib/sw_engine/tvgSwRenderer.cpp index 91c0013..38ac674 100644 --- a/src/lib/sw_engine/tvgSwRenderer.cpp +++ b/src/lib/sw_engine/tvgSwRenderer.cpp @@ -62,7 +62,7 @@ bool SwRenderer::render(const Shape& shape, void *data) SwShape* sdata = static_cast(data); if (!sdata) return false; - size_t r, g, b, a; + uint8_t r, g, b, a; shape.fill(&r, &g, &b, &a); if (a > 0) rasterShape(surface, *sdata, r, g, b, a); @@ -100,7 +100,7 @@ void* SwRenderer::prepare(const Shape& shape, void* data, const RenderTransform* //Shape if (flags & (RenderUpdateFlag::Path | RenderUpdateFlag::Transform)) { - size_t alpha = 0; + uint8_t alpha = 0; shape.fill(nullptr, nullptr, nullptr, &alpha); if (alpha > 0) { @@ -116,7 +116,7 @@ void* SwRenderer::prepare(const Shape& shape, void* data, const RenderTransform* if (shape.strokeWidth() > 0.5) { shapeResetStroke(shape, *sdata); - size_t alpha = 0; + uint8_t alpha = 0; shape.strokeColor(nullptr, nullptr, nullptr, &alpha); if (alpha > 0) { if (!shapeGenStrokeRle(shape, *sdata, clip)) return sdata; diff --git a/src/lib/tvgShape.cpp b/src/lib/tvgShape.cpp index fe95eac..828e251 100644 --- a/src/lib/tvgShape.cpp +++ b/src/lib/tvgShape.cpp @@ -213,7 +213,7 @@ int Shape::appendRect(float x, float y, float w, float h, float cornerRadius) no } -int Shape::fill(size_t r, size_t g, size_t b, size_t a) noexcept +int Shape::fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept { auto impl = pImpl.get(); assert(impl); @@ -228,7 +228,7 @@ int Shape::fill(size_t r, size_t g, size_t b, size_t a) noexcept } -int Shape::fill(size_t* r, size_t* g, size_t* b, size_t* a) const noexcept +int Shape::fill(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept { auto impl = pImpl.get(); assert(impl); @@ -301,7 +301,7 @@ float Shape::strokeWidth() const noexcept } -int Shape::stroke(size_t r, size_t g, size_t b, size_t a) noexcept +int Shape::stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept { auto impl = pImpl.get(); assert(impl); @@ -312,7 +312,7 @@ int Shape::stroke(size_t r, size_t g, size_t b, size_t a) noexcept } -int Shape::strokeColor(size_t* r, size_t* g, size_t* b, size_t* a) const noexcept +int Shape::strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept { auto impl = pImpl.get(); assert(impl); diff --git a/src/lib/tvgShapeImpl.h b/src/lib/tvgShapeImpl.h index 05be16d..e1a4e9f 100644 --- a/src/lib/tvgShapeImpl.h +++ b/src/lib/tvgShapeImpl.h @@ -31,7 +31,7 @@ struct ShapeFill struct ShapeStroke { float width = 0; - size_t color[4] = {0, 0, 0, 0}; + uint8_t color[4] = {0, 0, 0, 0}; size_t* dashPattern = nullptr; size_t dashCnt = 0; StrokeCap cap = StrokeCap::Square; @@ -188,7 +188,7 @@ struct Shape::Impl return 0; } - bool strokeColor(size_t r, size_t g, size_t b, size_t a) + bool strokeColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) { if (!stroke) stroke = new ShapeStroke(); assert(stroke); -- 2.7.4