| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
| 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 fClipStack->clipDevRect(devR, op, isAA); | 1604 fClipStack->clipDevRect(devR, op, isAA); |
| 1605 fMCRec->fRasterClip.op(devR, this->getTopLayerBounds(), op, isAA); | 1605 fMCRec->fRasterClip.op(devR, this->getTopLayerBounds(), op, isAA); |
| 1606 } else { | 1606 } else { |
| 1607 // since we're rotated or some such thing, we convert the rect to a path | 1607 // since we're rotated or some such thing, we convert the rect to a path |
| 1608 // and clip against that, since it can handle any matrix. However, to | 1608 // and clip against that, since it can handle any matrix. However, to |
| 1609 // avoid recursion in the case where we are subclassed (e.g. Pictures) | 1609 // avoid recursion in the case where we are subclassed (e.g. Pictures) |
| 1610 // we explicitly call "our" version of clipPath. | 1610 // we explicitly call "our" version of clipPath. |
| 1611 SkPath path; | 1611 SkPath path; |
| 1612 | 1612 |
| 1613 path.addRect(rect); | 1613 path.addRect(rect); |
| 1614 path.setIsVolatile(true); |
| 1614 this->SkCanvas::onClipPath(path, op, edgeStyle); | 1615 this->SkCanvas::onClipPath(path, op, edgeStyle); |
| 1615 } | 1616 } |
| 1616 | 1617 |
| 1617 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); | 1618 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); |
| 1618 } | 1619 } |
| 1619 | 1620 |
| 1620 void SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { | 1621 void SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { |
| 1621 this->checkForDeferredSave(); | 1622 this->checkForDeferredSave(); |
| 1622 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; | 1623 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; |
| 1623 if (rrect.isRect()) { | 1624 if (rrect.isRect()) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1640 fClipStack->clipDevRRect(transformedRRect, op, kSoft_ClipEdgeStyle == ed
geStyle); | 1641 fClipStack->clipDevRRect(transformedRRect, op, kSoft_ClipEdgeStyle == ed
geStyle); |
| 1641 | 1642 |
| 1642 fMCRec->fRasterClip.op(transformedRRect, this->getTopLayerBounds(), op, | 1643 fMCRec->fRasterClip.op(transformedRRect, this->getTopLayerBounds(), op, |
| 1643 kSoft_ClipEdgeStyle == edgeStyle); | 1644 kSoft_ClipEdgeStyle == edgeStyle); |
| 1644 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); | 1645 fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds()); |
| 1645 return; | 1646 return; |
| 1646 } | 1647 } |
| 1647 | 1648 |
| 1648 SkPath path; | 1649 SkPath path; |
| 1649 path.addRRect(rrect); | 1650 path.addRRect(rrect); |
| 1651 path.setIsVolatile(true); |
| 1650 // call the non-virtual version | 1652 // call the non-virtual version |
| 1651 this->SkCanvas::onClipPath(path, op, edgeStyle); | 1653 this->SkCanvas::onClipPath(path, op, edgeStyle); |
| 1652 } | 1654 } |
| 1653 | 1655 |
| 1654 void SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { | 1656 void SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { |
| 1655 this->checkForDeferredSave(); | 1657 this->checkForDeferredSave(); |
| 1656 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; | 1658 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; |
| 1657 | 1659 |
| 1658 if (!path.isInverseFillType() && fMCRec->fMatrix.rectStaysRect()) { | 1660 if (!path.isInverseFillType() && fMCRec->fMatrix.rectStaysRect()) { |
| 1659 SkRect r; | 1661 SkRect r; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 #endif | 1698 #endif |
| 1697 | 1699 |
| 1698 AutoValidateClip avc(this); | 1700 AutoValidateClip avc(this); |
| 1699 | 1701 |
| 1700 fDeviceCMDirty = true; | 1702 fDeviceCMDirty = true; |
| 1701 if (!fAllowSoftClip) { | 1703 if (!fAllowSoftClip) { |
| 1702 edgeStyle = kHard_ClipEdgeStyle; | 1704 edgeStyle = kHard_ClipEdgeStyle; |
| 1703 } | 1705 } |
| 1704 | 1706 |
| 1705 SkPath devPath; | 1707 SkPath devPath; |
| 1706 path.transform(fMCRec->fMatrix, &devPath); | 1708 if (fMCRec->fMatrix.isIdentity()) { |
| 1709 devPath = path; |
| 1710 } else { |
| 1711 path.transform(fMCRec->fMatrix, &devPath); |
| 1712 devPath.setIsVolatile(true); |
| 1713 } |
| 1707 | 1714 |
| 1708 // Check if the transfomation, or the original path itself | 1715 // Check if the transfomation, or the original path itself |
| 1709 // made us empty. Note this can also happen if we contained NaN | 1716 // made us empty. Note this can also happen if we contained NaN |
| 1710 // values. computing the bounds detects this, and will set our | 1717 // values. computing the bounds detects this, and will set our |
| 1711 // bounds to empty if that is the case. (see SkRect::set(pts, count)) | 1718 // bounds to empty if that is the case. (see SkRect::set(pts, count)) |
| 1712 if (devPath.getBounds().isEmpty()) { | 1719 if (devPath.getBounds().isEmpty()) { |
| 1713 // resetting the path will remove any NaN or other wanky values | 1720 // resetting the path will remove any NaN or other wanky values |
| 1714 // that might upset our scan converter. | 1721 // that might upset our scan converter. |
| 1715 devPath.reset(); | 1722 devPath.reset(); |
| 1716 } | 1723 } |
| (...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3392 | 3399 |
| 3393 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3400 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
| 3394 fCanvas->restoreToCount(fSaveCount); | 3401 fCanvas->restoreToCount(fSaveCount); |
| 3395 } | 3402 } |
| 3396 | 3403 |
| 3397 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3404 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
| 3398 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 3405 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
| 3399 return this->makeSurface(info, props).release(); | 3406 return this->makeSurface(info, props).release(); |
| 3400 } | 3407 } |
| 3401 #endif | 3408 #endif |
| OLD | NEW |