diff options
author | Mike Reed <reed@google.com> | 2015-03-16 11:16:09 -0400 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2015-03-16 11:31:38 -0400 |
commit | 2a1ce8a4e5258b6599cb8e86864eb816d24d69b4 (patch) | |
tree | a46995b45b8a2b79665460ebc6c6839449ef65c9 | |
parent | ee1f24ff2985a32b473244cc464b3ca7854de189 (diff) | |
download | frameworks_base-2a1ce8a4e5258b6599cb8e86864eb816d24d69b4.zip frameworks_base-2a1ce8a4e5258b6599cb8e86864eb816d24d69b4.tar.gz frameworks_base-2a1ce8a4e5258b6599cb8e86864eb816d24d69b4.tar.bz2 |
use SkFilterQuality instead of SkPaint::FilterLevel
Change-Id: I5d26869de746107b8a35a7a662236f993a824b0d
-rw-r--r-- | core/jni/android/graphics/BitmapFactory.cpp | 2 | ||||
-rw-r--r-- | core/jni/android/graphics/DrawFilter.cpp | 16 | ||||
-rw-r--r-- | core/jni/android/graphics/Paint.cpp | 12 | ||||
-rw-r--r-- | core/jni/android_graphics_Canvas.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/utils/PaintUtils.h | 2 |
5 files changed, 19 insertions, 19 deletions
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp index 47090fb..526885f 100644 --- a/core/jni/android/graphics/BitmapFactory.cpp +++ b/core/jni/android/graphics/BitmapFactory.cpp @@ -401,7 +401,7 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding } SkPaint paint; - paint.setFilterLevel(SkPaint::kLow_FilterLevel); + paint.setFilterQuality(kLow_SkFilterQuality); SkCanvas canvas(*outputBitmap); canvas.scale(sx, sy); diff --git a/core/jni/android/graphics/DrawFilter.cpp b/core/jni/android/graphics/DrawFilter.cpp index bac124f..90ef6c0 100644 --- a/core/jni/android/graphics/DrawFilter.cpp +++ b/core/jni/android/graphics/DrawFilter.cpp @@ -32,23 +32,23 @@ namespace android { -// Custom version of SkPaintFlagsDrawFilter that also calls setFilterLevel. +// Custom version of SkPaintFlagsDrawFilter that also calls setFilterQuality. class CompatFlagsDrawFilter : public SkPaintFlagsDrawFilter { public: CompatFlagsDrawFilter(uint32_t clearFlags, uint32_t setFlags, - SkPaint::FilterLevel desiredLevel) + SkFilterQuality desiredQuality) : SkPaintFlagsDrawFilter(clearFlags, setFlags) - , fDesiredLevel(desiredLevel) { + , fDesiredQuality(desiredQuality) { } virtual bool filter(SkPaint* paint, Type type) { SkPaintFlagsDrawFilter::filter(paint, type); - paint->setFilterLevel(fDesiredLevel); + paint->setFilterQuality(fDesiredQuality); return true; } private: - const SkPaint::FilterLevel fDesiredLevel; + const SkFilterQuality fDesiredQuality; }; // Returns whether flags contains FILTER_BITMAP_FLAG. If flags does, remove it. @@ -74,7 +74,7 @@ public: if (clearFlags | setFlags) { // Mask both groups of flags to remove FILTER_BITMAP_FLAG, which no // longer has a Skia equivalent flag (instead it corresponds to - // calling setFilterLevel), and keep track of which group(s), if + // calling setFilterQuality), and keep track of which group(s), if // any, had the flag set. const bool turnFilteringOn = hadFiltering(setFlags); const bool turnFilteringOff = hadFiltering(clearFlags); @@ -83,10 +83,10 @@ public: if (turnFilteringOn) { // Turning filtering on overrides turning it off. filter = new CompatFlagsDrawFilter(clearFlags, setFlags, - SkPaint::kLow_FilterLevel); + kLow_SkFilterQuality); } else if (turnFilteringOff) { filter = new CompatFlagsDrawFilter(clearFlags, setFlags, - SkPaint::kNone_FilterLevel); + kNone_SkFilterQuality); } else { filter = new SkPaintFlagsDrawFilter(clearFlags, setFlags); } diff --git a/core/jni/android/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp index a92a9ac..f0131b4 100644 --- a/core/jni/android/graphics/Paint.cpp +++ b/core/jni/android/graphics/Paint.cpp @@ -132,7 +132,7 @@ public: Paint* nativePaint = getNativePaint(env, paint); uint32_t result = nativePaint->getFlags(); result &= ~sFilterBitmapFlag; // Filtering no longer stored in this bit. Mask away. - if (nativePaint->getFilterLevel() != Paint::kNone_FilterLevel) { + if (nativePaint->getFilterQuality() != kNone_SkFilterQuality) { result |= sFilterBitmapFlag; } return static_cast<jint>(result); @@ -142,9 +142,9 @@ public: NPE_CHECK_RETURN_VOID(env, paint); Paint* nativePaint = getNativePaint(env, paint); // Instead of modifying 0x02, change the filter level. - nativePaint->setFilterLevel(flags & sFilterBitmapFlag - ? Paint::kLow_FilterLevel - : Paint::kNone_FilterLevel); + nativePaint->setFilterQuality(flags & sFilterBitmapFlag + ? kLow_SkFilterQuality + : kNone_SkFilterQuality); // Don't pass through filter flag, which is no longer stored in paint's flags. flags &= ~sFilterBitmapFlag; // Use the existing value for 0x02. @@ -197,8 +197,8 @@ public: static void setFilterBitmap(JNIEnv* env, jobject paint, jboolean filterBitmap) { NPE_CHECK_RETURN_VOID(env, paint); - getNativePaint(env, paint)->setFilterLevel( - filterBitmap ? Paint::kLow_FilterLevel : Paint::kNone_FilterLevel); + getNativePaint(env, paint)->setFilterQuality( + filterBitmap ? kLow_SkFilterQuality : kNone_SkFilterQuality); } static void setDither(JNIEnv* env, jobject paint, jboolean dither) { diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp index c337a9f..47af5e6 100644 --- a/core/jni/android_graphics_Canvas.cpp +++ b/core/jni/android_graphics_Canvas.cpp @@ -320,7 +320,7 @@ static void drawBitmap(JNIEnv* env, jobject jcanvas, jlong canvasHandle, jlong b if (paint) { filteredPaint = *paint; } - filteredPaint.setFilterLevel(Paint::kLow_FilterLevel); + filteredPaint.setFilterQuality(kLow_SkFilterQuality); canvas->drawBitmap(*bitmap, left, top, &filteredPaint); } else { canvas->drawBitmap(*bitmap, left, top, paint); @@ -335,7 +335,7 @@ static void drawBitmap(JNIEnv* env, jobject jcanvas, jlong canvasHandle, jlong b if (paint) { filteredPaint = *paint; } - filteredPaint.setFilterLevel(Paint::kLow_FilterLevel); + filteredPaint.setFilterQuality(kLow_SkFilterQuality); canvas->drawBitmap(*bitmap, 0, 0, &filteredPaint); canvas->restore(); @@ -363,7 +363,7 @@ static void drawBitmapRect(JNIEnv* env, jobject, jlong canvasHandle, jlong bitma if (paint) { filteredPaint = *paint; } - filteredPaint.setFilterLevel(Paint::kLow_FilterLevel); + filteredPaint.setFilterQuality(kLow_SkFilterQuality); canvas->drawBitmap(*bitmap, srcLeft, srcTop, srcRight, srcBottom, dstLeft, dstTop, dstRight, dstBottom, &filteredPaint); } else { diff --git a/libs/hwui/utils/PaintUtils.h b/libs/hwui/utils/PaintUtils.h index 1a5cbf8..ba02f5f 100644 --- a/libs/hwui/utils/PaintUtils.h +++ b/libs/hwui/utils/PaintUtils.h @@ -38,7 +38,7 @@ public: } static inline GLenum getFilter(const SkPaint* paint) { - if (!paint || paint->getFilterLevel() != SkPaint::kNone_FilterLevel) { + if (!paint || paint->getFilterQuality() != kNone_SkFilterQuality) { return GL_LINEAR; } return GL_NEAREST; |