OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2010 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #include "GrClip.h" | |
9 | |
10 #include "GrAppliedClip.h" | |
11 #include "GrDrawContext.h" | |
12 | |
13 void GrNoClip::getConservativeBounds(int width, int height, SkIRect* devResult, | |
14 bool* isIntersectionOfRects) const { | |
15 devResult->setXYWH(0, 0, width, height); | |
16 if (isIntersectionOfRects) { | |
17 *isIntersectionOfRects = true; | |
18 } | |
19 } | |
20 | |
21 bool GrFixedClip::quickContains(const SkRect& rect) const { | |
22 if (fHasStencilClip) { | |
23 return false; | |
24 } | |
25 return !fScissorState.enabled() || GrClip::IsInsideClip(fScissorState.rect()
, rect); | |
26 } | |
27 | |
28 void GrFixedClip::getConservativeBounds(int width, int height, SkIRect* devResul
t, | |
29 bool* isIntersectionOfRects) const { | |
30 devResult->setXYWH(0, 0, width, height); | |
31 if (fScissorState.enabled()) { | |
32 if (!devResult->intersect(fScissorState.rect())) { | |
33 devResult->setEmpty(); | |
34 } | |
35 } | |
36 if (isIntersectionOfRects) { | |
37 *isIntersectionOfRects = true; | |
38 } | |
39 } | |
40 | |
41 bool GrFixedClip::apply(GrContext*, GrDrawContext* drawContext, bool isHWAntiAli
as, | |
42 bool hasUserStencilSettings, GrAppliedClip* out) const { | |
43 if (fScissorState.enabled()) { | |
44 SkIRect tightScissor; | |
45 if (!tightScissor.intersect(fScissorState.rect(), | |
46 SkIRect::MakeWH(drawContext->width(), drawCo
ntext->height()))) { | |
47 return false; | |
48 } | |
49 if (IsOutsideClip(tightScissor, out->clippedDrawBounds())) { | |
50 return false; | |
51 } | |
52 if (!IsInsideClip(fScissorState.rect(), out->clippedDrawBounds())) { | |
53 out->addScissor(tightScissor); | |
54 } | |
55 } | |
56 | |
57 if (fHasStencilClip) { | |
58 out->addStencilClip(); | |
59 } | |
60 | |
61 return true; | |
62 } | |
OLD | NEW |