[Adaptation Layer] Added rive-tizen adaptation layer class.
[platform/core/uifw/rive-tizen.git] / submodule / test / no_op_renderer.hpp
1 #ifndef _RIVE_NOOP_RENDERER_HPP_
2 #define _RIVE_NOOP_RENDERER_HPP_
3 #include "renderer.hpp"
4 #include <vector>
5
6 namespace rive
7 {
8         class NoOpRenderPaint : public RenderPaint
9         {
10         public:
11                 void color(unsigned int value) override {}
12                 void style(RenderPaintStyle value) override {}
13                 void thickness(float value) override {}
14                 void join(StrokeJoin value) override {}
15                 void cap(StrokeCap value) override {}
16                 void blendMode(BlendMode value) override {}
17
18                 void linearGradient(float sx, float sy, float ex, float ey) override {}
19                 void radialGradient(float sx, float sy, float ex, float ey) override {}
20                 void addStop(unsigned int color, float stop) override {}
21                 void completeGradient() override {}
22         };
23
24         enum class NoOpPathCommandType
25         {
26                 MoveTo,
27                 LineTo,
28                 CubicTo,
29                 Reset,
30                 Close
31         };
32
33         struct NoOpPathCommand
34         {
35                 NoOpPathCommandType command;
36                 float x;
37                 float y;
38                 float inX;
39                 float inY;
40                 float outX;
41                 float outY;
42         };
43
44         class NoOpRenderPath : public RenderPath
45         {
46         public:
47                 std::vector<NoOpPathCommand> commands;
48                 void reset() override
49                 {
50                         commands.emplace_back((NoOpPathCommand){NoOpPathCommandType::Reset,
51                                                                 0.0f,
52                                                                 0.0f,
53                                                                 0.0f,
54                                                                 0.0f,
55                                                                 0.0f,
56                                                                 0.0f});
57                 }
58
59                 void fillRule(FillRule value) override {}
60                 void addPath(CommandPath* path, const Mat2D& transform) override {}
61                 void addRenderPath(RenderPath* path, const Mat2D& transform) override {}
62
63                 void moveTo(float x, float y) override
64                 {
65                         commands.emplace_back((NoOpPathCommand){
66                             NoOpPathCommandType::MoveTo, x, y, 0.0f, 0.0f, 0.0f, 0.0f});
67                 }
68                 void lineTo(float x, float y) override
69                 {
70                         commands.emplace_back((NoOpPathCommand){
71                             NoOpPathCommandType::LineTo, x, y, 0.0f, 0.0f, 0.0f, 0.0f});
72                 }
73                 void cubicTo(
74                     float ox, float oy, float ix, float iy, float x, float y) override
75                 {
76                         commands.emplace_back((NoOpPathCommand){
77                             NoOpPathCommandType::CubicTo, x, y, ix, iy, ox, oy});
78                 }
79                 void close() override
80                 {
81                         commands.emplace_back((NoOpPathCommand){NoOpPathCommandType::Close,
82                                                                 0.0f,
83                                                                 0.0f,
84                                                                 0.0f,
85                                                                 0.0f,
86                                                                 0.0f,
87                                                                 0.0f});
88                 }
89         };
90
91         class NoOpRenderer : public Renderer
92         {
93                 void save() {}
94                 void restore() {}
95                 void transform(const Mat2D& transform) {}
96                 void translate(float x, float y) {}
97                 void drawPath(RenderPath* path, RenderPaint* paint) {}
98                 void clipPath(RenderPath* path) {}
99         };
100
101 } // namespace rive
102 #endif