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

Unified Diff: src/pathops/SkPathOpsRect.h

Issue 1037573004: cumulative pathops patch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix pathopsinverse gm Created 5 years, 9 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/pathops/SkPathOpsQuadSect.h ('k') | src/pathops/SkPathOpsRect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsRect.h
diff --git a/src/pathops/SkPathOpsRect.h b/src/pathops/SkPathOpsRect.h
index 2c47f43b88798d995c2258774105e9cc2afad538..2b37a5f0980a4fd3c26ae8292844a720ce2cbe09 100644
--- a/src/pathops/SkPathOpsRect.h
+++ b/src/pathops/SkPathOpsRect.h
@@ -13,18 +13,10 @@ struct SkDRect {
double fLeft, fTop, fRight, fBottom;
void add(const SkDPoint& pt) {
- if (fLeft > pt.fX) {
- fLeft = pt.fX;
- }
- if (fTop > pt.fY) {
- fTop = pt.fY;
- }
- if (fRight < pt.fX) {
- fRight = pt.fX;
- }
- if (fBottom < pt.fY) {
- fBottom = pt.fY;
- }
+ fLeft = SkTMin(fLeft, pt.fX);
+ fTop = SkTMin(fTop, pt.fY);
+ fRight = SkTMax(fRight, pt.fX);
+ fBottom = SkTMax(fBottom, pt.fY);
}
bool contains(const SkDPoint& pt) const {
@@ -32,12 +24,15 @@ struct SkDRect {
&& approximately_between(fTop, pt.fY, fBottom);
}
- bool intersects(SkDRect* r) const {
+ bool intersects(const SkDRect& r) const {
+ if (fLeft > fRight) {
+ SkDebugf("!");
+ }
SkASSERT(fLeft <= fRight);
SkASSERT(fTop <= fBottom);
- SkASSERT(r->fLeft <= r->fRight);
- SkASSERT(r->fTop <= r->fBottom);
- return r->fLeft <= fRight && fLeft <= r->fRight && r->fTop <= fBottom && fTop <= r->fBottom;
+ SkASSERT(r.fLeft <= r.fRight);
+ SkASSERT(r.fTop <= r.fBottom);
+ return r.fLeft <= fRight && fLeft <= r.fRight && r.fTop <= fBottom && fTop <= r.fBottom;
}
void set(const SkDPoint& pt) {
@@ -53,11 +48,8 @@ struct SkDRect {
return fBottom - fTop;
}
- void setBounds(const SkDLine&);
void setBounds(const SkDCubic&);
void setBounds(const SkDQuad&);
- void setRawBounds(const SkDCubic&);
- void setRawBounds(const SkDQuad&);
};
#endif
« no previous file with comments | « src/pathops/SkPathOpsQuadSect.h ('k') | src/pathops/SkPathOpsRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698