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_CANVAS_IMPL_H_
18 #define _TVG_CANVAS_IMPL_H_
20 #include "tvgCommon.h"
21 #include "tvgShapeImpl.h"
23 /************************************************************************/
24 /* Internal Class Implementation */
25 /************************************************************************/
29 vector<Paint*> paints;
30 RenderMethod* renderer;
32 Impl(RenderMethod* pRenderer):renderer(pRenderer)
43 int push(unique_ptr<Paint> paint)
45 auto p = paint.release();
56 for (auto paint : paints) {
57 if (auto scene = dynamic_cast<Scene*>(paint)) {
58 cout << "TODO: " << scene << endl;
59 } else if (auto shape = dynamic_cast<Shape*>(paint)) {
60 if (!shape->pImpl.get()->dispose(*shape, *renderer)) return -1;
73 for(auto paint: paints) {
74 if (auto scene = dynamic_cast<Scene*>(paint)) {
75 cout << "TODO: " << scene << endl;
76 } else if (auto shape = dynamic_cast<Shape*>(paint)) {
77 if (!shape->pImpl.get()->update(*shape, *renderer)) return -1;
83 int update(Paint* paint)
87 if (auto scene = dynamic_cast<Scene*>(paint)) {
88 cout << "TODO: " << scene << endl;
89 } else if (auto shape = dynamic_cast<Shape*>(paint)) {
90 if (!shape->pImpl.get()->update(*shape, *renderer)) return -1;
99 //Clear render target before drawing
100 if (!renderer->clear()) return -1;
102 for(auto paint: paints) {
103 if (auto scene = dynamic_cast<Scene*>(paint)) {
104 cout << "TODO: " << scene << endl;
105 } else if (auto shape = dynamic_cast<Shape*>(paint)) {
106 if(!shape->pImpl.get()->render(*shape, *renderer)) return -1;
113 #endif /* _TVG_CANVAS_IMPL_H_ */