| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 SkRect fDeviceBounds; | 95 SkRect fDeviceBounds; |
| 96 typedef SkNoncopyable INHERITED; | 96 typedef SkNoncopyable INHERITED; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * GrClip is an abstract base class for applying a clip. It constructs a clip ma
sk if necessary, and | 100 * GrClip is an abstract base class for applying a clip. It constructs a clip ma
sk if necessary, and |
| 101 * fills out a GrAppliedClip instructing the caller on how to set up the draw st
ate. | 101 * fills out a GrAppliedClip instructing the caller on how to set up the draw st
ate. |
| 102 */ | 102 */ |
| 103 class GrClip { | 103 class GrClip { |
| 104 public: | 104 public: |
| 105 // This is the maximum distance that a draw may extend beyond a clip's sciss
or and still count |
| 106 // as inside. We use a sloppy compare because the draw may have chosen its b
ounds in a different |
| 107 // coord system. The rationale for 1e-3 is that in the coverage case (and ba
rring unexpected |
| 108 // rounding), as long as coverage stays below 0.5 * 1/256 we ought to be OK. |
| 109 constexpr static SkScalar kScissorIgnoreFuzz = 1e-3f; |
| 110 |
| 105 virtual bool quickContains(const SkRect&) const = 0; | 111 virtual bool quickContains(const SkRect&) const = 0; |
| 106 virtual void getConservativeBounds(int width, int height, SkIRect* devResult
, | 112 virtual void getConservativeBounds(int width, int height, SkIRect* devResult
, |
| 107 bool* isIntersectionOfRects = nullptr) co
nst = 0; | 113 bool* isIntersectionOfRects = nullptr) co
nst = 0; |
| 108 virtual bool apply(GrContext*, const GrPipelineBuilder&, GrDrawContext*, | 114 virtual bool apply(GrContext*, const GrPipelineBuilder&, GrDrawContext*, |
| 109 const SkRect* devBounds, GrAppliedClip*) const = 0; | 115 const SkRect* devBounds, GrAppliedClip*) const = 0; |
| 110 | 116 |
| 111 virtual ~GrClip() {} | 117 virtual ~GrClip() {} |
| 112 }; | 118 }; |
| 113 | 119 |
| 114 /** | 120 /** |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 bool* isIntersectionOfRects) const final; | 217 bool* isIntersectionOfRects) const final; |
| 212 bool apply(GrContext*, const GrPipelineBuilder&, GrDrawContext*, | 218 bool apply(GrContext*, const GrPipelineBuilder&, GrDrawContext*, |
| 213 const SkRect* devBounds, GrAppliedClip*) const final; | 219 const SkRect* devBounds, GrAppliedClip*) const final; |
| 214 | 220 |
| 215 private: | 221 private: |
| 216 SkIPoint fOrigin; | 222 SkIPoint fOrigin; |
| 217 SkAutoTUnref<const SkClipStack> fStack; | 223 SkAutoTUnref<const SkClipStack> fStack; |
| 218 }; | 224 }; |
| 219 | 225 |
| 220 #endif | 226 #endif |
| OLD | NEW |