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_GLCANVAS_CPP_
18 #define _TVG_GLCANVAS_CPP_
20 #include "tvgCommon.h"
21 #include "tvgCanvasBase.h"
22 #include "tvgGlRenderer.h"
24 /************************************************************************/
25 /* Internal Class Implementation */
26 /************************************************************************/
28 struct GlCanvas::Impl : CanvasBase
30 Impl() : CanvasBase(GlRenderer::inst()) {}
34 /************************************************************************/
35 /* External Class Implementation */
36 /************************************************************************/
38 GlCanvas::GlCanvas() : pImpl(make_unique<Impl>())
48 unique_ptr<GlCanvas> GlCanvas::gen() noexcept
50 auto canvas = unique_ptr<GlCanvas>(new GlCanvas);
57 int GlCanvas::push(unique_ptr<PaintNode> paint) noexcept
59 auto impl = pImpl.get();
61 return impl->push(move(paint));
64 int GlCanvas::clear() noexcept
66 auto impl = pImpl.get();
72 int GlCanvas::update() noexcept
74 auto impl = pImpl.get();
76 return impl->update();
80 RenderMethod* GlCanvas::engine() noexcept
82 auto impl = pImpl.get();
84 return impl->renderer;
88 int GlCanvas::draw(bool async) noexcept
90 auto impl = pImpl.get();
95 #endif /* _TVG_GLCANVAS_CPP_ */