| OLD | NEW |
| 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" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 if (pt.fY > fBottom) fBottom = SkDoubleToScalar(pt.fY); | 40 if (pt.fY > fBottom) fBottom = SkDoubleToScalar(pt.fY); |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool almostContains(const SkPoint& pt) { | 43 bool almostContains(const SkPoint& pt) { |
| 44 return AlmostLessOrEqualUlps(fLeft, pt.fX) | 44 return AlmostLessOrEqualUlps(fLeft, pt.fX) |
| 45 && AlmostLessOrEqualUlps(pt.fX, fRight) | 45 && AlmostLessOrEqualUlps(pt.fX, fRight) |
| 46 && AlmostLessOrEqualUlps(fTop, pt.fY) | 46 && AlmostLessOrEqualUlps(fTop, pt.fY) |
| 47 && AlmostLessOrEqualUlps(pt.fY, fBottom); | 47 && AlmostLessOrEqualUlps(pt.fY, fBottom); |
| 48 } | 48 } |
| 49 | 49 |
| 50 // unlike isEmpty(), this permits lines, but not points | |
| 51 // FIXME: unused for now | |
| 52 bool isReallyEmpty() const { | |
| 53 // use !<= instead of > to detect NaN values | |
| 54 return !(fLeft <= fRight) || !(fTop <= fBottom) | |
| 55 || (fLeft == fRight && fTop == fBottom); | |
| 56 } | |
| 57 | |
| 58 void setPointBounds(const SkDPoint& pt) { | |
| 59 fLeft = fRight = SkDoubleToScalar(pt.fX); | |
| 60 fTop = fBottom = SkDoubleToScalar(pt.fY); | |
| 61 } | |
| 62 | |
| 63 typedef SkRect INHERITED; | 50 typedef SkRect INHERITED; |
| 64 }; | 51 }; |
| 65 | 52 |
| 66 #endif | 53 #endif |
| OLD | NEW |