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

Unified Diff: Source/core/rendering/ImageQualityController.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/core/rendering/ImageQualityController.cpp
diff --git a/Source/core/rendering/ImageQualityController.cpp b/Source/core/rendering/ImageQualityController.cpp
index c9bdae70ea909590f357431089115d51c5025062..bd15ed251b6afe2c0e8adf1ec166d627bb8b4d10 100644
--- a/Source/core/rendering/ImageQualityController.cpp
+++ b/Source/core/rendering/ImageQualityController.cpp
@@ -60,6 +60,18 @@ void ImageQualityController::remove(RenderObject* renderer)
}
}
+InterpolationQuality ImageQualityController::chooseInterpolationQuality(GraphicsContext* context, RenderObject* object, Image* image, const void* layer, const LayoutSize& layoutSize)
+{
+ if (shouldPaintAtLowQuality(context, object, image, layer, layoutSize))
+ return InterpolationLow;
Stephen White 2014/03/18 17:26:43 We actually might want to consider using Medium he
Alpha Left Google 2014/03/18 22:59:13 That's right. We can update that later.
+
+ // For images that are potentially animated we paint them at low quality.
Stephen Chennney 2014/03/18 12:56:32 This comment doesn't seem to match the code. Is th
Alpha Left Google 2014/03/18 22:59:13 The code is correct. I've updated the comments.
+ if (image && image->maybeAnimated())
+ return InterpolationMedium;
+
+ return InterpolationDefault;
+}
+
ImageQualityController::~ImageQualityController()
{
// This will catch users of ImageQualityController that forget to call cleanUp.
@@ -137,10 +149,6 @@ bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, R
if (object->style()->imageRendering() == ImageRenderingOptimizeContrast)
return true;
- // For images that are potentially animated we paint them at low quality.
- if (image->maybeAnimated())
- return true;
-
// Look ourselves up in the hashtables.
ObjectLayerSizeMap::iterator i = m_objectLayerSizeMap.find(object);
LayerSizeMap* innerMap = i != m_objectLayerSizeMap.end() ? &i->value : 0;

Powered by Google App Engine
This is Rietveld 408576698