| 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 17 matching lines...) Expand all Loading... |
| 28 data->requiredClip.setRect(canvasBounds); | 28 data->requiredClip.setRect(canvasBounds); |
| 29 | 29 |
| 30 // subtract this region from the canvas objects already on the stack. | 30 // subtract this region from the canvas objects already on the stack. |
| 31 // This ensures they do not draw into the space occupied by the layers | 31 // This ensures they do not draw into the space occupied by the layers |
| 32 // above them. | 32 // above them. |
| 33 for (int i = fList.count() - 1; i > 0; --i) { | 33 for (int i = fList.count() - 1; i > 0; --i) { |
| 34 SkIRect localBounds = canvasBounds; | 34 SkIRect localBounds = canvasBounds; |
| 35 localBounds.offset(origin - fCanvasData[i-1].origin); | 35 localBounds.offset(origin - fCanvasData[i-1].origin); |
| 36 | 36 |
| 37 fCanvasData[i-1].requiredClip.op(localBounds, SkRegion::kDifference_
Op); | 37 fCanvasData[i-1].requiredClip.op(localBounds, SkRegion::kDifference_
Op); |
| 38 fList[i-i]->clipRegion(fCanvasData[i-1].requiredClip); | 38 fList[i-1]->clipRegion(fCanvasData[i-1].requiredClip); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 SkASSERT(fList.count() == fCanvasData.count()); | 41 SkASSERT(fList.count() == fCanvasData.count()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void SkCanvasStack::removeAll() { | 44 void SkCanvasStack::removeAll() { |
| 45 fCanvasData.reset(); | 45 fCanvasData.reset(); |
| 46 this->INHERITED::removeAll(); | 46 this->INHERITED::removeAll(); |
| 47 } | 47 } |
| 48 | 48 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 SkASSERT(fList.count() == fCanvasData.count()); | 99 SkASSERT(fList.count() == fCanvasData.count()); |
| 100 for (int i = 0; i < fList.count(); ++i) { | 100 for (int i = 0; i < fList.count(); ++i) { |
| 101 SkRegion tempRegion; | 101 SkRegion tempRegion; |
| 102 deviceRgn.translate(-fCanvasData[i].origin.x(), | 102 deviceRgn.translate(-fCanvasData[i].origin.x(), |
| 103 -fCanvasData[i].origin.y(), &tempRegion); | 103 -fCanvasData[i].origin.y(), &tempRegion); |
| 104 tempRegion.op(fCanvasData[i].requiredClip, SkRegion::kIntersect_Op); | 104 tempRegion.op(fCanvasData[i].requiredClip, SkRegion::kIntersect_Op); |
| 105 fList[i]->clipRegion(tempRegion, op); | 105 fList[i]->clipRegion(tempRegion, op); |
| 106 } | 106 } |
| 107 return this->SkCanvas::clipRegion(deviceRgn, op); | 107 return this->SkCanvas::clipRegion(deviceRgn, op); |
| 108 } | 108 } |
| OLD | NEW |