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

Unified Diff: tests/QuickRejectTest.cpp

Issue 2225393002: Optimized implementation of quickReject() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix NX_NOSIMD and Chrome assert 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/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/QuickRejectTest.cpp
diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp
index 6a978743f604bde2902dd6a30006830bed711c59..b39484bd89c488578fa24b6a1db1d370a4bbfad8 100644
--- a/tests/QuickRejectTest.cpp
+++ b/tests/QuickRejectTest.cpp
@@ -103,7 +103,45 @@ static void test_layers(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, false == canvas.quickReject(SkRect::MakeWH(60, 60)));
}
+static void test_quick_reject(skiatest::Reporter* reporter) {
+ SkCanvas canvas(100, 100);
+ SkRect r0 = SkRect::MakeLTRB(-50.0f, -50.0f, 50.0f, 50.0f);
+ SkRect r1 = SkRect::MakeLTRB(-50.0f, 110.0f, 50.0f, 120.0f);
+ SkRect r2 = SkRect::MakeLTRB(110.0f, -50.0f, 120.0f, 50.0f);
+ SkRect r3 = SkRect::MakeLTRB(-120.0f, -50.0f, 120.0f, 50.0f);
+ SkRect r4 = SkRect::MakeLTRB(-50.0f, -120.0f, 50.0f, 120.0f);
+ SkRect r5 = SkRect::MakeLTRB(-120.0f, -120.0f, 120.0f, 120.0f);
+ SkRect r6 = SkRect::MakeLTRB(-120.0f, -120.0f, -110.0f, -110.0f);
+ SkRect r7 = SkRect::MakeLTRB(SK_ScalarNaN, -50.0f, 50.0f, 50.0f);
+ SkRect r8 = SkRect::MakeLTRB(-50.0f, SK_ScalarNaN, 50.0f, 50.0f);
+ SkRect r9 = SkRect::MakeLTRB(-50.0f, -50.0f, SK_ScalarNaN, 50.0f);
+ SkRect r10 = SkRect::MakeLTRB(-50.0f, -50.0f, 50.0f, SK_ScalarNaN);
+ REPORTER_ASSERT(reporter, false == canvas.quickReject(r0));
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(r1));
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(r2));
+ REPORTER_ASSERT(reporter, false == canvas.quickReject(r3));
+ REPORTER_ASSERT(reporter, false == canvas.quickReject(r4));
+ REPORTER_ASSERT(reporter, false == canvas.quickReject(r5));
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(r6));
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(r7));
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(r8));
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(r9));
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(r10));
+
+ SkMatrix m = SkMatrix::MakeScale(2.0f);
+ m.setTranslateX(10.0f);
+ m.setTranslateY(10.0f);
+ canvas.setMatrix(m);
+ SkRect r11 = SkRect::MakeLTRB(5.0f, 5.0f, 100.0f, 100.0f);
+ SkRect r12 = SkRect::MakeLTRB(5.0f, 50.0f, 100.0f, 100.0f);
+ SkRect r13 = SkRect::MakeLTRB(50.0f, 5.0f, 100.0f, 100.0f);
+ REPORTER_ASSERT(reporter, false == canvas.quickReject(r11));
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(r12));
+ REPORTER_ASSERT(reporter, true == canvas.quickReject(r13));
+}
+
DEF_TEST(QuickReject, reporter) {
test_drawBitmap(reporter);
test_layers(reporter);
+ test_quick_reject(reporter);
}
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698