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

Unified Diff: include/core/SkRect.h

Issue 23684008: Fix bounds computation in GrAAHairlineRenderer (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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
Index: include/core/SkRect.h
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index d0eaac40e4940c6095c015540b08553452493d82..d43ffce204e2b2326fc6ec70f99279ecffe4f807 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -691,6 +691,21 @@ struct SK_API SkRect {
fBottom = SkMaxScalar(y, fBottom);
}
+ /** Bulk version of growToInclude */
+ void growToInclude(const SkPoint pts[], int count) {
robertphillips 2013/09/01 11:15:37 Shouldn't this be (pts, sizeof(SkPoint), count)?
bsalomon 2013/09/03 14:47:35 Yes nice catch. I originally had it as ptr, stride
+ this->growToInclude(pts, count, sizeof(SkPoint));
+ }
+
+ /** Bulk version of growToInclude with stride. */
+ void growToInclude(const SkPoint pts[], size_t stride, int count) {
+ SkASSERT(count >= 0);
+ SkASSERT(stride >= sizeof(SkPoint));
+ const SkPoint* end = (const SkPoint*)((intptr_t)pts + count * stride);
+ for (; pts < end; pts = (const SkPoint*)((intptr_t)pts + stride)) {
+ this->growToInclude(pts->fX, pts->fY);
+ }
+ }
+
/**
* Returns true if (p.fX,p.fY) is inside the rectangle, and the rectangle
* is not empty.

Powered by Google App Engine
This is Rietveld 408576698