diff options
author | 2011-07-07 01:10:34 +0000 | |
---|---|---|
committer | 2011-07-07 01:10:34 +0000 | |
commit | 6757a1a2bb16a98ba1fdc60c441ca45166853f0e (patch) | |
tree | d0d9ec302769e5cd3e52197b0123d4d2b9dcf336 /samplecode | |
parent | 2ef12d4bb54312091d644f0ada3639c51c9f6e5a (diff) |
Be sure to call context->flush() before we swapbuffers, otherwise we might miss
some deferred drawing calls (esp. text). SkGpuCanvas was doing this for us, so
now we have to do it explicitly.
git-svn-id: http://skia.googlecode.com/svn/trunk@1813 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleApp.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 0d4ff44213..258da06e32 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -591,13 +591,17 @@ void SampleWindow::draw(SkCanvas* canvas) { } // do this last - if (fGrContext && (fCanvasType != kGPU_CanvasType)) { - fGrContext->setRenderTarget(fGrRenderTarget); - // need to send the bits to the (gpu) window - const SkBitmap& bm = this->getBitmap(); - fGrContext->writePixels(0, 0, bm.width(), bm.height(), - kRGBA_8888_GrPixelConfig, bm.getPixels(), - bm.rowBytes()); + if (fGrContext) { + // in case we have queued drawing calls + fGrContext->flush(); + if (fCanvasType != kGPU_CanvasType) { + // need to send the raster bits to the (gpu) window + fGrContext->setRenderTarget(fGrRenderTarget); + const SkBitmap& bm = this->getBitmap(); + fGrContext->writePixels(0, 0, bm.width(), bm.height(), + kRGBA_8888_GrPixelConfig, bm.getPixels(), + bm.rowBytes()); + } } presentGL(); } |