mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
gl_engine: hotfix for the main surface drawing issue.
GL might need to generate a default target FBO when the given target ID indicates the main surface. However, users may want to draw visuals directly onto the main surface. This policy must be reviewed thoroughly.
This commit is contained in:
parent
cde17a4fc6
commit
4746b2cf7b
2 changed files with 7 additions and 1 deletions
|
@ -1724,6 +1724,7 @@ public:
|
|||
* @param[in] h The height (in pixels) of the raster image.
|
||||
*
|
||||
* @warning This API is experimental and not officially supported. It may be modified or removed in future versions.
|
||||
* @warning Drawing on the main surface is currently not permitted. If the identifier (@p id) is set to @c 0, the operation will be aborted.
|
||||
*
|
||||
* @note Currently, this only allows the GL_RGBA8 color space format.
|
||||
* @note Experimental API
|
||||
|
|
|
@ -57,7 +57,7 @@ bool GlRenderer::clear()
|
|||
|
||||
bool GlRenderer::target(int32_t id, uint32_t w, uint32_t h)
|
||||
{
|
||||
assert(w > 0 && h > 0);
|
||||
if (id == GL_INVALID_VALUE || w == 0 || h == 0) return false;
|
||||
|
||||
surface.stride = w;
|
||||
surface.w = w;
|
||||
|
@ -70,6 +70,11 @@ bool GlRenderer::target(int32_t id, uint32_t w, uint32_t h)
|
|||
|
||||
mTargetFboId = static_cast<GLint>(id);
|
||||
|
||||
//TODO: It's not allow to draw onto the main surface. Need to confirm the policy.
|
||||
if (mTargetFboId == 0) {
|
||||
GL_CHECK(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &mTargetFboId));
|
||||
}
|
||||
|
||||
mRootTarget = make_unique<GlRenderTarget>(surface.w, surface.h);
|
||||
mRootTarget->init(mTargetFboId);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue