mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 20:44:52 +00:00
gl_engine: fix always-true clear flag
The clear flag specified in Canvas::draw is ignored when set to false, since GlRenderer::mClearBuffer is never explicitly reset to false. This commit ensures that mClearBuffer is reset to its default (false) after being used, so that the clear operation behaves correctly per frame. - Issue: #1779
This commit is contained in:
parent
8eb046c318
commit
676a465c55
3 changed files with 17 additions and 17 deletions
|
@ -195,23 +195,20 @@ void GlComposeTask::run()
|
||||||
{
|
{
|
||||||
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, getSelfFbo()));
|
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, getSelfFbo()));
|
||||||
|
|
||||||
// clear this fbo
|
// we must clear all area of fbo
|
||||||
if (mClearBuffer) {
|
GL_CHECK(glViewport(0, 0, mFbo->getWidth(), mFbo->getHeight()));
|
||||||
// we must clear all area of fbo
|
GL_CHECK(glScissor(0, 0, mFbo->getWidth(), mFbo->getHeight()));
|
||||||
GL_CHECK(glViewport(0, 0, mFbo->getWidth(), mFbo->getHeight()));
|
GL_CHECK(glClearColor(0, 0, 0, 0));
|
||||||
GL_CHECK(glScissor(0, 0, mFbo->getWidth(), mFbo->getHeight()));
|
GL_CHECK(glClearStencil(0));
|
||||||
GL_CHECK(glClearColor(0, 0, 0, 0));
|
#ifdef THORVG_GL_TARGET_GLES
|
||||||
GL_CHECK(glClearStencil(0));
|
GL_CHECK(glClearDepthf(0.0));
|
||||||
#ifdef THORVG_GL_TARGET_GLES
|
#else
|
||||||
GL_CHECK(glClearDepthf(0.0));
|
GL_CHECK(glClearDepth(0.0));
|
||||||
#else
|
#endif
|
||||||
GL_CHECK(glClearDepth(0.0));
|
GL_CHECK(glDepthMask(1));
|
||||||
#endif
|
|
||||||
GL_CHECK(glDepthMask(1));
|
|
||||||
|
|
||||||
GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
||||||
GL_CHECK(glDepthMask(0));
|
GL_CHECK(glDepthMask(0));
|
||||||
}
|
|
||||||
|
|
||||||
GL_CHECK(glViewport(0, 0, mRenderWidth, mRenderHeight));
|
GL_CHECK(glViewport(0, 0, mRenderWidth, mRenderHeight));
|
||||||
GL_CHECK(glScissor(0, 0, mRenderWidth, mRenderHeight));
|
GL_CHECK(glScissor(0, 0, mRenderWidth, mRenderHeight));
|
||||||
|
|
|
@ -853,6 +853,9 @@ bool GlRenderer::sync()
|
||||||
|
|
||||||
clearDisposes();
|
clearDisposes();
|
||||||
|
|
||||||
|
// Reset clear buffer flag to default (false) after use.
|
||||||
|
mClearBuffer = false;
|
||||||
|
|
||||||
delete task;
|
delete task;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -153,7 +153,7 @@ private:
|
||||||
} mDisposed;
|
} mDisposed;
|
||||||
|
|
||||||
BlendMethod mBlendMethod = BlendMethod::Normal;
|
BlendMethod mBlendMethod = BlendMethod::Normal;
|
||||||
bool mClearBuffer = true; //FIXME: clear buffer should be optional (default is false)
|
bool mClearBuffer = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _TVG_GL_RENDERER_H_ */
|
#endif /* _TVG_GL_RENDERER_H_ */
|
||||||
|
|
Loading…
Add table
Reference in a new issue