Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 devResult->setEmpty(); | 36 devResult->setEmpty(); |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 if (isIntersectionOfRects) { | 39 if (isIntersectionOfRects) { |
| 40 *isIntersectionOfRects = true; | 40 *isIntersectionOfRects = true; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool GrFixedClip::apply(GrContext*, const GrPipelineBuilder& pipelineBuilder, | 44 bool GrFixedClip::apply(GrContext*, const GrPipelineBuilder& pipelineBuilder, |
| 45 GrDrawContext* drawContext, | 45 GrDrawContext* drawContext, |
| 46 const SkRect* devBounds, GrAppliedClip* out) const { | 46 const SkRect* devBounds, GrAppliedClip* out) const { |
|
robertphillips
2016/07/08 15:46:14
SkASSERT(!fDeviceBounds.isLargest());
?
bsalomon
2016/07/08 17:06:44
Done.
| |
| 47 if (fScissorState.enabled()) { | 47 if (fScissorState.enabled()) { |
| 48 SkIRect tightScissor; | 48 SkIRect tightScissor; |
| 49 if (!tightScissor.intersect(fScissorState.rect(), | 49 if (!tightScissor.intersect(fScissorState.rect(), |
| 50 SkIRect::MakeWH(drawContext->width(), drawCo ntext->height()))) { | 50 SkIRect::MakeWH(drawContext->width(), drawCo ntext->height()))) { |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 if (devBounds && !devBounds->intersects(SkRect::Make(tightScissor))) { | 53 if (devBounds && !devBounds->intersects(SkRect::Make(tightScissor))) { |
| 54 return false; | 54 return false; |
| 55 } | 55 } |
| 56 out->makeScissoredStencil(fHasStencilClip, tightScissor); | 56 if (fHasStencilClip) { |
| 57 out->makeScissoredStencil(tightScissor, &fDeviceBounds); | |
| 58 } else { | |
| 59 out->makeScissored(tightScissor); | |
| 60 } | |
| 57 return true; | 61 return true; |
| 58 } | 62 } |
| 59 | 63 |
| 60 out->makeStencil(fHasStencilClip); | 64 out->makeStencil(fHasStencilClip, fDeviceBounds); |
| 61 return true; | 65 return true; |
| 62 } | 66 } |
| 63 | 67 |
| 64 bool GrClipStackClip::quickContains(const SkRect& rect) const { | 68 bool GrClipStackClip::quickContains(const SkRect& rect) const { |
| 65 if (!fStack) { | 69 if (!fStack) { |
| 66 return true; | 70 return true; |
| 67 } | 71 } |
| 68 return fStack->quickContains(rect.makeOffset(SkIntToScalar(fOrigin.x()), | 72 return fStack->quickContains(rect.makeOffset(SkIntToScalar(fOrigin.x()), |
| 69 SkIntToScalar(fOrigin.y()))); | 73 SkIntToScalar(fOrigin.y()))); |
| 70 } | 74 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 83 isIntersectionOfRects); | 87 isIntersectionOfRects); |
| 84 devBounds.roundOut(devResult); | 88 devBounds.roundOut(devResult); |
| 85 } | 89 } |
| 86 | 90 |
| 87 bool GrClipStackClip::apply(GrContext* context, | 91 bool GrClipStackClip::apply(GrContext* context, |
| 88 const GrPipelineBuilder& pipelineBuilder, GrDrawCont ext* drawContext, | 92 const GrPipelineBuilder& pipelineBuilder, GrDrawCont ext* drawContext, |
| 89 const SkRect* devBounds, GrAppliedClip* out) const { | 93 const SkRect* devBounds, GrAppliedClip* out) const { |
| 90 return GrClipMaskManager::SetupClipping(context, pipelineBuilder, drawContex t, | 94 return GrClipMaskManager::SetupClipping(context, pipelineBuilder, drawContex t, |
| 91 *this, devBounds, out); | 95 *this, devBounds, out); |
| 92 } | 96 } |
| OLD | NEW |