aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2016-09-29 14:12:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-09-29 19:58:04 +0000
commit5cf7b6175ecf2c469bc6fedb815ba68f748f02d2 (patch)
tree5e9bd0d09be6fd2b97bb012d534f02bf701f1846
parentad7cb810dcb480dd5df81b55449334751894b5b3 (diff)
simplify composing raster surface into window
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2820 Change-Id: Ifce7bce8b764d2dea02733d823396576a7da609f Reviewed-on: https://skia-review.googlesource.com/2820 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r--example/HelloWorld.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/example/HelloWorld.cpp b/example/HelloWorld.cpp
index 5239311c85..464ec4429d 100644
--- a/example/HelloWorld.cpp
+++ b/example/HelloWorld.cpp
@@ -139,24 +139,13 @@ void HelloWorldWindow::drawContents(SkCanvas* canvas) {
void HelloWorldWindow::draw(SkCanvas* canvas) {
this->drawContents(canvas);
- // in case we have queued drawing calls
- fContext->flush();
// Invalidate the window to force a redraw. Poor man's animation mechanism.
this->inval(NULL);
if (kRaster_DeviceType == fType) {
- // need to send the raster bits to the (gpu) window
- sk_sp<SkImage> snap = fRasterSurface->makeImageSnapshot();
- SkPixmap pmap;
- if (snap->peekPixels(&pmap)) {
- const SkImageInfo& info = pmap.info();
-
- SkCanvas* canvas = fGpuSurface->getCanvas();
-
- canvas->writePixels(info, pmap.addr(), pmap.rowBytes(), 0, 0);
- canvas->flush();
- }
+ fRasterSurface->draw(fGpuSurface->getCanvas(), 0, 0, nullptr);
}
+ fGpuSurface->getCanvas()->flush();
INHERITED::present();
}