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 | |
10 #include "GrClipMaskManager.h" | |
11 #include "GrDrawContext.h" | 9 #include "GrDrawContext.h" |
12 | 10 |
13 void GrNoClip::getConservativeBounds(int width, int height, SkIRect* devResult, | 11 void GrNoClip::getConservativeBounds(int width, int height, SkIRect* devResult, |
14 bool* isIntersectionOfRects) const { | 12 bool* isIntersectionOfRects) const { |
15 devResult->setXYWH(0, 0, width, height); | 13 devResult->setXYWH(0, 0, width, height); |
16 if (isIntersectionOfRects) { | 14 if (isIntersectionOfRects) { |
17 *isIntersectionOfRects = true; | 15 *isIntersectionOfRects = true; |
18 } | 16 } |
19 } | 17 } |
20 | 18 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 out->makeScissoredStencil(tightScissor, &fDeviceBounds); | 56 out->makeScissoredStencil(tightScissor, &fDeviceBounds); |
59 } else { | 57 } else { |
60 out->makeScissored(tightScissor); | 58 out->makeScissored(tightScissor); |
61 } | 59 } |
62 return true; | 60 return true; |
63 } | 61 } |
64 | 62 |
65 out->makeStencil(fHasStencilClip, fDeviceBounds); | 63 out->makeStencil(fHasStencilClip, fDeviceBounds); |
66 return true; | 64 return true; |
67 } | 65 } |
68 | |
69 bool GrClipStackClip::quickContains(const SkRect& rect) const { | |
70 if (!fStack) { | |
71 return true; | |
72 } | |
73 return fStack->quickContains(rect.makeOffset(SkIntToScalar(fOrigin.x()), | |
74 SkIntToScalar(fOrigin.y()))); | |
75 } | |
76 | |
77 void GrClipStackClip::getConservativeBounds(int width, int height, SkIRect* devR
esult, | |
78 bool* isIntersectionOfRects) const { | |
79 if (!fStack) { | |
80 devResult->setXYWH(0, 0, width, height); | |
81 if (isIntersectionOfRects) { | |
82 *isIntersectionOfRects = true; | |
83 } | |
84 return; | |
85 } | |
86 SkRect devBounds; | |
87 fStack->getConservativeBounds(-fOrigin.x(), -fOrigin.y(), width, height, &de
vBounds, | |
88 isIntersectionOfRects); | |
89 devBounds.roundOut(devResult); | |
90 } | |
91 | |
92 bool GrClipStackClip::apply(GrContext* context, | |
93 const GrPipelineBuilder& pipelineBuilder, GrDrawCont
ext* drawContext, | |
94 const SkRect* devBounds, GrAppliedClip* out) const { | |
95 return GrClipMaskManager::SetupClipping(context, pipelineBuilder, drawContex
t, | |
96 *this, devBounds, out); | |
97 } | |
OLD | NEW |