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 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 | 1593 |
1594 SkPath path; | 1594 SkPath path; |
1595 path.addRRect(rrect); | 1595 path.addRRect(rrect); |
1596 // call the non-virtual version | 1596 // call the non-virtual version |
1597 this->SkCanvas::onClipPath(path, op, edgeStyle); | 1597 this->SkCanvas::onClipPath(path, op, edgeStyle); |
1598 } | 1598 } |
1599 | 1599 |
1600 void SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { | 1600 void SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { |
1601 this->checkForDeferredSave(); | 1601 this->checkForDeferredSave(); |
1602 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; | 1602 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; |
1603 SkRect r; | 1603 |
1604 if (!path.isInverseFillType() && path.isRect(&r)) { | 1604 if (!path.isInverseFillType() && fMCRec->fMatrix.rectStaysRect()) { |
1605 this->onClipRect(r, op, edgeStyle); | 1605 SkRect r; |
1606 } else { | 1606 if (path.isRect(&r)) { |
1607 this->onClipPath(path, op, edgeStyle); | 1607 this->onClipRect(r, op, edgeStyle); |
| 1608 return; |
| 1609 } |
| 1610 SkRRect rrect; |
| 1611 if (path.isOval(&r)) { |
| 1612 rrect.setOval(r); |
| 1613 this->onClipRRect(rrect, op, edgeStyle); |
| 1614 return; |
| 1615 } |
| 1616 if (path.isRRect(&rrect)) { |
| 1617 this->onClipRRect(rrect, op, edgeStyle); |
| 1618 return; |
| 1619 } |
1608 } | 1620 } |
| 1621 |
| 1622 this->onClipPath(path, op, edgeStyle); |
1609 } | 1623 } |
1610 | 1624 |
1611 void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edg
eStyle) { | 1625 void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edg
eStyle) { |
1612 #ifdef SK_ENABLE_CLIP_QUICKREJECT | 1626 #ifdef SK_ENABLE_CLIP_QUICKREJECT |
1613 if (SkRegion::kIntersect_Op == op && !path.isInverseFillType()) { | 1627 if (SkRegion::kIntersect_Op == op && !path.isInverseFillType()) { |
1614 if (fMCRec->fRasterClip.isEmpty()) { | 1628 if (fMCRec->fRasterClip.isEmpty()) { |
1615 return false; | 1629 return false; |
1616 } | 1630 } |
1617 | 1631 |
1618 if (this->quickReject(path.getBounds())) { | 1632 if (this->quickReject(path.getBounds())) { |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2949 } | 2963 } |
2950 | 2964 |
2951 if (matrix) { | 2965 if (matrix) { |
2952 canvas->concat(*matrix); | 2966 canvas->concat(*matrix); |
2953 } | 2967 } |
2954 } | 2968 } |
2955 | 2969 |
2956 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2970 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2957 fCanvas->restoreToCount(fSaveCount); | 2971 fCanvas->restoreToCount(fSaveCount); |
2958 } | 2972 } |
OLD | NEW |