From fe69e3eea15f04092c02fa60a6f2a5e1a78264ae Mon Sep 17 00:00:00 2001 From: liyuqian Date: Thu, 31 May 2018 16:41:58 -0700 Subject: [PATCH] Call SkAutoCanvasRestore with doSave = true (flutter/engine#5432) Although we do have a save before this SkAutoCanvasRestore so we can theoretically send in doSave = false, it's safer to set doSave to true to prevent future breakage. As discussed with mtklein@google.com and reed@google.com, saving canvas is very cheap in Skia so this should have no performance impact. Skia is also considering remove doSave argument from SkAutoCanvasRestore and always save the canvas. --- engine/src/flutter/flow/raster_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/flutter/flow/raster_cache.cc b/engine/src/flutter/flow/raster_cache.cc index afd3d27dab..0922cdcec3 100644 --- a/engine/src/flutter/flow/raster_cache.cc +++ b/engine/src/flutter/flow/raster_cache.cc @@ -18,7 +18,7 @@ namespace flow { void RasterCacheResult::draw(SkCanvas& canvas) const { - SkAutoCanvasRestore auto_restore(&canvas, false); + SkAutoCanvasRestore auto_restore(&canvas, true); SkIRect bounds = RasterCache::GetDeviceBounds(logical_rect_, canvas.getTotalMatrix()); FXL_DCHECK(bounds.size() == image_->dimensions());