enum class TIZENVG_EXPORT PathCommand { Close, MoveTo, LineTo, CubicTo };
-class RasterMethod;
+class RenderMethod;
struct Point
{
{
public:
virtual ~PaintNode() {}
- virtual int dispose(RasterMethod* engine) = 0;
- virtual int update(RasterMethod* engine) = 0;
+ virtual int dispose(RenderMethod* engine) = 0;
+ virtual int update(RenderMethod* engine) = 0;
};
public:
~ShapeNode();
- int dispose(RasterMethod* engine) noexcept override;
- int update(RasterMethod* engine) noexcept override;
+ int dispose(RenderMethod* engine) noexcept override;
+ int update(RenderMethod* engine) noexcept override;
int clear() noexcept;
int appendRect(float x, float y, float w, float h, float radius) noexcept;
public:
~SceneNode();
- int dispose(RasterMethod* engine) noexcept override;
- int update(RasterMethod* engine) noexcept override;
+ int dispose(RenderMethod* engine) noexcept override;
+ int update(RenderMethod* engine) noexcept override;
int push(std::unique_ptr<ShapeNode> shape) noexcept;
int update() noexcept;
int draw(bool async = true) noexcept;
int sync() noexcept;
- RasterMethod* engine() noexcept;
+ RenderMethod* engine() noexcept;
int target(uint32_t* buffer, size_t stride, size_t height) noexcept;
int update() noexcept;
int draw(bool async = true) noexcept { return 0; }
int sync() noexcept { return 0; }
- RasterMethod* engine() noexcept;
+ RenderMethod* engine() noexcept;
static std::unique_ptr<GlCanvas> gen() noexcept;
source_file = [
- 'tvgGlEngine.h',
- 'tvgGlEngine.cpp',
+ 'tvgGlRenderer.h',
+ 'tvgGlRenderer.cpp',
]
glraster_dep = declare_dependency(
+++ /dev/null
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#ifndef _TVG_GL_ENGINE_CPP_
-#define _TVG_GL_ENGINE_CPP_
-
-#include "tvgCommon.h"
-#include "tvgGlEngine.h"
-
-/************************************************************************/
-/* Internal Class Implementation */
-/************************************************************************/
-
-static RasterMethodInit engineInit;
-
-struct GlShape
-{
- //TODO:
-};
-
-/************************************************************************/
-/* External Class Implementation */
-/************************************************************************/
-
-void* GlEngine::dispose(const ShapeNode& shape, void *data)
-{
- GlShape* sdata = static_cast<GlShape*>(data);
- if (!sdata) return nullptr;
- free(sdata);
- return nullptr;
-}
-
-
-void* GlEngine::prepare(const ShapeNode& shape, void* data, UpdateFlag flags)
-{
- //prepare shape data
- GlShape* sdata = static_cast<GlShape*>(data);
- if (!sdata) {
- sdata = static_cast<GlShape*>(calloc(1, sizeof(GlShape)));
- assert(sdata);
- }
- return sdata;
-}
-
-
-int GlEngine::init()
-{
- return RasterMethodInit::init(engineInit, new GlEngine);
-}
-
-
-int GlEngine::term()
-{
- return RasterMethodInit::term(engineInit);
-}
-
-
-size_t GlEngine::unref()
-{
- return RasterMethodInit::unref(engineInit);
-}
-
-
-size_t GlEngine::ref()
-{
- return RasterMethodInit::ref(engineInit);
-}
-
-
-GlEngine* GlEngine::inst()
-{
- return dynamic_cast<GlEngine*>(RasterMethodInit::inst(engineInit));
-}
-
-
-#endif /* _TVG_GL_ENGINE_CPP_ */
+++ /dev/null
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#ifndef _TVG_GL_ENGINE_H_
-#define _TVG_GL_ENGINE_H_
-
-namespace tvg
-{
-
-class GlEngine : public RasterMethod
-{
-public:
- void* prepare(const ShapeNode& shape, void* data, UpdateFlag flags) override;
- void* dispose(const ShapeNode& shape, void *data) override;
- size_t ref() override;
- size_t unref() override;
-
- static GlEngine* inst();
- static int init();
- static int term();
-
-private:
- GlEngine(){};
- ~GlEngine(){};
-};
-
-}
-
-#endif /* _TVG_GL_ENGINE_H_ */
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef _TVG_GL_RENDERER_CPP_
+#define _TVG_GL_RENDERER_CPP_
+
+#include "tvgCommon.h"
+#include "tvgGlRenderer.h"
+
+/************************************************************************/
+/* Internal Class Implementation */
+/************************************************************************/
+
+static RenderMethodInit engineInit;
+
+struct GlShape
+{
+ //TODO:
+};
+
+/************************************************************************/
+/* External Class Implementation */
+/************************************************************************/
+
+void* GlRenderer::dispose(const ShapeNode& shape, void *data)
+{
+ GlShape* sdata = static_cast<GlShape*>(data);
+ if (!sdata) return nullptr;
+ free(sdata);
+ return nullptr;
+}
+
+
+void* GlRenderer::prepare(const ShapeNode& shape, void* data, UpdateFlag flags)
+{
+ //prepare shape data
+ GlShape* sdata = static_cast<GlShape*>(data);
+ if (!sdata) {
+ sdata = static_cast<GlShape*>(calloc(1, sizeof(GlShape)));
+ assert(sdata);
+ }
+ return sdata;
+}
+
+
+int GlRenderer::init()
+{
+ return RenderMethodInit::init(engineInit, new GlRenderer);
+}
+
+
+int GlRenderer::term()
+{
+ return RenderMethodInit::term(engineInit);
+}
+
+
+size_t GlRenderer::unref()
+{
+ return RenderMethodInit::unref(engineInit);
+}
+
+
+size_t GlRenderer::ref()
+{
+ return RenderMethodInit::ref(engineInit);
+}
+
+
+GlRenderer* GlRenderer::inst()
+{
+ return dynamic_cast<GlRenderer*>(RenderMethodInit::inst(engineInit));
+}
+
+
+#endif /* _TVG_GL_RENDERER_CPP_ */
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef _TVG_GL_RENDERER_H_
+#define _TVG_GL_RENDERER_H_
+
+namespace tvg
+{
+
+class GlRenderer : public RenderMethod
+{
+public:
+ void* prepare(const ShapeNode& shape, void* data, UpdateFlag flags) override;
+ void* dispose(const ShapeNode& shape, void *data) override;
+ size_t ref() override;
+ size_t unref() override;
+
+ static GlRenderer* inst();
+ static int init();
+ static int term();
+
+private:
+ GlRenderer(){};
+ ~GlRenderer(){};
+};
+
+}
+
+#endif /* _TVG_GL_RENDERER_H_ */
source_file = [
'tvgSwCommon.h',
- 'tvgSwEngine.h',
- 'tvgSwEngine.cpp',
+ 'tvgSwRenderer.h',
+ 'tvgSwRenderer.cpp',
'tvgSwShape.cpp',
'tvgSwRle.cpp',
]
+++ /dev/null
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#ifndef _TVG_SW_ENGINE_CPP_
-#define _TVG_SW_ENGINE_CPP_
-
-#include "tvgSwCommon.h"
-#include "tvgSwEngine.h"
-
-/************************************************************************/
-/* Internal Class Implementation */
-/************************************************************************/
-
-static RasterMethodInit engineInit;
-
-
-/************************************************************************/
-/* External Class Implementation */
-/************************************************************************/
-
-void* SwEngine::dispose(const ShapeNode& shape, void *data)
-{
- SwShape* sdata = static_cast<SwShape*>(data);
- if (!sdata) return nullptr;
- shapeReset(*sdata);
- free(sdata);
- return nullptr;
-}
-
-void* SwEngine::prepare(const ShapeNode& shape, void* data, UpdateFlag flags)
-{
- //prepare shape data
- SwShape* sdata = static_cast<SwShape*>(data);
- if (!sdata) {
- sdata = static_cast<SwShape*>(calloc(1, sizeof(SwShape)));
- assert(sdata);
- }
-
- if (flags == UpdateFlag::None) return nullptr;
-
- //invisible?
- size_t alpha;
- shape.fill(nullptr, nullptr, nullptr, &alpha);
- if (alpha == 0) return sdata;
-
- if (flags & UpdateFlag::Path) {
- shapeReset(*sdata);
- if (!shapeGenOutline(shape, *sdata)) return sdata;
- //TODO: From below sequence starts threading?
- if (!shapeTransformOutline(shape, *sdata)) return sdata;
- if (!shapeGenRle(shape, *sdata)) return sdata;
- }
-
- return sdata;
-}
-
-
-int SwEngine::init()
-{
- return RasterMethodInit::init(engineInit, new SwEngine);
-}
-
-
-int SwEngine::term()
-{
- return RasterMethodInit::term(engineInit);
-}
-
-
-size_t SwEngine::unref()
-{
- return RasterMethodInit::unref(engineInit);
-}
-
-
-size_t SwEngine::ref()
-{
- return RasterMethodInit::ref(engineInit);
-}
-
-
-SwEngine* SwEngine::inst()
-{
- return dynamic_cast<SwEngine*>(RasterMethodInit::inst(engineInit));
-}
-
-
-#endif /* _TVG_SW_ENGINE_CPP_ */
+++ /dev/null
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#ifndef _TVG_SW_ENGINE_H_
-#define _TVG_SW_ENGINE_H_
-
-class SwEngine : public RasterMethod
-{
-public:
- void* prepare(const ShapeNode& shape, void* data, UpdateFlag flags) override;
- void* dispose(const ShapeNode& shape, void *data) override;
- size_t ref() override;
- size_t unref() override;
-
- static SwEngine* inst();
- static int init();
- static int term();
-
-private:
- SwEngine(){};
- ~SwEngine(){};
-};
-
-#endif /* _TVG_SW_ENGINE_H_ */
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef _TVG_SW_RENDERER_CPP_
+#define _TVG_SW_RENDERER_CPP_
+
+#include "tvgSwCommon.h"
+#include "tvgSwRenderer.h"
+
+/************************************************************************/
+/* Internal Class Implementation */
+/************************************************************************/
+
+static RenderMethodInit engineInit;
+
+
+/************************************************************************/
+/* External Class Implementation */
+/************************************************************************/
+
+void* SwRenderer::dispose(const ShapeNode& shape, void *data)
+{
+ SwShape* sdata = static_cast<SwShape*>(data);
+ if (!sdata) return nullptr;
+ shapeReset(*sdata);
+ free(sdata);
+ return nullptr;
+}
+
+void* SwRenderer::prepare(const ShapeNode& shape, void* data, UpdateFlag flags)
+{
+ //prepare shape data
+ SwShape* sdata = static_cast<SwShape*>(data);
+ if (!sdata) {
+ sdata = static_cast<SwShape*>(calloc(1, sizeof(SwShape)));
+ assert(sdata);
+ }
+
+ if (flags == UpdateFlag::None) return nullptr;
+
+ //invisible?
+ size_t alpha;
+ shape.fill(nullptr, nullptr, nullptr, &alpha);
+ if (alpha == 0) return sdata;
+
+ if (flags & UpdateFlag::Path) {
+ shapeReset(*sdata);
+ if (!shapeGenOutline(shape, *sdata)) return sdata;
+ //TODO: From below sequence starts threading?
+ if (!shapeTransformOutline(shape, *sdata)) return sdata;
+ if (!shapeGenRle(shape, *sdata)) return sdata;
+ }
+
+ return sdata;
+}
+
+
+int SwRenderer::init()
+{
+ return RenderMethodInit::init(engineInit, new SwRenderer);
+}
+
+
+int SwRenderer::term()
+{
+ return RenderMethodInit::term(engineInit);
+}
+
+
+size_t SwRenderer::unref()
+{
+ return RenderMethodInit::unref(engineInit);
+}
+
+
+size_t SwRenderer::ref()
+{
+ return RenderMethodInit::ref(engineInit);
+}
+
+
+SwRenderer* SwRenderer::inst()
+{
+ return dynamic_cast<SwRenderer*>(RenderMethodInit::inst(engineInit));
+}
+
+
+#endif /* _TVG_SW_RENDERER_CPP_ */
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef _TVG_SW_RENDERER_H_
+#define _TVG_SW_RENDERER_H_
+
+class SwRenderer : public RenderMethod
+{
+public:
+ void* prepare(const ShapeNode& shape, void* data, UpdateFlag flags) override;
+ void* dispose(const ShapeNode& shape, void *data) override;
+ size_t ref() override;
+ size_t unref() override;
+
+ static SwRenderer* inst();
+ static int init();
+ static int term();
+
+private:
+ SwRenderer(){};
+ ~SwRenderer(){};
+};
+
+#endif /* _TVG_SW_RENDERER_H_ */
struct CanvasBase
{
vector<PaintNode*> nodes;
- RasterMethod* raster;
+ RenderMethod* renderer;
- CanvasBase(RasterMethod *pRaster):raster(pRaster)
+ CanvasBase(RenderMethod *pRenderer):renderer(pRenderer)
{
- raster->ref();
+ renderer->ref();
}
~CanvasBase()
{
clear();
- raster->unref();
+ renderer->unref();
}
int reserve(size_t n)
int clear()
{
for (auto node : nodes) {
- node->dispose(raster);
+ node->dispose(renderer);
delete(node);
}
nodes.clear();
if (SceneNode *scene = dynamic_cast<SceneNode *>(node)) {
} else if (ShapeNode *shape = dynamic_cast<ShapeNode *>(node)) {
- return shape->update(raster);
+ return shape->update(renderer);
}
#else
if (ShapeNode *shape = dynamic_cast<ShapeNode *>(node)) {
- return shape->update(raster);
+ return shape->update(renderer);
}
#endif
cout << "What type of PaintNode? = " << node << endl;
namespace tvg
{
-class RasterMethod
+class RenderMethod
{
public:
enum UpdateFlag { None = 0, Path = 1, Fill = 2, All = 3 };
- virtual ~RasterMethod() {}
+ virtual ~RenderMethod() {}
virtual void* prepare(const ShapeNode& shape, void* data, UpdateFlag flags) = 0;
virtual void* dispose(const ShapeNode& shape, void *data) = 0;
virtual size_t ref() = 0;
virtual size_t unref() = 0;
};
-struct RasterMethodInit
+struct RenderMethodInit
{
- RasterMethod* pInst = nullptr;
+ RenderMethod* pInst = nullptr;
size_t refCnt = 0;
bool initted = false;
- static int init(RasterMethodInit& initter, RasterMethod* engine)
+ static int init(RenderMethodInit& initter, RenderMethod* engine)
{
assert(engine);
if (initter.pInst || initter.refCnt > 0) return -1;
return 0;
}
- static int term(RasterMethodInit& initter)
+ static int term(RenderMethodInit& initter)
{
if (!initter.pInst || !initter.initted) return -1;
return 0;
}
- static size_t unref(RasterMethodInit& initter)
+ static size_t unref(RenderMethodInit& initter)
{
assert(initter.refCnt > 0);
--initter.refCnt;
return initter.refCnt;
}
- static RasterMethod* inst(RasterMethodInit& initter)
+ static RenderMethod* inst(RenderMethodInit& initter)
{
assert(initter.pInst);
return initter.pInst;
}
- static size_t ref(RasterMethodInit& initter)
+ static size_t ref(RenderMethodInit& initter)
{
return ++initter.refCnt;
}
#define _TVG_ENGINE_CPP_
#include "tvgCommon.h"
-#include "tvgSwEngine.h"
-#include "tvgGlEngine.h"
+#include "tvgSwRenderer.h"
+#include "tvgGlRenderer.h"
/************************************************************************/
/* Internal Class Implementation */
//TODO: Initialize Raster engines by configuration.
int ret = 0;
- ret |= SwEngine::init();
- ret |= GlEngine::init();
+ ret |= SwRenderer::init();
+ ret |= GlRenderer::init();
return ret;
}
int Engine::term() noexcept
{
int ret = 0;
- ret |= SwEngine::term();
- ret |= GlEngine::term();
+ ret |= SwRenderer::term();
+ ret |= GlRenderer::term();
return ret;
}
#include "tvgCommon.h"
#include "tvgCanvasBase.h"
-#include "tvgGlEngine.h"
+#include "tvgGlRenderer.h"
/************************************************************************/
/* Internal Class Implementation */
struct GlCanvas::Impl : CanvasBase
{
- Impl() : CanvasBase(GlEngine::inst()) {}
+ Impl() : CanvasBase(GlRenderer::inst()) {}
};
}
-RasterMethod* GlCanvas::engine() noexcept
+RenderMethod* GlCanvas::engine() noexcept
{
auto impl = pImpl.get();
assert(impl);
- return impl->raster;
+ return impl->renderer;
}
#endif /* _TVG_GLCANVAS_CPP_ */
}
-int SceneNode :: dispose(RasterMethod* engine) noexcept
+int SceneNode :: dispose(RenderMethod* engine) noexcept
{
return 0;
}
-int SceneNode :: update(RasterMethod* engine) noexcept
+int SceneNode :: update(RenderMethod* engine) noexcept
{
return 0;
}
-int ShapeNode :: dispose(RasterMethod* engine) noexcept
+int ShapeNode :: dispose(RenderMethod* engine) noexcept
{
auto impl = pImpl.get();
assert(impl);
}
-int ShapeNode :: update(RasterMethod* engine) noexcept
+int ShapeNode :: update(RenderMethod* engine) noexcept
{
auto impl = pImpl.get();
assert(impl);
- impl->edata = engine->prepare(*this, impl->edata, RasterMethod::UpdateFlag::All);
+ impl->edata = engine->prepare(*this, impl->edata, RenderMethod::UpdateFlag::All);
if (impl->edata) return 0;
return - 1;
}
#include "tvgCommon.h"
#include "tvgCanvasBase.h"
-#include "tvgSwEngine.h"
+#include "tvgSwRenderer.h"
/************************************************************************/
int stride = 0;
int height = 0;
- Impl() : CanvasBase(SwEngine::inst()) {}
+ Impl() : CanvasBase(SwRenderer::inst()) {}
};
}
-RasterMethod* SwCanvas::engine() noexcept
+RenderMethod* SwCanvas::engine() noexcept
{
auto impl = pImpl.get();
assert(impl);
- return impl->raster;
+ return impl->renderer;
}
#endif /* _TVG_SWCANVAS_CPP_ */