From f3afd2a636f48dacbd369d5d4976cced1ec25d7f Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 11 Jun 2020 14:27:20 +0900 Subject: [PATCH] common fill: added spread mode. Change-Id: I95d47bc492d5a22326a745a591d243e56a26bae4 --- inc/tizenvg.h | 6 +++++- src/lib/sw_engine/tvgSwRenderer.cpp | 1 + src/lib/tvgFill.cpp | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/inc/tizenvg.h b/inc/tizenvg.h index b089387b..85d8e27c 100644 --- a/inc/tizenvg.h +++ b/inc/tizenvg.h @@ -72,6 +72,7 @@ enum class TVG_EXPORT Result { Success = 0, InvalidArguments, InsufficientCondit enum class TVG_EXPORT PathCommand { Close = 0, MoveTo, LineTo, CubicTo }; enum class TVG_EXPORT StrokeCap { Square = 0, Round, Butt }; enum class TVG_EXPORT StrokeJoin { Bevel = 0, Round, Miter }; +enum class TVG_EXPORT FillSpread { Pad = 0, Reflect, Repeat }; struct Point @@ -117,14 +118,17 @@ class TVG_EXPORT Fill public: struct ColorStop { - float pos; + float offset; uint8_t r, g, b, a; }; virtual ~Fill(); Result colorStops(const ColorStop* colorStops, uint32_t cnt) noexcept; + Result spread(FillSpread s) noexcept; + uint32_t colorStops(const ColorStop** colorStops) const noexcept; + FillSpread spread() const noexcept; _TVG_DECALRE_IDENTIFIER(); _TVG_DECLARE_PRIVATE(Fill); diff --git a/src/lib/sw_engine/tvgSwRenderer.cpp b/src/lib/sw_engine/tvgSwRenderer.cpp index 59c49105..43c2628c 100644 --- a/src/lib/sw_engine/tvgSwRenderer.cpp +++ b/src/lib/sw_engine/tvgSwRenderer.cpp @@ -82,6 +82,7 @@ bool SwRenderer::dispose(const Shape& shape, void *data) return true; } + void* SwRenderer::prepare(const Shape& sdata, void* data, const RenderTransform* transform, RenderUpdateFlag flags) { //prepare shape data diff --git a/src/lib/tvgFill.cpp b/src/lib/tvgFill.cpp index 13001c83..bfef7a6d 100644 --- a/src/lib/tvgFill.cpp +++ b/src/lib/tvgFill.cpp @@ -28,6 +28,7 @@ struct Fill::Impl { ColorStop* colorStops = nullptr; uint32_t cnt = 0; + FillSpread spread; ~Impl() { @@ -85,4 +86,24 @@ uint32_t Fill::colorStops(const ColorStop** colorStops) const noexcept return impl->cnt; } + +Result Fill::spread(FillSpread s) noexcept +{ + auto impl = pImpl.get(); + if (!impl) return Result::MemoryCorruption; + + impl->spread = s; + + return Result::Success; +} + + +FillSpread Fill::spread() const noexcept +{ + auto impl = pImpl.get(); + assert(impl); + + return impl->spread; +} + #endif /* _TVG_FILL_CPP_ */ \ No newline at end of file