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

Unified Diff: tests/RectTest.cpp

Issue 2133413002: try to speed-up maprect + round2i + contains (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add dox Created 4 years, 5 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
« include/private/SkNx_sse.h ('K') | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RectTest.cpp
diff --git a/tests/RectTest.cpp b/tests/RectTest.cpp
index 820586c3c67755f7402cf59079911ec6543feacf..719b5b9ae70888d03040e2a4f57203914d193e30 100644
--- a/tests/RectTest.cpp
+++ b/tests/RectTest.cpp
@@ -88,3 +88,35 @@ DEF_TEST(Rect, reporter) {
test_stroke_width_clipping(reporter);
test_skbug4406(reporter);
}
+
+DEF_TEST(Rect_round, reporter) {
+ SkRandom rand;
+
+ for (int i = 0; i < 100000; ++i) {
+ SkRect src = SkRect::MakeXYWH(rand.nextSScalar1() * 1000,
+ rand.nextSScalar1() * 1000,
+ rand.nextUScalar1() * 1000,
+ rand.nextUScalar1() * 1000);
+ SkRect rd0 = {
+ SkScalarRoundToScalar(src.fLeft),
+ SkScalarRoundToScalar(src.fTop),
+ SkScalarRoundToScalar(src.fRight),
+ SkScalarRoundToScalar(src.fBottom)
+ };
+ SkRect rd1 = src.round2s();
+
+ REPORTER_ASSERT(reporter, rd0 == rd1);
+
+ SkIRect ir0 = {
+ SkScalarRoundToInt(src.fLeft),
+ SkScalarRoundToInt(src.fTop),
+ SkScalarRoundToInt(src.fRight),
+ SkScalarRoundToInt(src.fBottom)
+ };
+ SkIRect ir1 = src.round();
+ SkIRect ir2 = src.round2i();
+
+ REPORTER_ASSERT(reporter, ir0 == ir1);
+ REPORTER_ASSERT(reporter, ir0 == ir2);
+ }
+}
« include/private/SkNx_sse.h ('K') | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698