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

Unified Diff: tests/GrShapeTest.cpp

Issue 2274113004: Fix bounds check in grshape test (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: update comment 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: tests/GrShapeTest.cpp
diff --git a/tests/GrShapeTest.cpp b/tests/GrShapeTest.cpp
index 8ac27b4f98a5dbb32679d3afa1fc189c0ed47406..6e1901ff0229cd1f9b7bf22e9a233fafa2431451 100644
--- a/tests/GrShapeTest.cpp
+++ b/tests/GrShapeTest.cpp
@@ -37,6 +37,10 @@ static bool paths_fill_same(const SkPath& a, const SkPath& b) {
}
static bool test_bounds_by_rasterizing(const SkPath& path, const SkRect& bounds) {
+ // We test the bounds by rasterizing the path into a kRes by kRes grid. The bounds is
+ // mapped to the range kRes/4 to 3*kRes/4 in x and y. A difference clip is used to avoid
+ // rendering within the bounds (with a tolerance). Then we render the path and check that
+ // everything got clipped out.
static constexpr int kRes = 2000;
// This tolerance is in units of 1/kRes fractions of the bounds width/height.
static constexpr int kTol = 0;
@@ -61,7 +65,7 @@ static bool test_bounds_by_rasterizing(const SkPath& path, const SkRect& bounds)
#else
static constexpr uint8_t kZeros[kRes] = {0};
#endif
- for (int y = 0; y < kRes/4; ++y) {
+ for (int y = 0; y < kRes; ++y) {
const uint8_t* row = pixmap.addr8(0, y);
if (0 != memcmp(kZeros, row, kRes)) {
return false;
« 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