OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |