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

Unified Diff: Source/core/paint/HTMLCanvasPainter.cpp

Issue 754083003: Make image-rendering:pixelated use nearest neighbor when downscaling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Sync and rebase Created 6 years 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/paint/HTMLCanvasPainter.cpp
diff --git a/Source/core/paint/HTMLCanvasPainter.cpp b/Source/core/paint/HTMLCanvasPainter.cpp
index 236f7b6083a66991cec3667e6849b1f9f83f88e2..e5180e0cf62dc85c22716d2c566653d888304009 100644
--- a/Source/core/paint/HTMLCanvasPainter.cpp
+++ b/Source/core/paint/HTMLCanvasPainter.cpp
@@ -32,18 +32,13 @@ void HTMLCanvasPainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPo
// FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast is set.
// See bug for more details: crbug.com/353716.
InterpolationQuality interpolationQuality = m_renderHTMLCanvas.style()->imageRendering() == ImageRenderingOptimizeContrast ? InterpolationLow : CanvasDefaultInterpolationQuality;
-
- HTMLCanvasElement* canvas = toHTMLCanvasElement(m_renderHTMLCanvas.node());
- LayoutSize layoutSize = contentRect.size();
- if (m_renderHTMLCanvas.style()->imageRendering() == ImageRenderingPixelated
- && (layoutSize.width() > canvas->width() || layoutSize.height() > canvas->height() || layoutSize == canvas->size())) {
+ if (m_renderHTMLCanvas.style()->imageRendering() == ImageRenderingPixelated)
interpolationQuality = InterpolationNone;
- }
RenderDrawingRecorder recorder(context, &m_renderHTMLCanvas, localPaintInfo.phase, pixelSnappedIntRect(paintRect));
InterpolationQuality previousInterpolationQuality = context->imageInterpolationQuality();
context->setImageInterpolationQuality(interpolationQuality);
- canvas->paint(context, paintRect);
+ toHTMLCanvasElement(m_renderHTMLCanvas.node())->paint(context, paintRect);
context->setImageInterpolationQuality(previousInterpolationQuality);
}
« no previous file with comments | « LayoutTests/css3/images/resources/radial-lines.png ('k') | Source/core/rendering/ImageQualityController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698