From 68be67ab4f0a4f27eee203b70c6b25ba5277707c Mon Sep 17 00:00:00 2001 From: Jim Graham Date: Wed, 22 Feb 2023 12:33:37 -0800 Subject: [PATCH] save/restore around clipping the (potentially cached) frame canvas --- .../darwin/ios/framework/Source/FlutterPlatformViews.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index 880d07fb97aa3..7bdf4c0aaec6d 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -821,6 +821,8 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect, return layer; } SkCanvas* overlay_canvas = frame->SkiaCanvas(); + int restore_count = overlay_canvas->getSaveCount(); + overlay_canvas->save(); overlay_canvas->clipRect(rect); overlay_canvas->clear(SK_ColorTRANSPARENT); if (frame->GetDisplayListBuilder()) { @@ -828,6 +830,7 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect, } else { slice->render_into(overlay_canvas); } + overlay_canvas->restoreToCount(restore_count); layer->did_submit_last_frame = frame->Submit(); return layer;