| 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 #include "GrClip.h" | 8 #include "GrClip.h" |
| 9 | 9 |
| 10 #include "GrClipMaskManager.h" | 10 #include "GrClipMaskManager.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 SkASSERT(!fDeviceBounds.isLargest()); | 47 SkASSERT(!fDeviceBounds.isLargest()); |
| 48 if (fScissorState.enabled()) { | 48 if (fScissorState.enabled()) { |
| 49 SkIRect tightScissor; | 49 SkIRect tightScissor; |
| 50 if (!tightScissor.intersect(fScissorState.rect(), | 50 if (!tightScissor.intersect(fScissorState.rect(), |
| 51 SkIRect::MakeWH(drawContext->width(), drawCo
ntext->height()))) { | 51 SkIRect::MakeWH(drawContext->width(), drawCo
ntext->height()))) { |
| 52 return false; | 52 return false; |
| 53 } | 53 } |
| 54 if (devBounds && !devBounds->intersects(SkRect::Make(tightScissor))) { | 54 if (devBounds && !devBounds->intersects(SkRect::Make(tightScissor))) { |
| 55 return false; | 55 return false; |
| 56 } | 56 } |
| 57 if (fHasStencilClip) { | 57 if (!devBounds || !CanIgnoreScissor(fScissorState.rect(), *devBounds)) { |
| 58 out->makeScissoredStencil(tightScissor, &fDeviceBounds); | 58 if (fHasStencilClip) { |
| 59 } else { | 59 out->makeScissoredStencil(tightScissor, &fDeviceBounds); |
| 60 out->makeScissored(tightScissor); | 60 } else { |
| 61 out->makeScissored(tightScissor); |
| 62 } |
| 63 return true; |
| 61 } | 64 } |
| 62 return true; | |
| 63 } | 65 } |
| 64 | 66 |
| 65 out->makeStencil(fHasStencilClip, fDeviceBounds); | 67 out->makeStencil(fHasStencilClip, fDeviceBounds); |
| 66 return true; | 68 return true; |
| 67 } | 69 } |
| 68 | 70 |
| 69 bool GrClipStackClip::quickContains(const SkRect& rect) const { | 71 bool GrClipStackClip::quickContains(const SkRect& rect) const { |
| 70 if (!fStack) { | 72 if (!fStack) { |
| 71 return true; | 73 return true; |
| 72 } | 74 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 88 isIntersectionOfRects); | 90 isIntersectionOfRects); |
| 89 devBounds.roundOut(devResult); | 91 devBounds.roundOut(devResult); |
| 90 } | 92 } |
| 91 | 93 |
| 92 bool GrClipStackClip::apply(GrContext* context, | 94 bool GrClipStackClip::apply(GrContext* context, |
| 93 const GrPipelineBuilder& pipelineBuilder, GrDrawCont
ext* drawContext, | 95 const GrPipelineBuilder& pipelineBuilder, GrDrawCont
ext* drawContext, |
| 94 const SkRect* devBounds, GrAppliedClip* out) const { | 96 const SkRect* devBounds, GrAppliedClip* out) const { |
| 95 return GrClipMaskManager::SetupClipping(context, pipelineBuilder, drawContex
t, | 97 return GrClipMaskManager::SetupClipping(context, pipelineBuilder, drawContex
t, |
| 96 *this, devBounds, out); | 98 *this, devBounds, out); |
| 97 } | 99 } |
| OLD | NEW |