}
void Viewer::drawSlide(SkCanvas* canvas) {
- int count = canvas->save();
+ SkAutoCanvasRestore autorestore(canvas, false);
+
if (fWindow->supportsContentRect()) {
SkRect contentRect = fWindow->getContentRect();
canvas->clipRect(contentRect);
slideCanvas = offscreenSurface->getCanvas();
}
+ int count = slideCanvas->save();
slideCanvas->clear(SK_ColorWHITE);
slideCanvas->concat(fDefaultMatrix);
slideCanvas->concat(computeMatrix());
-
// Time the painting logic of the slide
double startTime = SkTime::GetMSecs();
fSlides[fCurrentSlide]->draw(slideCanvas);
fPaintTimes[fCurrentMeasurement] = SkTime::GetMSecs() - startTime;
+ slideCanvas->restoreToCount(count);
// Force a flush so we can time that, too
startTime = SkTime::GetMSecs();
sk_sp<SkColorSpace> cs = (kRGBA_F16_SkColorType == fColorType)
? SkColorSpace::MakeSRGBLinear() : SkColorSpace::MakeSRGB();
auto retaggedImage = SkImageMakeRasterCopyAndAssignColorSpace(fLastImage.get(), cs.get());
- canvas->drawImage(retaggedImage, 0, 0);
+ SkPaint paint;
+ paint.setBlendMode(SkBlendMode::kSrc);
+ canvas->drawImage(retaggedImage, 0, 0, &paint);
}
-
- canvas->restoreToCount(count);
}
void Viewer::onPaint(SkCanvas* canvas) {