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

Side by Side Diff: src/utils/SkCanvasStack.cpp

Issue 777643003: use ClipOp instead of SkRegion for clipping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/pipe/SkGPipeRead.cpp ('k') | src/utils/SkDeferredCanvas.cpp » ('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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkCanvasStack.h" 8 #include "SkCanvasStack.h"
9 9
10 SkCanvasStack::SkCanvasStack(int width, int height) 10 SkCanvasStack::SkCanvasStack(int width, int height)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 /** 49 /**
50 * Traverse all canvases (e.g. layers) the stack and ensure that they are clippe d 50 * Traverse all canvases (e.g. layers) the stack and ensure that they are clippe d
51 * to their bounds and that the area covered by any canvas higher in the stack i s 51 * to their bounds and that the area covered by any canvas higher in the stack i s
52 * also clipped out. 52 * also clipped out.
53 */ 53 */
54 void SkCanvasStack::clipToZOrderedBounds() { 54 void SkCanvasStack::clipToZOrderedBounds() {
55 SkASSERT(fList.count() == fCanvasData.count()); 55 SkASSERT(fList.count() == fCanvasData.count());
56 for (int i = 0; i < fList.count(); ++i) { 56 for (int i = 0; i < fList.count(); ++i) {
57 fList[i]->clipRegion(fCanvasData[i].requiredClip, SkRegion::kIntersect_O p); 57 fList[i]->clipRegion(fCanvasData[i].requiredClip);
58 } 58 }
59 } 59 }
60 60
61 //////////////////////////////////////////////////////////////////////////////// 61 ////////////////////////////////////////////////////////////////////////////////
62 62
63 /** 63 /**
64 * We need to handle setMatrix specially as it overwrites the matrix in each 64 * We need to handle setMatrix specially as it overwrites the matrix in each
65 * canvas unlike all other matrix operations (i.e. translate, scale, etc) which 65 * canvas unlike all other matrix operations (i.e. translate, scale, etc) which
66 * just pre-concatenate with the existing matrix. 66 * just pre-concatenate with the existing matrix.
67 */ 67 */
(...skipping 24 matching lines...) Expand all
92 this->clipToZOrderedBounds(); 92 this->clipToZOrderedBounds();
93 } 93 }
94 94
95 void SkCanvasStack::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 95 void SkCanvasStack::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
96 SkASSERT(fList.count() == fCanvasData.count()); 96 SkASSERT(fList.count() == fCanvasData.count());
97 for (int i = 0; i < fList.count(); ++i) { 97 for (int i = 0; i < fList.count(); ++i) {
98 SkRegion tempRegion; 98 SkRegion tempRegion;
99 deviceRgn.translate(-fCanvasData[i].origin.x(), 99 deviceRgn.translate(-fCanvasData[i].origin.x(),
100 -fCanvasData[i].origin.y(), &tempRegion); 100 -fCanvasData[i].origin.y(), &tempRegion);
101 tempRegion.op(fCanvasData[i].requiredClip, SkRegion::kIntersect_Op); 101 tempRegion.op(fCanvasData[i].requiredClip, SkRegion::kIntersect_Op);
102 fList[i]->clipRegion(tempRegion, op); 102 fList[i]->legacyClipRegion(tempRegion, op);
103 } 103 }
104 this->SkCanvas::onClipRegion(deviceRgn, op); 104 this->SkCanvas::onClipRegion(deviceRgn, op);
105 } 105 }
OLDNEW
« no previous file with comments | « src/pipe/SkGPipeRead.cpp ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698