aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-03-10 13:54:16 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-10 19:58:14 +0000
commitdc9f0dbe4cdcdf6fead5fc28532d58f7d998a447 (patch)
tree2fd3b0ad0a817c95ea52588e6047a9324e4892c9
parentcccda60aca592d2320d79e2871e057778b2688ab (diff)
Check for bad bounds in picture cullbounds
BUG=skia: Change-Id: Icaed150fa005ba7539bcca4646710b42dfcbf94a Reviewed-on: https://skia-review.googlesource.com/9536 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r--src/core/SkPictureRecorder.cpp6
-rw-r--r--tests/CanvasTest.cpp2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index 0c81632eb8..aaf1d0d0de 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -18,14 +18,16 @@
SkPictureRecorder::SkPictureRecorder() {
fActivelyRecording = false;
- fRecorder.reset(new SkRecorder(nullptr, SkRect::MakeWH(0, 0), &fMiniRecorder));
+ fRecorder.reset(new SkRecorder(nullptr, SkRect::MakeEmpty(), &fMiniRecorder));
}
SkPictureRecorder::~SkPictureRecorder() {}
-SkCanvas* SkPictureRecorder::beginRecording(const SkRect& cullRect,
+SkCanvas* SkPictureRecorder::beginRecording(const SkRect& userCullRect,
SkBBHFactory* bbhFactory /* = nullptr */,
uint32_t recordFlags /* = 0 */) {
+ const SkRect cullRect = userCullRect.isEmpty() ? SkRect::MakeEmpty() : userCullRect;
+
fCullRect = cullRect;
fFlags = recordFlags;
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index c35e7b0522..f6b275fccc 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -98,6 +98,8 @@ DEF_TEST(canvas_clipbounds, reporter) {
{
SkCanvas c(-10, -20);
REPORTER_ASSERT(reporter, c.getBaseLayerSize() == SkISize::MakeEmpty());
+
+ SkPictureRecorder().beginRecording({ 5, 5, 4, 4 });
}
}