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

Unified Diff: include/core/SkRect.h

Issue 1893433002: In SkDraw::drawRect, use SkPath for huge rects. Base URL: https://skia.googlesource.com/skia@fixed-assert
Patch Set: Created 4 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 | « gm/bigrect.cpp ('k') | include/core/SkRegion.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkRect.h
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 3ebe099ae6385a2aa7a0fd124f1ccb87cd6ded5c..2466e3b936c1c466fca77e881ca33af79a4abacb 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -402,6 +402,16 @@ struct SK_API SkRect {
return r;
}
+ /**
+ * Make the largest SkRect for which canRound() returns true.
+ */
+ static SkRect SK_WARN_UNUSED_RESULT MakeLargestS32() {
+ const SkRect r = MakeLTRB(-SK_MaxS32Scalar, -SK_MaxS32Scalar,
+ SK_MaxS32Scalar, SK_MaxS32Scalar);
+ SkASSERT(r == Make(r.round()));
+ return r;
+ }
+
static SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h) {
SkRect r;
r.set(0, 0, w, h);
@@ -814,6 +824,11 @@ public:
}
/**
+ * Return true if round(SkIRect) and roundOut(SkIRect) will not overflow SkIRect.
+ */
+ bool canRound() const;
+
+ /**
* Set the dst rectangle by rounding this rectangle's coordinates to their
* nearest integer values using SkScalarRoundToInt.
*/
@@ -898,10 +913,4 @@ public:
void dumpHex() const { this->dump(true); }
};
-inline bool SkIRect::contains(const SkRect& r) const {
- return !r.isEmpty() && !this->isEmpty() && // check for empties
- (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop &&
- (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom;
-}
-
#endif
« no previous file with comments | « gm/bigrect.cpp ('k') | include/core/SkRegion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698