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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 return true; | 1065 return true; |
1066 #endif | 1066 #endif |
1067 } | 1067 } |
1068 | 1068 |
1069 bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveLayerFlags saveLayerFlag
s, | 1069 bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveLayerFlags saveLayerFlag
s, |
1070 SkIRect* intersection, const SkImageFilter* imageF
ilter) { | 1070 SkIRect* intersection, const SkImageFilter* imageF
ilter) { |
1071 SkIRect clipBounds; | 1071 SkIRect clipBounds; |
1072 if (!this->getClipDeviceBounds(&clipBounds)) { | 1072 if (!this->getClipDeviceBounds(&clipBounds)) { |
1073 return false; | 1073 return false; |
1074 } | 1074 } |
| 1075 SkASSERT(!clipBounds.isEmpty()); |
1075 | 1076 |
1076 const SkMatrix& ctm = fMCRec->fMatrix; // this->getTotalMatrix() | 1077 const SkMatrix& ctm = fMCRec->fMatrix; // this->getTotalMatrix() |
1077 | 1078 |
1078 if (imageFilter) { | 1079 if (imageFilter) { |
1079 imageFilter->filterBounds(clipBounds, ctm, &clipBounds); | 1080 if (!imageFilter->filterBounds(clipBounds, ctm, &clipBounds) || clipBoun
ds.isEmpty()) { |
| 1081 return false; |
| 1082 } |
1080 if (bounds && !imageFilter->canComputeFastBounds()) { | 1083 if (bounds && !imageFilter->canComputeFastBounds()) { |
1081 bounds = nullptr; | 1084 bounds = nullptr; |
1082 } | 1085 } |
1083 } | 1086 } |
1084 SkIRect ir; | 1087 SkIRect ir; |
1085 if (bounds) { | 1088 if (bounds) { |
1086 SkRect r; | 1089 SkRect r; |
1087 | 1090 |
1088 ctm.mapRect(&r, *bounds); | 1091 ctm.mapRect(&r, *bounds); |
1089 r.roundOut(&ir); | 1092 r.roundOut(&ir); |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 | 1774 |
1772 bool SkCanvas::getClipDeviceBounds(SkIRect* bounds) const { | 1775 bool SkCanvas::getClipDeviceBounds(SkIRect* bounds) const { |
1773 const SkRasterClip& clip = fMCRec->fRasterClip; | 1776 const SkRasterClip& clip = fMCRec->fRasterClip; |
1774 if (clip.isEmpty()) { | 1777 if (clip.isEmpty()) { |
1775 if (bounds) { | 1778 if (bounds) { |
1776 bounds->setEmpty(); | 1779 bounds->setEmpty(); |
1777 } | 1780 } |
1778 return false; | 1781 return false; |
1779 } | 1782 } |
1780 | 1783 |
| 1784 SkASSERT(!clip.getBounds().isEmpty()); |
1781 if (bounds) { | 1785 if (bounds) { |
1782 *bounds = clip.getBounds(); | 1786 *bounds = clip.getBounds(); |
1783 } | 1787 } |
1784 return true; | 1788 return true; |
1785 } | 1789 } |
1786 | 1790 |
1787 const SkMatrix& SkCanvas::getTotalMatrix() const { | 1791 const SkMatrix& SkCanvas::getTotalMatrix() const { |
1788 return fMCRec->fMatrix; | 1792 return fMCRec->fMatrix; |
1789 } | 1793 } |
1790 | 1794 |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2964 } | 2968 } |
2965 | 2969 |
2966 if (matrix) { | 2970 if (matrix) { |
2967 canvas->concat(*matrix); | 2971 canvas->concat(*matrix); |
2968 } | 2972 } |
2969 } | 2973 } |
2970 | 2974 |
2971 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2975 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2972 fCanvas->restoreToCount(fSaveCount); | 2976 fCanvas->restoreToCount(fSaveCount); |
2973 } | 2977 } |
OLD | NEW |