diff options
author | Mike Klein <mtklein@chromium.org> | 2018-05-07 10:56:40 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-07 16:14:09 +0000 |
commit | ad67c66a5849fa53b0e286ae8a78ada4661c964a (patch) | |
tree | 998096c8aba91c6334f6daf2e29a2f07efb7803c | |
parent | 240fddd01b90f8e2d56da3e6bed2e76c57d09e6f (diff) |
track bounds of top-level control ops
We don't need an explicit save-restore block to determine the bounds of
top-level control operations... the implicit save-restore that all
picutres have should logically work the same way.
The commented test failed before this and passes now.
Bug: skia:7735
Change-Id: Ibd31a3a9b0b48042ab3869a6bb57bc8d8bb78c09
Reviewed-on: https://skia-review.googlesource.com/126460
Commit-Queue: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
-rw-r--r-- | src/core/SkRecordDraw.cpp | 3 | ||||
-rw-r--r-- | tests/PictureBBHTest.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
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{}); |