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

Unified Diff: src/core/SkLineClipper.cpp

Issue 2250353004: move private test for sect_with_horizontal into unittests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLineClipper.cpp
diff --git a/src/core/SkLineClipper.cpp b/src/core/SkLineClipper.cpp
index 189f03ac735123f7bfa1f3ae7e3d9d03bdde562c..9acb657679b30ccf808cc40c79c986aac968cd66 100644
--- a/src/core/SkLineClipper.cpp
+++ b/src/core/SkLineClipper.cpp
@@ -22,6 +22,21 @@ template <typename T> T pin_unsorted(T value, T limit0, T limit1) {
return value;
}
+// This is an example of why we need to pin the result computed in
+// sect_with_horizontal. If we didn't explicitly pin, is_between_unsorted would
+// fail.
+//
+#if 0
+static void sect_with_horizontal_test_for_pin_results() {
+ const SkPoint pts[] = {
+ { -540000, -720000 },
+ { -9.10000017e-05f, 9.99999996e-13f }
+ };
+ float x = sect_with_horizontal(pts, 0);
+ SkASSERT(is_between_unsorted(x, pts[0].fX, pts[1].fX));
+}
+#endif
+
// return X coordinate of intersection with horizontal line at Y
static SkScalar sect_with_horizontal(const SkPoint src[2], SkScalar Y) {
SkScalar dy = src[1].fY - src[0].fY;
@@ -157,34 +172,8 @@ static bool is_between_unsorted(SkScalar value,
}
#endif
-#ifdef SK_DEBUG
-// This is an example of why we need to pin the result computed in
-// sect_with_horizontal. If we didn't explicitly pin, is_between_unsorted would
-// fail.
-//
-static void sect_with_horizontal_test_for_pin_results() {
- const SkPoint pts[] = {
- { -540000, -720000 },
- { -9.10000017e-05f, 9.99999996e-13f }
- };
- float x = sect_with_horizontal(pts, 0);
- SkASSERT(is_between_unsorted(x, pts[0].fX, pts[1].fX));
-}
-#endif
-
int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip, SkPoint lines[],
bool canCullToTheRight) {
-
-#ifdef SK_DEBUG
- {
- static bool gOnce;
mtklein 2016/08/17 13:12:53 If you want to keep this and make it thread safe,
- if (!gOnce) {
- sect_with_horizontal_test_for_pin_results();
- gOnce = true;
- }
- }
-#endif
-
int index0, index1;
if (pts[0].fY < pts[1].fY) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698