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>
This commit is contained in:
parent
ad7cb810dc
commit
5cf7b6175e
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user