sw_engine: concrete shape rendering sequence.
[platform/core/graphics/tizenvg.git] / src / lib / tvgGlCanvas.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_GLCANVAS_CPP_
18 #define _TVG_GLCANVAS_CPP_
19
20 #include "tvgCommon.h"
21 #include "tvgCanvasBase.h"
22 #include "tvgGlRenderer.h"
23
24 /************************************************************************/
25 /* Internal Class Implementation                                        */
26 /************************************************************************/
27
28 struct GlCanvas::Impl : CanvasBase
29 {
30     Impl() : CanvasBase(GlRenderer::inst()) {}
31 };
32
33
34 /************************************************************************/
35 /* External Class Implementation                                        */
36 /************************************************************************/
37
38 GlCanvas::GlCanvas() : pImpl(make_unique<Impl>())
39 {
40 }
41
42
43 GlCanvas::~GlCanvas()
44 {
45 }
46
47
48 unique_ptr<GlCanvas> GlCanvas::gen() noexcept
49 {
50     auto canvas = unique_ptr<GlCanvas>(new GlCanvas);
51     assert(canvas);
52
53     return canvas;
54 }
55
56
57 int GlCanvas::push(unique_ptr<PaintNode> paint) noexcept
58 {
59     auto impl = pImpl.get();
60     assert(impl);
61     return impl->push(move(paint));
62 }
63
64 int GlCanvas::clear() noexcept
65 {
66     auto impl = pImpl.get();
67     assert(impl);
68     return impl->clear();
69 }
70
71
72 int GlCanvas::update() noexcept
73 {
74     auto impl = pImpl.get();
75     assert(impl);
76     return impl->update();
77 }
78
79
80 RenderMethod* GlCanvas::engine() noexcept
81 {
82     auto impl = pImpl.get();
83     assert(impl);
84     return impl->renderer;
85 }
86
87
88 int GlCanvas::draw(bool async) noexcept
89 {
90     auto impl = pImpl.get();
91     assert(impl);
92     return impl->draw();
93 }
94
95 #endif /* _TVG_GLCANVAS_CPP_ */