OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 7 |
8 #ifndef GrClip_DEFINED | 8 #ifndef GrClip_DEFINED |
9 #define GrClip_DEFINED | 9 #define GrClip_DEFINED |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 return this->quickContains(rrect.getBounds()); | 26 return this->quickContains(rrect.getBounds()); |
27 } | 27 } |
28 virtual void getConservativeBounds(int width, int height, SkIRect* devResult
, | 28 virtual void getConservativeBounds(int width, int height, SkIRect* devResult
, |
29 bool* isIntersectionOfRects = nullptr) co
nst = 0; | 29 bool* isIntersectionOfRects = nullptr) co
nst = 0; |
30 virtual bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserSte
ncilSettings, | 30 virtual bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserSte
ncilSettings, |
31 GrAppliedClip* out) const = 0; | 31 GrAppliedClip* out) const = 0; |
32 | 32 |
33 virtual ~GrClip() {} | 33 virtual ~GrClip() {} |
34 | 34 |
35 /** | 35 /** |
| 36 * This method quickly and conservatively determines whether the entire clip
is equivalent to |
| 37 * intersection with a rrect. This will only return true if the rrect does n
ot fully contain |
| 38 * the render target bounds. Moreover, the returned rrect need not be contai
ned by the render |
| 39 * target bounds. We assume all draws will be implicitly clipped by the rend
er target bounds. |
| 40 * |
| 41 * @param rtBounds The bounds of the render target that the clip will be app
lied to. |
| 42 * @param rrect If return is true rrect will contain the rrect equivalent
to the clip within |
| 43 * rtBounds. |
| 44 * @param aa If return is true aa will indicate whether the rrect clip
is antialiased. |
| 45 * @return true if the clip is equivalent to a single rrect, false otherwise
. |
| 46 * |
| 47 */ |
| 48 virtual bool isRRect(const SkRect& rtBounds, SkRRect* rrect, bool* aa) const
= 0; |
| 49 |
| 50 /** |
36 * This is the maximum distance that a draw may extend beyond a clip's bound
ary and still count | 51 * This is the maximum distance that a draw may extend beyond a clip's bound
ary and still count |
37 * count as "on the other side". We leave some slack because floating point
rounding error is | 52 * count as "on the other side". We leave some slack because floating point
rounding error is |
38 * likely to blame. The rationale for 1e-3 is that in the coverage case (and
barring unexpected | 53 * likely to blame. The rationale for 1e-3 is that in the coverage case (and
barring unexpected |
39 * rounding), as long as coverage stays within 0.5 * 1/256 of its intended v
alue it shouldn't | 54 * rounding), as long as coverage stays within 0.5 * 1/256 of its intended v
alue it shouldn't |
40 * have any effect on the final pixel values. | 55 * have any effect on the final pixel values. |
41 */ | 56 */ |
42 constexpr static SkScalar kBoundsTolerance = 1e-3f; | 57 constexpr static SkScalar kBoundsTolerance = 1e-3f; |
43 | 58 |
44 /** | 59 /** |
45 * Returns true if the given query bounds count as entirely inside the clip. | 60 * Returns true if the given query bounds count as entirely inside the clip. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 void getConservativeBounds(int width, int height, SkIRect* devResult, | 130 void getConservativeBounds(int width, int height, SkIRect* devResult, |
116 bool* isIntersectionOfRects) const final { | 131 bool* isIntersectionOfRects) const final { |
117 devResult->setXYWH(0, 0, width, height); | 132 devResult->setXYWH(0, 0, width, height); |
118 if (isIntersectionOfRects) { | 133 if (isIntersectionOfRects) { |
119 *isIntersectionOfRects = true; | 134 *isIntersectionOfRects = true; |
120 } | 135 } |
121 } | 136 } |
122 bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip*) const fin
al { | 137 bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip*) const fin
al { |
123 return true; | 138 return true; |
124 } | 139 } |
| 140 bool isRRect(const SkRect&, SkRRect*, bool*) const override { return false;
}; |
125 }; | 141 }; |
126 | 142 |
127 #endif | 143 #endif |
OLD | NEW |