| 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 26 matching lines...) Expand all Loading... |
| 37 /** | 37 /** |
| 38 * The device bounds of the clip defaults to the scissor rect, but a tighter
bounds (based | 38 * The device bounds of the clip defaults to the scissor rect, but a tighter
bounds (based |
| 39 * on the known effect of the stencil values) can be provided. | 39 * on the known effect of the stencil values) can be provided. |
| 40 */ | 40 */ |
| 41 void makeScissoredStencil(const SkIRect& scissor, const SkRect* deviceBounds
= nullptr) { | 41 void makeScissoredStencil(const SkIRect& scissor, const SkRect* deviceBounds
= nullptr) { |
| 42 fClipCoverageFP = nullptr; | 42 fClipCoverageFP = nullptr; |
| 43 fScissorState.set(scissor); | 43 fScissorState.set(scissor); |
| 44 fHasStencilClip = true; | 44 fHasStencilClip = true; |
| 45 if (deviceBounds) { | 45 if (deviceBounds) { |
| 46 fDeviceBounds = *deviceBounds; | 46 fDeviceBounds = *deviceBounds; |
| 47 SkASSERT(scissor.contains(*deviceBounds)) | 47 SkASSERT(scissor.contains(*deviceBounds)); |
| 48 } else { | 48 } else { |
| 49 fDeviceBounds = SkRect::Make(scissor); | 49 fDeviceBounds = SkRect::Make(scissor); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 void makeFPBased(sk_sp<GrFragmentProcessor> fp, const SkRect& deviceBounds)
{ | 53 void makeFPBased(sk_sp<GrFragmentProcessor> fp, const SkRect& deviceBounds)
{ |
| 54 fClipCoverageFP = fp; | 54 fClipCoverageFP = fp; |
| 55 fScissorState.setDisabled(); | 55 fScissorState.setDisabled(); |
| 56 fHasStencilClip = false; | 56 fHasStencilClip = false; |
| 57 fDeviceBounds = deviceBounds; | 57 fDeviceBounds = deviceBounds; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 * The device bounds of the clip defaults to the scissor rect, but a tighter
bounds (based | 68 * The device bounds of the clip defaults to the scissor rect, but a tighter
bounds (based |
| 69 * on the known effect of the fragment processor) can be provided. | 69 * on the known effect of the fragment processor) can be provided. |
| 70 */ | 70 */ |
| 71 void makeScissoredFPBased(sk_sp<GrFragmentProcessor> fp, const SkIRect& scis
sor, | 71 void makeScissoredFPBased(sk_sp<GrFragmentProcessor> fp, const SkIRect& scis
sor, |
| 72 const SkRect* deviceBounds = nullptr) { | 72 const SkRect* deviceBounds = nullptr) { |
| 73 fClipCoverageFP = fp; | 73 fClipCoverageFP = fp; |
| 74 fScissorState.set(scissor); | 74 fScissorState.set(scissor); |
| 75 fHasStencilClip = false; | 75 fHasStencilClip = false; |
| 76 if (deviceBounds) { | 76 if (deviceBounds) { |
| 77 fDeviceBounds = *deviceBounds; | 77 fDeviceBounds = *deviceBounds; |
| 78 SkASSERT(scissor.contains(*deviceBounds)) | 78 SkASSERT(scissor.contains(*deviceBounds)); |
| 79 } else { | 79 } else { |
| 80 fDeviceBounds = SkRect::Make(scissor); | 80 fDeviceBounds = SkRect::Make(scissor); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Returns the device bounds of the applied clip. Ideally this considers the
combined effect of | 85 * Returns the device bounds of the applied clip. Ideally this considers the
combined effect of |
| 86 * all clipping techniques in play (scissor, stencil, and/or coverage fp). | 86 * all clipping techniques in play (scissor, stencil, and/or coverage fp). |
| 87 */ | 87 */ |
| 88 const SkRect& deviceBounds() const { return fDeviceBounds; } | 88 const SkRect& deviceBounds() const { return fDeviceBounds; } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 bool useHWAA, | 297 bool useHWAA, |
| 298 bool hasUserStencilSettings, | 298 bool hasUserStencilSettings, |
| 299 GrAppliedClip* out) const final; | 299 GrAppliedClip* out) const final; |
| 300 | 300 |
| 301 private: | 301 private: |
| 302 SkIPoint fOrigin; | 302 SkIPoint fOrigin; |
| 303 SkAutoTUnref<const SkClipStack> fStack; | 303 SkAutoTUnref<const SkClipStack> fStack; |
| 304 }; | 304 }; |
| 305 | 305 |
| 306 #endif | 306 #endif |
| OLD | NEW |