sw_engine: concrete shape rendering sequence.
[platform/core/graphics/tizenvg.git] / src / lib / gl_engine / tvgGlRenderer.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *               http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  *
16  */
17 #ifndef _TVG_GL_RENDERER_CPP_
18 #define _TVG_GL_RENDERER_CPP_
19
20 #include "tvgCommon.h"
21 #include "tvgGlRenderer.h"
22
23 /************************************************************************/
24 /* Internal Class Implementation                                        */
25 /************************************************************************/
26
27 static RenderInitializer renderInit;
28
29 struct GlShape
30 {
31     //TODO:
32 };
33
34 /************************************************************************/
35 /* External Class Implementation                                        */
36 /************************************************************************/
37
38 bool GlRenderer::render(const ShapeNode& shape, void *data)
39 {
40     GlShape* sdata = static_cast<GlShape*>(data);
41     if (!sdata) return false;
42
43     //TODO:
44
45     return true;
46 }
47
48
49 bool GlRenderer::dispose(const ShapeNode& shape, void *data)
50 {
51     GlShape* sdata = static_cast<GlShape*>(data);
52     if (!sdata) return false;
53
54     //TODO:
55
56     free(sdata);
57     return true;
58 }
59
60
61 void* GlRenderer::prepare(const ShapeNode& shape, void* data, UpdateFlag flags)
62 {
63     //prepare shape data
64     GlShape* sdata = static_cast<GlShape*>(data);
65     if (!sdata) {
66         sdata = static_cast<GlShape*>(calloc(1, sizeof(GlShape)));
67         assert(sdata);
68     }
69
70     //TODO:
71
72     return sdata;
73 }
74
75
76 int GlRenderer::init()
77 {
78     return RenderInitializer::init(renderInit, new GlRenderer);
79 }
80
81
82 int GlRenderer::term()
83 {
84     return RenderInitializer::term(renderInit);
85 }
86
87
88 size_t GlRenderer::unref()
89 {
90     return RenderInitializer::unref(renderInit);
91 }
92
93
94 size_t GlRenderer::ref()
95 {
96     return RenderInitializer::ref(renderInit);
97 }
98
99
100 GlRenderer* GlRenderer::inst()
101 {
102     return dynamic_cast<GlRenderer*>(RenderInitializer::inst(renderInit));
103 }
104
105
106 #endif /* _TVG_GL_RENDERER_CPP_ */