common fill: added spread mode. 28/235928/1
authorHermet Park <chuneon.park@samsung.com>
Thu, 11 Jun 2020 05:27:20 +0000 (14:27 +0900)
committerHermet Park <chuneon.park@samsung.com>
Thu, 11 Jun 2020 05:27:20 +0000 (14:27 +0900)
Change-Id: I95d47bc492d5a22326a745a591d243e56a26bae4

inc/tizenvg.h
src/lib/sw_engine/tvgSwRenderer.cpp
src/lib/tvgFill.cpp

index b089387..85d8e27 100644 (file)
@@ -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);
index 59c4910..43c2628 100644 (file)
@@ -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
index 13001c8..bfef7a6 100644 (file)
@@ -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