| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
| 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 | 8 |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 case SkRegion::kReplace_Op: | 1602 case SkRegion::kReplace_Op: |
| 1603 case SkRegion::kReverseDifference_Op: | 1603 case SkRegion::kReverseDifference_Op: |
| 1604 case SkRegion::kXOR_Op: { | 1604 case SkRegion::kXOR_Op: { |
| 1605 // These ops can grow the current clip up to the extents of | 1605 // These ops can grow the current clip up to the extents of |
| 1606 // the input clip, which is inverse filled, so we just set | 1606 // the input clip, which is inverse filled, so we just set |
| 1607 // the current clip to the device bounds. | 1607 // the current clip to the device bounds. |
| 1608 SkRect deviceBounds; | 1608 SkRect deviceBounds; |
| 1609 SkIRect deviceIBounds; | 1609 SkIRect deviceIBounds; |
| 1610 this->getDevice()->getGlobalBounds(&deviceIBounds); | 1610 this->getDevice()->getGlobalBounds(&deviceIBounds); |
| 1611 deviceBounds = SkRect::Make(deviceIBounds); | 1611 deviceBounds = SkRect::Make(deviceIBounds); |
| 1612 this->SkCanvas::save(SkCanvas::kMatrix_SaveFlag); | 1612 |
| 1613 // set the clip in device space | 1613 // set the clip in device space |
| 1614 SkMatrix savedMatrix = this->getTotalMatrix(); |
| 1614 this->SkCanvas::setMatrix(SkMatrix::I()); | 1615 this->SkCanvas::setMatrix(SkMatrix::I()); |
| 1615 this->SkCanvas::onClipRect(deviceBounds, SkRegion::kReplace_
Op, | 1616 this->SkCanvas::onClipRect(deviceBounds, SkRegion::kReplace_
Op, |
| 1616 kHard_ClipEdgeStyle); | 1617 kHard_ClipEdgeStyle); |
| 1617 this->SkCanvas::restore(); //pop the matrix, but keep the cl
ip | 1618 this->setMatrix(savedMatrix); |
| 1618 break; | 1619 break; |
| 1619 } | 1620 } |
| 1620 default: | 1621 default: |
| 1621 SkASSERT(0); // unhandled op? | 1622 SkASSERT(0); // unhandled op? |
| 1622 } | 1623 } |
| 1623 } else { | 1624 } else { |
| 1624 // Not inverse filled | 1625 // Not inverse filled |
| 1625 switch (op) { | 1626 switch (op) { |
| 1626 case SkRegion::kIntersect_Op: | 1627 case SkRegion::kIntersect_Op: |
| 1627 case SkRegion::kUnion_Op: | 1628 case SkRegion::kUnion_Op: |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2621 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2622 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
| 2622 return NULL; | 2623 return NULL; |
| 2623 } | 2624 } |
| 2624 | 2625 |
| 2625 // should this functionality be moved into allocPixels()? | 2626 // should this functionality be moved into allocPixels()? |
| 2626 if (!bitmap.info().isOpaque()) { | 2627 if (!bitmap.info().isOpaque()) { |
| 2627 bitmap.eraseColor(0); | 2628 bitmap.eraseColor(0); |
| 2628 } | 2629 } |
| 2629 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2630 return SkNEW_ARGS(SkCanvas, (bitmap)); |
| 2630 } | 2631 } |
| OLD | NEW |