common: code refactoring
[platform/core/graphics/tizenvg.git] / src / lib / tvgCanvas.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_CANVAS_CPP_
18 #define _TVG_CANVAS_CPP_
19
20 #include "tvgCommon.h"
21 #include "tvgCanvasImpl.h"
22
23 /************************************************************************/
24 /* External Class Implementation                                        */
25 /************************************************************************/
26
27 Canvas::Canvas(RenderMethod *pRenderer):pImpl(make_unique<Impl>(pRenderer))
28 {
29 }
30
31
32 Canvas::~Canvas()
33 {
34 }
35
36
37 Result Canvas::reserve(uint32_t n) noexcept
38 {
39     IMPL->paints.reserve(n);
40     return Result::Success;
41 }
42
43
44 Result Canvas::push(unique_ptr<Paint> paint) noexcept
45 {
46     return IMPL->push(move(paint));
47 }
48
49
50 Result Canvas::clear() noexcept
51 {
52     return IMPL->clear();
53 }
54
55
56 Result Canvas::draw(bool async) noexcept
57 {
58     return IMPL->draw();
59 }
60
61
62 Result Canvas::update() noexcept
63 {
64     return IMPL->update();
65 }
66
67
68 Result Canvas::update(Paint* paint) noexcept
69 {
70     return IMPL->update(paint);
71 }
72
73
74 Result Canvas::sync() noexcept
75 {
76     if (IMPL->renderer->flush()) return Result::Success;
77
78     return Result::InsufficientCondition;
79 }
80
81 #endif /* _TVG_CANVAS_CPP_ */