| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 GrFixedClip_DEFINED | 8 #ifndef GrFixedClip_DEFINED |
| 9 #define GrFixedClip_DEFINED | 9 #define GrFixedClip_DEFINED |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 fHasStencilClip = false; | 32 fHasStencilClip = false; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void enableStencilClip() { fHasStencilClip = true; } | 35 void enableStencilClip() { fHasStencilClip = true; } |
| 36 void disableStencilClip() { fHasStencilClip = false; } | 36 void disableStencilClip() { fHasStencilClip = false; } |
| 37 | 37 |
| 38 bool quickContains(const SkRect&) const final; | 38 bool quickContains(const SkRect&) const final; |
| 39 void getConservativeBounds(int width, int height, SkIRect* devResult, | 39 void getConservativeBounds(int width, int height, SkIRect* devResult, |
| 40 bool* isIntersectionOfRects) const final; | 40 bool* isIntersectionOfRects) const final; |
| 41 | 41 |
| 42 bool isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const override { |
| 43 if (fHasStencilClip) { |
| 44 return false; |
| 45 } |
| 46 if (fScissorState.enabled()) { |
| 47 SkRect rect = SkRect::Make(fScissorState.rect()); |
| 48 if (!rect.intersects(rtBounds)) { |
| 49 return false; |
| 50 } |
| 51 rr->setRect(rect); |
| 52 *aa = false; |
| 53 return true; |
| 54 } |
| 55 return false; |
| 56 }; |
| 57 |
| 42 private: | 58 private: |
| 43 bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSett
ings, | 59 bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSett
ings, |
| 44 GrAppliedClip* out) const final; | 60 GrAppliedClip* out) const final; |
| 45 | 61 |
| 46 GrScissorState fScissorState; | 62 GrScissorState fScissorState; |
| 47 bool fHasStencilClip; | 63 bool fHasStencilClip; |
| 48 }; | 64 }; |
| 49 | 65 |
| 50 #endif | 66 #endif |
| OLD | NEW |