From 7fc65fd19fe0988b6ab8f4fe3c9cc58cd6482759 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 21 Apr 2016 07:55:37 -0700 Subject: [PATCH] Make OpacityLayer hit SkRecordNoopSaveLayerDrawRestores (#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. --- flow/layers/opacity_layer.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flow/layers/opacity_layer.cc b/flow/layers/opacity_layer.cc index 83c338248..fa4b1e1e3 100644 --- a/flow/layers/opacity_layer.cc +++ b/flow/layers/opacity_layer.cc @@ -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); -- GitLab