Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: Source/platform/graphics/skia/NativeImageSkia.cpp

Issue 201513003: Implement InterpolationMedium to filter animated images (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/platform/graphics/skia/NativeImageSkia.cpp
diff --git a/Source/platform/graphics/skia/NativeImageSkia.cpp b/Source/platform/graphics/skia/NativeImageSkia.cpp
index a963e3e14b50cdf6b0063eddd972d4914828345a..539950d32864b58eee3896ffd69c4172ada26107 100644
--- a/Source/platform/graphics/skia/NativeImageSkia.cpp
+++ b/Source/platform/graphics/skia/NativeImageSkia.cpp
@@ -144,13 +144,14 @@ static ResamplingMode limitResamplingMode(GraphicsContext* context, ResamplingMo
case InterpolationNone:
return NoResampling;
case InterpolationMedium:
- // For now we treat InterpolationMedium and InterpolationLow the same.
- case InterpolationLow:
if (resampling == AwesomeResampling)
+ return MediumResampling;
+ break;
+ case InterpolationLow:
+ if (resampling == AwesomeResampling || resampling == MediumResampling)
return LinearResampling;
break;
case InterpolationHigh:
- case InterpolationDefault:
Stephen Chennney 2014/03/18 12:56:32 I think you'll get build errors due to enum not in
Alpha Left Google 2014/03/18 22:59:13 Actually this is correct since InterpolationDefaul
break;
}
@@ -353,7 +354,6 @@ void NativeImageSkia::draw(GraphicsContext* context, const SkRect& srcRect, cons
resampling = LinearResampling;
}
resampling = limitResamplingMode(context, resampling);
- paint.setFilterBitmap(resampling == LinearResampling);
bool isLazyDecoded = DeferredImageDecoder::isLazyDecoded(bitmap());
// FIXME: Bicubic filtering in Skia is only applied to defer-decoded images
@@ -363,6 +363,12 @@ void NativeImageSkia::draw(GraphicsContext* context, const SkRect& srcRect, cons
if (useBicubicFilter)
paint.setFilterLevel(SkPaint::kHigh_FilterLevel);
+ else if (resampling == MediumResampling)
Stephen White 2014/03/18 17:26:43 I'd suggest to refactor this out into a helper fun
Alpha Left Google 2014/03/18 22:59:13 Done.
+ paint.setFilterLevel(SkPaint::kMedium_FilterLevel);
+ else if (resampling == LinearResampling)
+ paint.setFilterLevel(SkPaint::kLow_FilterLevel);
+ else
+ paint.setFilterLevel(SkPaint::kNone_FilterLevel);
if (resampling == AwesomeResampling && !useBicubicFilter) {
// Resample the image and then draw the result to canvas with bilinear
@@ -497,9 +503,14 @@ void NativeImageSkia::drawPattern(
paint.setXfermode(WebCoreCompositeToSkiaComposite(compositeOp, blendMode).get());
paint.setColorFilter(context->colorFilter());
- paint.setFilterBitmap(resampling == LinearResampling);
if (useBicubicFilter)
paint.setFilterLevel(SkPaint::kHigh_FilterLevel);
+ else if (resampling == MediumResampling)
+ paint.setFilterLevel(SkPaint::kMedium_FilterLevel);
+ else if (resampling == LinearResampling)
+ paint.setFilterLevel(SkPaint::kLow_FilterLevel);
+ else
+ paint.setFilterLevel(SkPaint::kNone_FilterLevel);
if (isLazyDecoded)
PlatformInstrumentation::didDrawLazyPixelRef(bitmap().getGenerationID());

Powered by Google App Engine
This is Rietveld 408576698