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/SkPathOpsRect.h

Issue 1002693002: pathops version two (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix arm 64 inspired coincident handling 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 unified diff | Download patch
« no previous file with comments | « src/pathops/SkPathOpsQuadSect.h ('k') | src/pathops/SkPathOpsRect.cpp » ('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 SkPathOpsRect_DEFINED 7 #ifndef SkPathOpsRect_DEFINED
8 #define SkPathOpsRect_DEFINED 8 #define SkPathOpsRect_DEFINED
9 9
10 #include "SkPathOpsPoint.h" 10 #include "SkPathOpsPoint.h"
11 11
12 struct SkDRect { 12 struct SkDRect {
13 double fLeft, fTop, fRight, fBottom; 13 double fLeft, fTop, fRight, fBottom;
14 14
15 void add(const SkDPoint& pt) { 15 void add(const SkDPoint& pt) {
16 if (fLeft > pt.fX) { 16 fLeft = SkTMin(fLeft, pt.fX);
17 fLeft = pt.fX; 17 fTop = SkTMin(fTop, pt.fY);
18 } 18 fRight = SkTMax(fRight, pt.fX);
19 if (fTop > pt.fY) { 19 fBottom = SkTMax(fBottom, pt.fY);
20 fTop = pt.fY;
21 }
22 if (fRight < pt.fX) {
23 fRight = pt.fX;
24 }
25 if (fBottom < pt.fY) {
26 fBottom = pt.fY;
27 }
28 } 20 }
29 21
30 bool contains(const SkDPoint& pt) const { 22 bool contains(const SkDPoint& pt) const {
31 return approximately_between(fLeft, pt.fX, fRight) 23 return approximately_between(fLeft, pt.fX, fRight)
32 && approximately_between(fTop, pt.fY, fBottom); 24 && approximately_between(fTop, pt.fY, fBottom);
33 } 25 }
34 26
35 bool intersects(SkDRect* r) const { 27 bool intersects(const SkDRect& r) const {
28 if (fLeft > fRight) {
29 SkDebugf("!");
30 }
36 SkASSERT(fLeft <= fRight); 31 SkASSERT(fLeft <= fRight);
37 SkASSERT(fTop <= fBottom); 32 SkASSERT(fTop <= fBottom);
38 SkASSERT(r->fLeft <= r->fRight); 33 SkASSERT(r.fLeft <= r.fRight);
39 SkASSERT(r->fTop <= r->fBottom); 34 SkASSERT(r.fTop <= r.fBottom);
40 return r->fLeft <= fRight && fLeft <= r->fRight && r->fTop <= fBottom && fTop <= r->fBottom; 35 return r.fLeft <= fRight && fLeft <= r.fRight && r.fTop <= fBottom && fT op <= r.fBottom;
41 } 36 }
42 37
43 void set(const SkDPoint& pt) { 38 void set(const SkDPoint& pt) {
44 fLeft = fRight = pt.fX; 39 fLeft = fRight = pt.fX;
45 fTop = fBottom = pt.fY; 40 fTop = fBottom = pt.fY;
46 } 41 }
47 42
48 double width() const { 43 double width() const {
49 return fRight - fLeft; 44 return fRight - fLeft;
50 } 45 }
51 46
52 double height() const { 47 double height() const {
53 return fBottom - fTop; 48 return fBottom - fTop;
54 } 49 }
55 50
56 void setBounds(const SkDLine&);
57 void setBounds(const SkDCubic&); 51 void setBounds(const SkDCubic&);
58 void setBounds(const SkDQuad&); 52 void setBounds(const SkDQuad&);
59 void setRawBounds(const SkDCubic&);
60 void setRawBounds(const SkDQuad&);
61 }; 53 };
62 54
63 #endif 55 #endif
OLDNEW
« 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