| Index: src/core/SkDraw.cpp
|
| diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
|
| index 84899789cfcbf92e42b10caaeeef5bf0c10163bc..2c0f989a4b2bdb7511597c7a0f307daa6f6564cd 100644
|
| --- a/src/core/SkDraw.cpp
|
| +++ b/src/core/SkDraw.cpp
|
| @@ -1107,17 +1107,28 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
|
| /** For the purposes of drawing bitmaps, if a matrix is "almost" translate
|
| go ahead and treat it as if it were, so that subsequent code can go fast.
|
| */
|
| -static bool just_translate(const SkMatrix& matrix, const SkBitmap& bitmap) {
|
| - unsigned bits = 0; // TODO: find a way to allow the caller to tell us to
|
| - // respect filtering.
|
| - return SkTreatAsSprite(matrix, bitmap.width(), bitmap.height(), bits);
|
| +static bool just_translate(const SkMatrix& ctm, const SkBitmap& bm, SkPaint::FilterLevel filter) {
|
| + unsigned bits = 0;
|
| + switch (filter) {
|
| + case SkPaint::kNone_FilterLevel:
|
| + bits = 0;
|
| + break;
|
| + case SkPaint::kLow_FilterLevel:
|
| + case SkPaint::kMedium_FilterLevel:
|
| + bits = 4;
|
| + break;
|
| + case SkPaint::kHigh_FilterLevel:
|
| + bits = 4;
|
| + break;
|
| + }
|
| + return SkTreatAsSprite(ctm, bm.width(), bm.height(), bits);
|
| }
|
|
|
| void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap,
|
| const SkPaint& paint) const {
|
| SkASSERT(bitmap.colorType() == kAlpha_8_SkColorType);
|
|
|
| - if (just_translate(*fMatrix, bitmap)) {
|
| + if (just_translate(*fMatrix, bitmap, paint.getFilterLevel())) {
|
| int ix = SkScalarRoundToInt(fMatrix->getTranslateX());
|
| int iy = SkScalarRoundToInt(fMatrix->getTranslateY());
|
|
|
| @@ -1236,7 +1247,8 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
|
| return;
|
| }
|
|
|
| - if (bitmap.colorType() != kAlpha_8_SkColorType && just_translate(matrix, bitmap)) {
|
| + if (bitmap.colorType() != kAlpha_8_SkColorType && just_translate(matrix, bitmap,
|
| + paint.getFilterLevel())) {
|
| //
|
| // It is safe to call lock pixels now, since we know the matrix is
|
| // (more or less) identity.
|
|
|