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

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

Issue 2289363005: Improve usage of window rectangles (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_drawsinreducedclip
Patch Set: Improve usage of window rectangles 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
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 (!fWindowRectsState.disabled()) {
15 return false;
16 }
17 return !fScissorState.enabled() || GrClip::IsInsideClip(fScissorState.rect() , rect);
18 }
19
13 void GrFixedClip::getConservativeBounds(int width, int height, SkIRect* devResul t, 20 void GrFixedClip::getConservativeBounds(int width, int height, SkIRect* devResul t,
14 bool* isIntersectionOfRects) const { 21 bool* isIntersectionOfRects) const {
15 devResult->setXYWH(0, 0, width, height); 22 devResult->setXYWH(0, 0, width, height);
16 if (fScissorState.enabled()) { 23 if (fScissorState.enabled()) {
17 if (!devResult->intersect(fScissorState.rect())) { 24 if (!devResult->intersect(fScissorState.rect())) {
18 devResult->setEmpty(); 25 devResult->setEmpty();
19 } 26 }
20 } 27 }
21 if (isIntersectionOfRects) { 28 if (isIntersectionOfRects) {
22 *isIntersectionOfRects = true; 29 *isIntersectionOfRects = true;
23 } 30 }
24 } 31 }
25 32
26 bool GrFixedClip::apply(GrContext*, GrDrawContext* drawContext, bool isHWAntiAli as, 33 bool GrFixedClip::isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const {
27 bool hasUserStencilSettings, GrAppliedClip* out) const { 34 if (!fWindowRectsState.disabled()) {
35 return false;
36 }
28 if (fScissorState.enabled()) { 37 if (fScissorState.enabled()) {
29 SkIRect tightScissor; 38 SkRect rect = SkRect::Make(fScissorState.rect());
30 if (!tightScissor.intersect(fScissorState.rect(), 39 if (!rect.intersects(rtBounds)) {
31 SkIRect::MakeWH(drawContext->width(), drawCo ntext->height()))) { 40 return false;
41 }
42 rr->setRect(rect);
43 *aa = false;
44 return true;
45 }
46 return false;
47 };
48
49 bool GrFixedClip::apply(GrContext*, GrDrawContext* dc, bool, bool, GrAppliedClip * out) const {
50 if (fScissorState.enabled()) {
51 SkIRect tightScissor = SkIRect::MakeWH(dc->width(), dc->height());
52 if (!tightScissor.intersect(fScissorState.rect())) {
32 return false; 53 return false;
33 } 54 }
34 if (IsOutsideClip(tightScissor, out->clippedDrawBounds())) { 55 if (IsOutsideClip(tightScissor, out->clippedDrawBounds())) {
35 return false; 56 return false;
36 } 57 }
37 if (!IsInsideClip(fScissorState.rect(), out->clippedDrawBounds())) { 58 if (!IsInsideClip(fScissorState.rect(), out->clippedDrawBounds())) {
38 out->addScissor(tightScissor); 59 out->addScissor(tightScissor);
39 } 60 }
40 } 61 }
41 62
63 if (!fWindowRectsState.disabled()) {
64 out->addWindowRectangles() = fWindowRectsState;
65 }
66
42 return true; 67 return true;
43 } 68 }
44 69
45 const GrFixedClip& GrFixedClip::Disabled() { 70 const GrFixedClip& GrFixedClip::Disabled() {
46 static const GrFixedClip disabled = GrFixedClip(); 71 static const GrFixedClip disabled = GrFixedClip();
47 return disabled; 72 return disabled;
48 } 73 }
OLDNEW
« src/gpu/GrFixedClip.h ('K') | « src/gpu/GrFixedClip.h ('k') | src/gpu/GrPipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698