diff options
author | 2012-08-20 15:04:15 +0000 | |
---|---|---|
committer | 2012-08-20 15:04:15 +0000 | |
commit | 28136b308fe467da113983cfee332faea133cd8a (patch) | |
tree | a71520b4b59a22113b4a84bed082789335e26810 /tools/PictureRenderer.cpp | |
parent | a40c20df0e4c5d04acb0841d70127778c0a779ec (diff) |
flush() and glFinish() are now in the timed area of rendering.
git-svn-id: http://skia.googlecode.com/svn/trunk@5187 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools/PictureRenderer.cpp')
-rw-r--r-- | tools/PictureRenderer.cpp | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp index 0a6d0a8dbd..bae8a4bb40 100644 --- a/tools/PictureRenderer.cpp +++ b/tools/PictureRenderer.cpp @@ -70,9 +70,18 @@ void PictureRenderer::end() { } void PictureRenderer::resetState() { +#if SK_SUPPORT_GPU + if (this->isUsingGpuDevice()) { + SkGLContext* glContext = fGrContextFactory.getGLContext( + GrContextFactory::kNative_GLContextType); + SK_GL(*glContext, Finish()); + } +#endif +} + +void PictureRenderer::finishDraw() { SkASSERT(fCanvas.get() != NULL); - SkASSERT(fPicture != NULL); - if (NULL == fCanvas.get() || NULL == fPicture) { + if (NULL == fCanvas.get()) { return; } @@ -82,8 +91,13 @@ void PictureRenderer::resetState() { if (this->isUsingGpuDevice()) { SkGLContext* glContext = fGrContextFactory.getGLContext( GrContextFactory::kNative_GLContextType); + + SkASSERT(glContext != NULL); + if (NULL == glContext) { + return; + } + SK_GL(*glContext, Finish()); - fGrContext->freeGpuResources(); } #endif } @@ -100,6 +114,7 @@ void PipePictureRenderer::render() { SkCanvas* pipeCanvas = writer.startRecording(&pipeController); pipeCanvas->drawPicture(*fPicture); writer.endRecording(); + this->finishDraw(); } void SimplePictureRenderer::render() { @@ -110,6 +125,7 @@ void SimplePictureRenderer::render() { } fCanvas->drawPicture(*fPicture); + this->finishDraw(); } TiledPictureRenderer::TiledPictureRenderer() @@ -144,6 +160,7 @@ void TiledPictureRenderer::render() { this->drawTiles(); this->copyTilesToCanvas(); + this->finishDraw(); } void TiledPictureRenderer::end() { @@ -193,18 +210,24 @@ void TiledPictureRenderer::drawTiles() { } } -void TiledPictureRenderer::resetState() { - SkASSERT(fCanvas.get() != NULL); - SkASSERT(fPicture != NULL); - if (NULL == fCanvas.get() || NULL == fPicture) { - return; - } - +void TiledPictureRenderer::finishDraw() { for (int i = 0; i < fTiles.count(); ++i) { fTiles[i].fCanvas->flush(); } - this->INHERITED::resetState(); +#if SK_SUPPORT_GPU + if (this->isUsingGpuDevice()) { + SkGLContext* glContext = fGrContextFactory.getGLContext( + GrContextFactory::kNative_GLContextType); + + SkASSERT(glContext != NULL); + if (NULL == glContext) { + return; + } + + SK_GL(*glContext, Finish()); + } +#endif } void TiledPictureRenderer::copyTilesToCanvas() { |