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