Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: src/gpu/GrClip.cpp

Issue 2246113002: Convert GrAppliedClip interface to builder style (Closed) Base URL: https://skia.googlesource.com/skia.git@fixstencilpath
Patch Set: Convert GrAppliedClip interface to builder style Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/GrTypesPriv.h ('k') | src/gpu/GrClipStackClip.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrDrawContext.h" 10 #include "GrDrawContext.h"
11 11
12 void GrNoClip::getConservativeBounds(int width, int height, SkIRect* devResult, 12 void GrNoClip::getConservativeBounds(int width, int height, SkIRect* devResult,
13 bool* isIntersectionOfRects) const { 13 bool* isIntersectionOfRects) const {
14 devResult->setXYWH(0, 0, width, height); 14 devResult->setXYWH(0, 0, width, height);
15 if (isIntersectionOfRects) { 15 if (isIntersectionOfRects) {
16 *isIntersectionOfRects = true; 16 *isIntersectionOfRects = true;
17 } 17 }
18 } 18 }
19 19
20 bool GrFixedClip::quickContains(const SkRect& rect) const { 20 bool GrFixedClip::quickContains(const SkRect& rect) const {
21 if (fHasStencilClip) { 21 if (fHasStencilClip) {
22 return false; 22 return false;
23 } 23 }
24 if (!fScissorState.enabled()) { 24 return !fScissorState.enabled() || GrClip::IsInsideClip(fScissorState.rect() , rect);
25 return true;
26 }
27 return fScissorState.rect().contains(rect);
28 } 25 }
29 26
30 void GrFixedClip::getConservativeBounds(int width, int height, SkIRect* devResul t, 27 void GrFixedClip::getConservativeBounds(int width, int height, SkIRect* devResul t,
31 bool* isIntersectionOfRects) const { 28 bool* isIntersectionOfRects) const {
32 devResult->setXYWH(0, 0, width, height); 29 devResult->setXYWH(0, 0, width, height);
33 if (fScissorState.enabled()) { 30 if (fScissorState.enabled()) {
34 if (!devResult->intersect(fScissorState.rect())) { 31 if (!devResult->intersect(fScissorState.rect())) {
35 devResult->setEmpty(); 32 devResult->setEmpty();
36 } 33 }
37 } 34 }
38 if (isIntersectionOfRects) { 35 if (isIntersectionOfRects) {
39 *isIntersectionOfRects = true; 36 *isIntersectionOfRects = true;
40 } 37 }
41 } 38 }
42 39
43 bool GrFixedClip::apply(GrContext*, 40 bool GrFixedClip::apply(GrContext*, GrDrawContext* drawContext, bool isHWAntiAli as,
44 GrDrawContext* drawContext, 41 bool hasUserStencilSettings, GrAppliedClip* out) const {
45 const SkRect* devBounds,
46 bool isHWAntiAlias,
47 bool hasUserStencilSettings,
48 GrAppliedClip* out) const {
49 SkASSERT(!fDeviceBounds.isLargest());
50 if (fScissorState.enabled()) { 42 if (fScissorState.enabled()) {
51 SkIRect tightScissor; 43 SkIRect tightScissor;
52 if (!tightScissor.intersect(fScissorState.rect(), 44 if (!tightScissor.intersect(fScissorState.rect(),
53 SkIRect::MakeWH(drawContext->width(), drawCo ntext->height()))) { 45 SkIRect::MakeWH(drawContext->width(), drawCo ntext->height()))) {
54 return false; 46 return false;
55 } 47 }
56 if (devBounds && IsOutsideClip(tightScissor, *devBounds)) { 48 if (IsOutsideClip(tightScissor, out->clippedDrawBounds())) {
57 return false; 49 return false;
58 } 50 }
59 if (!devBounds || !IsInsideClip(fScissorState.rect(), *devBounds)) { 51 if (!IsInsideClip(fScissorState.rect(), out->clippedDrawBounds())) {
60 if (fHasStencilClip) { 52 out->addScissor(tightScissor);
61 out->makeScissoredStencil(tightScissor, &fDeviceBounds);
62 } else {
63 out->makeScissored(tightScissor);
64 }
65 return true;
66 } 53 }
67 } 54 }
68 55
69 out->makeStencil(fHasStencilClip, fDeviceBounds); 56 if (fHasStencilClip) {
57 out->addStencilClip();
58 }
59
70 return true; 60 return true;
71 } 61 }
OLDNEW
« no previous file with comments | « include/gpu/GrTypesPriv.h ('k') | src/gpu/GrClipStackClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698