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 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2213 | 2213 |
2214 LOOPER_END | 2214 LOOPER_END |
2215 } | 2215 } |
2216 | 2216 |
2217 bool SkCanvas::canDrawBitmapAsSprite(SkScalar x, SkScalar y, int w, int h, const
SkPaint& paint) { | 2217 bool SkCanvas::canDrawBitmapAsSprite(SkScalar x, SkScalar y, int w, int h, const
SkPaint& paint) { |
2218 if (!paint.getImageFilter()) { | 2218 if (!paint.getImageFilter()) { |
2219 return false; | 2219 return false; |
2220 } | 2220 } |
2221 | 2221 |
2222 const SkMatrix& ctm = this->getTotalMatrix(); | 2222 const SkMatrix& ctm = this->getTotalMatrix(); |
2223 if (!SkTreatAsSprite(ctm, SkISize::Make(w, h), paint)) { | 2223 const unsigned kSubpixelBits = 0; // matching SkDraw::drawBitmap() |
| 2224 if (!SkTreatAsSprite(ctm, w, h, kSubpixelBits)) { |
2224 return false; | 2225 return false; |
2225 } | 2226 } |
2226 | 2227 |
2227 // Currently we can only use the filterSprite code if we are clipped to the
bitmap's bounds. | 2228 // Currently we can only use the filterSprite code if we are clipped to the
bitmap's bounds. |
2228 // Once we can filter and the filter will return a result larger than itself
, we should be | 2229 // Once we can filter and the filter will return a result larger than itself
, we should be |
2229 // able to remove this constraint. | 2230 // able to remove this constraint. |
2230 // skbug.com/4526 | 2231 // skbug.com/4526 |
2231 // | 2232 // |
2232 SkPoint pt; | 2233 SkPoint pt; |
2233 ctm.mapXY(x, y, &pt); | 2234 ctm.mapXY(x, y, &pt); |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3021 } | 3022 } |
3022 | 3023 |
3023 if (matrix) { | 3024 if (matrix) { |
3024 canvas->concat(*matrix); | 3025 canvas->concat(*matrix); |
3025 } | 3026 } |
3026 } | 3027 } |
3027 | 3028 |
3028 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3029 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3029 fCanvas->restoreToCount(fSaveCount); | 3030 fCanvas->restoreToCount(fSaveCount); |
3030 } | 3031 } |
OLD | NEW |