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

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

Issue 733583003: Don't turn off anti-aliasing for image backgrounds unless the device scale factor is large enough. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/ImagePainter.cpp
diff --git a/Source/core/paint/ImagePainter.cpp b/Source/core/paint/ImagePainter.cpp
index 04ebee1f5e6d0eee700066c2648c8239f05b760e..e4760e338f10fd54c9401a89a3bf9ed3e5dc6a30 100644
--- a/Source/core/paint/ImagePainter.cpp
+++ b/Source/core/paint/ImagePainter.cpp
@@ -200,16 +200,20 @@ void ImagePainter::paintIntoRect(GraphicsContext* context, const LayoutRect& rec
InspectorInstrumentation::didPaintImage(&m_renderImage);
}
+float deviceScaleFactor(LocalFrame*);
jbroman 2014/11/14 19:13:47 drive-by: Why not include Page.h? Declaring extern
enne (OOO) 2014/11/14 19:15:59 What is this, an extern? Maybe you should just add
chrishtr 2014/11/14 19:16:09 Done.
+
void ImagePainter::paintBoxDecorationBackground(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
// Don't anti-alias the background of an image. See crbug.com/423834 for the reason why.
// However, don't turn off anti-aliasing for subclasses such as video.
- bool shouldAntialias = !m_renderImage.isRenderImage();
+ // An additional mega-hack here is to turn off anti-aliasing only for situations with a large device scale factor
+ // The referenced bug gives more details about a device with a scale factor greater than 3.4).
+ bool shouldAntialias = !m_renderImage.isRenderImage() || blink::deviceScaleFactor(m_renderImage.frame()) < 3.4;
bool oldShouldAntialias = paintInfo.context->shouldAntialias();
-
paintInfo.context->setShouldAntialias(shouldAntialias);
BoxPainter(m_renderImage).paintBoxDecorationBackground(paintInfo, paintOffset);
+
paintInfo.context->setShouldAntialias(oldShouldAntialias);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698