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

Unified Diff: third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp

Issue 2157953002: Change filter quality when scaling-down in drawImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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: third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp b/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp
index 8cd5c8c4f16f6ccc7b3951eb34c3c55f0a986c51..7aa2382a06e2f04b945e8d991bcdaec41c10ddd8 100644
--- a/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp
@@ -32,7 +32,7 @@
namespace blink {
void GradientGeneratedImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& destRect,
- const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode)
+ const FloatRect& srcRect, bool imageSmoothingEnabled, RespectImageOrientationEnum, ImageClampingMode)
{
SkRect visibleSrcRect = srcRect;
if (!visibleSrcRect.intersect(SkRect::MakeIWH(m_size.width(), m_size.height())))
@@ -44,6 +44,10 @@ void GradientGeneratedImage::draw(SkCanvas* canvas, const SkPaint& paint, const
SkPaint gradientPaint(paint);
m_gradient->applyToPaint(gradientPaint, transform);
+
+ if (!imageSmoothingEnabled && Image::isDrawScalingDown(visibleSrcRect, visibleDestRect))
+ gradientPaint.setFilterQuality(kLow_SkFilterQuality);
+
canvas->drawRect(visibleDestRect, gradientPaint);
}

Powered by Google App Engine
This is Rietveld 408576698