diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp index 37899e89c3..f712c0e436 100644 --- a/src/core/SkRecordDraw.cpp +++ b/src/core/SkRecordDraw.cpp @@ -167,6 +167,9 @@ public: , fCullRect(cullRect) , fBounds(bounds) { fCTM = SkMatrix::I(); + + // We push an extra save block to track the bounds of any top-level control operations. + fSaveStack.push({ 0, Bounds::MakeEmpty(), nullptr, fCTM }); } void cleanUp() { diff --git a/tests/PictureBBHTest.cpp b/tests/PictureBBHTest.cpp index f01f0fbe93..da8543c2ac 100644 --- a/tests/PictureBBHTest.cpp +++ b/tests/PictureBBHTest.cpp @@ -124,8 +124,7 @@ DEF_TEST(PictureNegativeSpace, r) { REPORTER_ASSERT(r, pic->cullRect() == (SkRect{-20,-20,-10,-10})); } - // TODO: we should also get the same results without the explicit save/restore - if (0) { + { auto canvas = recorder.beginRecording(cull, &factory); canvas->clipRect(cull); canvas->drawRect({-20,-20,-10,-10}, SkPaint{});