Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Unified Diff: tests/BlurTest.cpp

Issue 2222083004: Create blurred RRect mask on GPU (rather than uploading it) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkColor -> GrColor Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/SkGpuDevice_drawTexture.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BlurTest.cpp
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 6ccb0471aaefd951f080d384b5ccf1033aab0b9b..32e2930171211c97e70edc14ebbf42ac073fee0d 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -574,4 +574,66 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo) {
#endif
+
+DEF_TEST(BlurredRRectNinePatchComputation, reporter) {
+ const SkRect r = SkRect::MakeXYWH(10, 10, 100, 100);
+
+ bool ninePatchable;
+ SkRRect rrectToDraw;
+ SkISize size;
+ SkScalar xs[4], ys[4];
+ int numXs, numYs;
+
+ // not nine-patchable
+ {
+ SkVector radii[4] = { { 100, 100 }, { 0, 0 }, { 100, 100 }, { 0, 0 } };
+
+ SkRRect rr;
+ rr.setRectRadii(r, radii);
+
+ ninePatchable = SkBlurMaskFilter::ComputeBlurredRRectParams(rr, 3.0f, &rrectToDraw, &size,
+ xs, &numXs, ys, &numYs);
+ REPORTER_ASSERT(reporter, !ninePatchable);
+ }
+
+ // simple circular
+ {
+ SkRRect rr;
+ rr.setRectXY(r, 10, 10);
+
+ ninePatchable = SkBlurMaskFilter::ComputeBlurredRRectParams(rr, 3.0f, &rrectToDraw, &size,
+ xs, &numXs, ys, &numYs);
+ REPORTER_ASSERT(reporter, ninePatchable);
+ REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkIntToScalar(size.fWidth), 57.0f));
+ REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkIntToScalar(size.fHeight), 57.0));
+ REPORTER_ASSERT(reporter, 4 == numXs && 4 == numYs);
+ for (int i = 0; i < numXs; ++i) {
+ REPORTER_ASSERT(reporter, xs[i] >= 0.0f && xs[i] <= 1.0f);
+ }
+ for (int i = 0; i < numYs; ++i) {
+ REPORTER_ASSERT(reporter, ys[i] >= 0.0f && ys[i] <= 1.0f);
+ }
+ }
+
+ // simple elliptical
+ {
+ SkRRect rr;
+ rr.setRectXY(r, 2, 10);
+
+ ninePatchable = SkBlurMaskFilter::ComputeBlurredRRectParams(rr, 3.0f, &rrectToDraw, &size,
+ xs, &numXs, ys, &numYs);
+ REPORTER_ASSERT(reporter, ninePatchable);
+ REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkIntToScalar(size.fWidth), 41.0f));
+ REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkIntToScalar(size.fHeight), 57.0));
+ REPORTER_ASSERT(reporter, 4 == numXs && 4 == numYs);
+ for (int i = 0; i < numXs; ++i) {
+ REPORTER_ASSERT(reporter, xs[i] >= 0.0f && xs[i] <= 1.0f);
+ }
+ for (int i = 0; i < numYs; ++i) {
+ REPORTER_ASSERT(reporter, ys[i] >= 0.0f && ys[i] <= 1.0f);
+ }
+ }
+
+}
+
///////////////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/SkGpuDevice_drawTexture.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698