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

Unified Diff: Source/platform/graphics/GraphicsContext.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/GraphicsContext.cpp
diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp
index 9f62b29a780eb6f06ee663c9839aeaec46aa7def..db62b8c5886660e6ddc880727b5fa4b783b4fbe5 100644
--- a/Source/platform/graphics/GraphicsContext.cpp
+++ b/Source/platform/graphics/GraphicsContext.cpp
@@ -1027,16 +1027,16 @@ void GraphicsContext::drawImage(Image* image, const IntPoint& p, CompositeOperat
drawImage(image, FloatRect(IntRect(p, image->size())), FloatRect(FloatPoint(), FloatSize(image->size())), op, shouldRespectImageOrientation);
}
-void GraphicsContext::drawImage(Image* image, const IntRect& r, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
+void GraphicsContext::drawImage(Image* image, const IntRect& r, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, InterpolationQuality interpolationQuality)
{
if (!image)
return;
- drawImage(image, FloatRect(r), FloatRect(FloatPoint(), FloatSize(image->size())), op, shouldRespectImageOrientation, useLowQualityScale);
+ drawImage(image, FloatRect(r), FloatRect(FloatPoint(), FloatSize(image->size())), op, shouldRespectImageOrientation, interpolationQuality);
}
-void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
+void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, InterpolationQuality interpolationQuality)
{
- drawImage(image, dest, src, op, blink::WebBlendModeNormal, shouldRespectImageOrientation, useLowQualityScale);
+ drawImage(image, dest, src, op, blink::WebBlendModeNormal, shouldRespectImageOrientation, interpolationQuality);
}
void GraphicsContext::drawImage(Image* image, const FloatRect& dest)
@@ -1046,31 +1046,29 @@ void GraphicsContext::drawImage(Image* image, const FloatRect& dest)
drawImage(image, dest, FloatRect(IntRect(IntPoint(), image->size())));
}
-void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op, WebBlendMode blendMode, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
-{ if (paintingDisabled() || !image)
+void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op, WebBlendMode blendMode, RespectImageOrientationEnum shouldRespectImageOrientation, InterpolationQuality interpolationQuality)
+{
+ if (paintingDisabled() || !image)
return;
- InterpolationQuality previousInterpolationQuality = InterpolationDefault;
-
- if (useLowQualityScale) {
- previousInterpolationQuality = imageInterpolationQuality();
- setImageInterpolationQuality(InterpolationLow);
- }
-
- image->draw(this, dest, src, op, blendMode, shouldRespectImageOrientation);
-
- if (useLowQualityScale)
+ if (interpolationQuality != InterpolationDefault) {
Stephen White 2014/03/18 17:26:43 Shouldn't this check be against imageInterpolation
Alpha Left Google 2014/03/18 22:59:13 Done.
+ InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
+ setImageInterpolationQuality(interpolationQuality);
+ image->draw(this, dest, src, op, blendMode, shouldRespectImageOrientation);
setImageInterpolationQuality(previousInterpolationQuality);
+ } else {
+ image->draw(this, dest, src, op, blendMode, shouldRespectImageOrientation);
+ }
}
-void GraphicsContext::drawTiledImage(Image* image, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLowQualityScale, WebBlendMode blendMode, const IntSize& repeatSpacing)
+void GraphicsContext::drawTiledImage(Image* image, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, InterpolationQuality interpolationQuality, WebBlendMode blendMode, const IntSize& repeatSpacing)
{
if (paintingDisabled() || !image)
return;
- if (useLowQualityScale) {
+ if (interpolationQuality != InterpolationDefault) {
Stephen White 2014/03/18 17:26:43 Same here.
Alpha Left Google 2014/03/18 22:59:13 Done.
InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
- setImageInterpolationQuality(InterpolationLow);
+ setImageInterpolationQuality(interpolationQuality);
image->drawTiled(this, destRect, srcPoint, tileSize, op, blendMode, repeatSpacing);
setImageInterpolationQuality(previousInterpolationQuality);
} else {
@@ -1079,7 +1077,7 @@ void GraphicsContext::drawTiledImage(Image* image, const IntRect& destRect, cons
}
void GraphicsContext::drawTiledImage(Image* image, const IntRect& dest, const IntRect& srcRect,
- const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op, bool useLowQualityScale)
+ const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op, InterpolationQuality interpolationQuality)
{
if (paintingDisabled() || !image)
return;
@@ -1090,9 +1088,9 @@ void GraphicsContext::drawTiledImage(Image* image, const IntRect& dest, const In
return;
}
- if (useLowQualityScale) {
+ if (interpolationQuality != InterpolationDefault) {
Stephen White 2014/03/18 17:26:43 Same here.
Alpha Left Google 2014/03/18 22:59:13 Done.
InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
- setImageInterpolationQuality(InterpolationLow);
+ setImageInterpolationQuality(interpolationQuality);
image->drawTiled(this, dest, srcRect, tileScaleFactor, hRule, vRule, op);
setImageInterpolationQuality(previousInterpolationQuality);
} else {
@@ -1107,11 +1105,11 @@ void GraphicsContext::drawImageBuffer(ImageBuffer* image, const IntPoint& p, Com
drawImageBuffer(image, FloatRect(IntRect(p, image->size())), FloatRect(FloatPoint(), FloatSize(image->size())), op, blendMode);
}
-void GraphicsContext::drawImageBuffer(ImageBuffer* image, const IntRect& r, CompositeOperator op, WebBlendMode blendMode, bool useLowQualityScale)
+void GraphicsContext::drawImageBuffer(ImageBuffer* image, const IntRect& r, CompositeOperator op, WebBlendMode blendMode, InterpolationQuality interpolationQuality)
{
if (!image)
return;
- drawImageBuffer(image, FloatRect(r), FloatRect(FloatPoint(), FloatSize(image->size())), op, blendMode, useLowQualityScale);
+ drawImageBuffer(image, FloatRect(r), FloatRect(FloatPoint(), FloatSize(image->size())), op, blendMode, interpolationQuality);
}
void GraphicsContext::drawImageBuffer(ImageBuffer* image, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op, WebBlendMode blendMode)
@@ -1119,9 +1117,9 @@ void GraphicsContext::drawImageBuffer(ImageBuffer* image, const IntPoint& dest,
drawImageBuffer(image, FloatRect(IntRect(dest, srcRect.size())), FloatRect(srcRect), op, blendMode);
}
-void GraphicsContext::drawImageBuffer(ImageBuffer* image, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, WebBlendMode blendMode, bool useLowQualityScale)
+void GraphicsContext::drawImageBuffer(ImageBuffer* image, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, WebBlendMode blendMode, InterpolationQuality interpolationQuality)
{
- drawImageBuffer(image, FloatRect(dest), FloatRect(srcRect), op, blendMode, useLowQualityScale);
+ drawImageBuffer(image, FloatRect(dest), FloatRect(srcRect), op, blendMode, interpolationQuality);
}
void GraphicsContext::drawImageBuffer(ImageBuffer* image, const FloatRect& dest)
@@ -1131,18 +1129,18 @@ void GraphicsContext::drawImageBuffer(ImageBuffer* image, const FloatRect& dest)
drawImageBuffer(image, dest, FloatRect(IntRect(IntPoint(), image->size())));
}
-void GraphicsContext::drawImageBuffer(ImageBuffer* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op, WebBlendMode blendMode, bool useLowQualityScale)
+void GraphicsContext::drawImageBuffer(ImageBuffer* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op, WebBlendMode blendMode, InterpolationQuality interpolationQuality)
{
if (paintingDisabled() || !image)
return;
- if (useLowQualityScale) {
+ if (interpolationQuality != InterpolationDefault) {
Stephen White 2014/03/18 17:26:43 Same here. (Tangentially, I wonder if these functi
Alpha Left Google 2014/03/18 22:59:13 Done. Yeah I'll leave that refactoring as a separa
InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
- setImageInterpolationQuality(InterpolationLow);
- image->draw(this, dest, src, op, blendMode, useLowQualityScale);
+ setImageInterpolationQuality(interpolationQuality);
+ image->draw(this, dest, src, op, blendMode, interpolationQuality);
Stephen White 2014/03/18 17:26:43 (Not new to this patch, but it seems odd that we h
Alpha Left Google 2014/03/18 22:59:13 Indeed. :(
setImageInterpolationQuality(previousInterpolationQuality);
} else {
- image->draw(this, dest, src, op, blendMode, useLowQualityScale);
+ image->draw(this, dest, src, op, blendMode, interpolationQuality);
}
}

Powered by Google App Engine
This is Rietveld 408576698