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

Side by Side Diff: src/pathops/SkPathOpsBounds.h

Issue 13934009: path ops -- use standard max, min, double-is-nan (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/pathops/SkDQuadIntersection.cpp ('k') | src/pathops/SkPathOpsPoint.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #ifndef SkPathOpBounds_DEFINED 7 #ifndef SkPathOpBounds_DEFINED
8 #define SkPathOpBounds_DEFINED 8 #define SkPathOpBounds_DEFINED
9 9
10 #include "SkPathOpsRect.h" 10 #include "SkPathOpsRect.h"
11 #include "SkRect.h" 11 #include "SkRect.h"
12 12
13 // SkPathOpsBounds, unlike SkRect, does not consider a line to be empty. 13 // SkPathOpsBounds, unlike SkRect, does not consider a line to be empty.
14 struct SkPathOpsBounds : public SkRect { 14 struct SkPathOpsBounds : public SkRect {
15 static bool Intersects(const SkPathOpsBounds& a, const SkPathOpsBounds& b) { 15 static bool Intersects(const SkPathOpsBounds& a, const SkPathOpsBounds& b) {
16 return a.fLeft <= b.fRight && b.fLeft <= a.fRight && 16 return a.fLeft <= b.fRight && b.fLeft <= a.fRight &&
17 a.fTop <= b.fBottom && b.fTop <= a.fBottom; 17 a.fTop <= b.fBottom && b.fTop <= a.fBottom;
18 } 18 }
19 19
20 // FIXME: add() is generically useful and could be added directly to SkRect 20 // Note that add(), unlike SkRect::join() or SkRect::growToInclude()
21 // does not treat the bounds of horizontal and vertical lines as
22 // empty rectangles.
21 void add(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) { 23 void add(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
22 if (left < fLeft) fLeft = left; 24 if (left < fLeft) fLeft = left;
23 if (top < fTop) fTop = top; 25 if (top < fTop) fTop = top;
24 if (right > fRight) fRight = right; 26 if (right > fRight) fRight = right;
25 if (bottom > fBottom) fBottom = bottom; 27 if (bottom > fBottom) fBottom = bottom;
26 } 28 }
27 29
28 void add(const SkPathOpsBounds& toAdd) { 30 void add(const SkPathOpsBounds& toAdd) {
29 add(toAdd.fLeft, toAdd.fTop, toAdd.fRight, toAdd.fBottom); 31 add(toAdd.fLeft, toAdd.fTop, toAdd.fRight, toAdd.fBottom);
30 } 32 }
(...skipping 21 matching lines...) Expand all
52 fLeft = fRight = pt.fX; 54 fLeft = fRight = pt.fX;
53 fTop = fBottom = pt.fY; 55 fTop = fBottom = pt.fY;
54 } 56 }
55 57
56 typedef SkRect INHERITED; 58 typedef SkRect INHERITED;
57 }; 59 };
58 60
59 extern void (SkPathOpsBounds::*SetCurveBounds[])(const SkPoint[]); 61 extern void (SkPathOpsBounds::*SetCurveBounds[])(const SkPoint[]);
60 62
61 #endif 63 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkDQuadIntersection.cpp ('k') | src/pathops/SkPathOpsPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698