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

Unified Diff: tests/PathOpsTestCommon.cpp

Issue 1107353004: align top and bounds computations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up code Created 5 years, 8 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 | « tests/PathOpsOpTest.cpp ('k') | tools/pathops_sorter.htm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsTestCommon.cpp
diff --git a/tests/PathOpsTestCommon.cpp b/tests/PathOpsTestCommon.cpp
index d93311513227ecb47277ef2a40c00e0efeb045e7..f6852254c004c83bc4c227ceb8fce162931adc0b 100644
--- a/tests/PathOpsTestCommon.cpp
+++ b/tests/PathOpsTestCommon.cpp
@@ -141,8 +141,20 @@ void CubicToQuads(const SkDCubic& cubic, double precision, SkTArray<SkDQuad, tru
double tStart = 0;
for (int i1 = 0; i1 <= ts.count(); ++i1) {
const double tEnd = i1 < ts.count() ? ts[i1] : 1;
+ SkDRect bounds;
+ bounds.setBounds(cubic);
SkDCubic part = cubic.subDivide(tStart, tEnd);
SkDQuad quad = part.toQuad();
+ if (quad[1].fX < bounds.fLeft) {
+ quad[1].fX = bounds.fLeft;
+ } else if (quad[1].fX > bounds.fRight) {
+ quad[1].fX = bounds.fRight;
+ }
+ if (quad[1].fY < bounds.fTop) {
+ quad[1].fY = bounds.fTop;
+ } else if (quad[1].fY > bounds.fBottom) {
+ quad[1].fY = bounds.fBottom;
+ }
quads.push_back(quad);
tStart = tEnd;
}
« no previous file with comments | « tests/PathOpsOpTest.cpp ('k') | tools/pathops_sorter.htm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698