aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ClipStackTest.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-01-19 11:36:41 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-19 18:31:28 +0000
commit3726a4ac68821deea7ef4d5472a42f7d35ec4b4e (patch)
tree1caa4c84140921e0a90157a65bca6cf5ebb20942 /tests/ClipStackTest.cpp
parentfbff3297876a7c9c77a48be9a6fe62274a58bd8c (diff)
new hacky api to get cliprgn for android
BUG=skia: Change-Id: I42711a474906084adb3c888a599ae02505726484 Reviewed-on: https://skia-review.googlesource.com/7220 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'tests/ClipStackTest.cpp')
-rw-r--r--tests/ClipStackTest.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index a85f0168b2..8448f4cbe5 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -1456,4 +1456,33 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ClipMaskCache, reporter, ctxInfo) {
#endif
}
+#include "SkSurface.h"
+DEF_GPUTEST_FOR_ALL_CONTEXTS(canvas_private_clipRgn, reporter, ctxInfo) {
+ GrContext* context = ctxInfo.grContext();
+
+ const int w = 10;
+ const int h = 10;
+ SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
+ sk_sp<SkSurface> surf = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
+ SkCanvas* canvas = surf->getCanvas();
+ SkRegion rgn;
+
+ canvas->temporary_internal_getRgnClip(&rgn);
+ REPORTER_ASSERT(reporter, rgn.isRect());
+ REPORTER_ASSERT(reporter, rgn.getBounds() == SkIRect::MakeWH(w, h));
+
+ canvas->save();
+ canvas->clipRect(SkRect::MakeWH(5, 5), kDifference_SkClipOp);
+ canvas->temporary_internal_getRgnClip(&rgn);
+ REPORTER_ASSERT(reporter, rgn.isComplex());
+ REPORTER_ASSERT(reporter, rgn.getBounds() == SkIRect::MakeWH(w, h));
+ canvas->restore();
+
+ canvas->save();
+ canvas->clipRRect(SkRRect::MakeOval(SkRect::MakeLTRB(3, 3, 7, 7)));
+ canvas->temporary_internal_getRgnClip(&rgn);
+ REPORTER_ASSERT(reporter, rgn.isComplex());
+ REPORTER_ASSERT(reporter, rgn.getBounds() == SkIRect::MakeLTRB(3, 3, 7, 7));
+ canvas->restore();
+}
#endif