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

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

Issue 2262473003: Define clear regions in terms of GrFixedClip (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_fixedcliptosrc
Patch Set: rebase Created 4 years, 3 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 | « src/gpu/GrFixedClip.h ('k') | src/gpu/GrGpuCommandBuffer.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 "GrFixedClip.h" 8 #include "GrFixedClip.h"
9 9
10 #include "GrAppliedClip.h" 10 #include "GrAppliedClip.h"
11 #include "GrDrawContext.h" 11 #include "GrDrawContext.h"
12 12
13 bool GrFixedClip::quickContains(const SkRect& rect) const {
14 if (fHasStencilClip) {
15 return false;
16 }
17 return !fScissorState.enabled() || GrClip::IsInsideClip(fScissorState.rect() , rect);
18 }
19
20 void GrFixedClip::getConservativeBounds(int width, int height, SkIRect* devResul t, 13 void GrFixedClip::getConservativeBounds(int width, int height, SkIRect* devResul t,
21 bool* isIntersectionOfRects) const { 14 bool* isIntersectionOfRects) const {
22 devResult->setXYWH(0, 0, width, height); 15 devResult->setXYWH(0, 0, width, height);
23 if (fScissorState.enabled()) { 16 if (fScissorState.enabled()) {
24 if (!devResult->intersect(fScissorState.rect())) { 17 if (!devResult->intersect(fScissorState.rect())) {
25 devResult->setEmpty(); 18 devResult->setEmpty();
26 } 19 }
27 } 20 }
28 if (isIntersectionOfRects) { 21 if (isIntersectionOfRects) {
29 *isIntersectionOfRects = true; 22 *isIntersectionOfRects = true;
30 } 23 }
31 } 24 }
32 25
33 bool GrFixedClip::apply(GrContext*, GrDrawContext* drawContext, bool isHWAntiAli as, 26 bool GrFixedClip::apply(GrContext*, GrDrawContext* drawContext, bool isHWAntiAli as,
34 bool hasUserStencilSettings, GrAppliedClip* out) const { 27 bool hasUserStencilSettings, GrAppliedClip* out) const {
35 if (fScissorState.enabled()) { 28 if (fScissorState.enabled()) {
36 SkIRect tightScissor; 29 SkIRect tightScissor;
37 if (!tightScissor.intersect(fScissorState.rect(), 30 if (!tightScissor.intersect(fScissorState.rect(),
38 SkIRect::MakeWH(drawContext->width(), drawCo ntext->height()))) { 31 SkIRect::MakeWH(drawContext->width(), drawCo ntext->height()))) {
39 return false; 32 return false;
40 } 33 }
41 if (IsOutsideClip(tightScissor, out->clippedDrawBounds())) { 34 if (IsOutsideClip(tightScissor, out->clippedDrawBounds())) {
42 return false; 35 return false;
43 } 36 }
44 if (!IsInsideClip(fScissorState.rect(), out->clippedDrawBounds())) { 37 if (!IsInsideClip(fScissorState.rect(), out->clippedDrawBounds())) {
45 out->addScissor(tightScissor); 38 out->addScissor(tightScissor);
46 } 39 }
47 } 40 }
48 41
49 if (fHasStencilClip) {
50 out->addStencilClip();
51 }
52
53 return true; 42 return true;
54 } 43 }
44
45 const GrFixedClip& GrFixedClip::Disabled() {
46 static const GrFixedClip disabled = GrFixedClip();
47 return disabled;
48 }
OLDNEW
« no previous file with comments | « src/gpu/GrFixedClip.h ('k') | src/gpu/GrGpuCommandBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698