thorvg/src/lib/gl_engine/tvgGlRenderer.cpp
Hermet Park 682bc25298 common shape: revise scale/rotate approach.
Come to think of it, this optimized method is not so useful,
it could just bring the user misunderstanding and
not to efficient as I expected in the most cases.

So, changed policy for transformation behaviors.
it keeps the properties as others but leaves it to the backend implementation.

Plus, this change contains the correct RenderUpdateFlag.
You can refer the flag in the backend to figure out which kinds of properites has been updated

Change-Id: Ibe0494712598a8161950b9ae2e22ac45bed1c47b
2020-05-03 15:03:29 +09:00

113 lines
2.5 KiB
C++

/*
* 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 RenderInitializer renderInit;
struct GlShape
{
//TODO:
};
/************************************************************************/
/* External Class Implementation */
/************************************************************************/
bool GlRenderer::clear()
{
//TODO: (Request) to clear target
return true;
}
bool GlRenderer::render(const Shape& shape, void *data)
{
GlShape* sdata = static_cast<GlShape*>(data);
if (!sdata) return false;
//TODO:
return true;
}
bool GlRenderer::dispose(const Shape& shape, void *data)
{
GlShape* sdata = static_cast<GlShape*>(data);
if (!sdata) return false;
//TODO:
free(sdata);
return true;
}
void* GlRenderer::prepare(const Shape& shape, void* data, RenderUpdateFlag flags)
{
//prepare shape data
GlShape* sdata = static_cast<GlShape*>(data);
if (!sdata) {
sdata = static_cast<GlShape*>(calloc(1, sizeof(GlShape)));
assert(sdata);
}
//TODO:
return sdata;
}
int GlRenderer::init()
{
return RenderInitializer::init(renderInit, new GlRenderer);
}
int GlRenderer::term()
{
return RenderInitializer::term(renderInit);
}
size_t GlRenderer::unref()
{
return RenderInitializer::unref(renderInit);
}
size_t GlRenderer::ref()
{
return RenderInitializer::ref(renderInit);
}
GlRenderer* GlRenderer::inst()
{
return dynamic_cast<GlRenderer*>(RenderInitializer::inst(renderInit));
}
#endif /* _TVG_GL_RENDERER_CPP_ */