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