2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef _TVG_GL_RENDERER_CPP_
18 #define _TVG_GL_RENDERER_CPP_
20 #include "tvgCommon.h"
21 #include "tvgGlRenderer.h"
23 /************************************************************************/
24 /* Internal Class Implementation */
25 /************************************************************************/
27 static RenderInitializer renderInit;
34 /************************************************************************/
35 /* External Class Implementation */
36 /************************************************************************/
38 bool GlRenderer::render(const ShapeNode& shape, void *data)
40 GlShape* sdata = static_cast<GlShape*>(data);
41 if (!sdata) return false;
49 bool GlRenderer::dispose(const ShapeNode& shape, void *data)
51 GlShape* sdata = static_cast<GlShape*>(data);
52 if (!sdata) return false;
61 void* GlRenderer::prepare(const ShapeNode& shape, void* data, UpdateFlag flags)
64 GlShape* sdata = static_cast<GlShape*>(data);
66 sdata = static_cast<GlShape*>(calloc(1, sizeof(GlShape)));
76 int GlRenderer::init()
78 return RenderInitializer::init(renderInit, new GlRenderer);
82 int GlRenderer::term()
84 return RenderInitializer::term(renderInit);
88 size_t GlRenderer::unref()
90 return RenderInitializer::unref(renderInit);
94 size_t GlRenderer::ref()
96 return RenderInitializer::ref(renderInit);
100 GlRenderer* GlRenderer::inst()
102 return dynamic_cast<GlRenderer*>(RenderInitializer::inst(renderInit));
106 #endif /* _TVG_GL_RENDERER_CPP_ */