Make OpacityLayer hit SkRecordNoopSaveLayerDrawRestores (flutter/engine#2604)

Previously we were applying opacity in a different way than Skia
expects. Now we use the exact pattern that Skia expects so that we hit
more optimizations inside SkRecordOptimize.

After this patch, we don't actually get the optimization because we
don't yet run SkRecordOptimize over the composited tree. A later patch
will actually cause us to run SkRecordOptimize.
This commit is contained in:
Adam Barth
2016-04-21 07:55:37 -07:00
parent c7c2b6aa1c
commit 9c8595512e

View File

@@ -19,8 +19,7 @@ void OpacityLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
void OpacityLayer::Paint(PaintContext::ScopedFrame& frame) {
SkPaint paint;
paint.setColor(SkColorSetARGB(alpha_, 0, 0, 0));
paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
paint.setAlpha(alpha_);
SkCanvas& canvas = frame.canvas();
SkAutoCanvasRestore save(&canvas, false);