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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/ImagePainter.h" 6 #include "core/paint/ImagePainter.h"
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/editing/FrameSelection.h" 10 #include "core/editing/FrameSelection.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 InspectorInstrumentation::willPaintImage(&m_renderImage); 193 InspectorInstrumentation::willPaintImage(&m_renderImage);
194 194
195 InterpolationQuality previousInterpolationQuality = context->imageInterpolat ionQuality(); 195 InterpolationQuality previousInterpolationQuality = context->imageInterpolat ionQuality();
196 context->setImageInterpolationQuality(interpolationQuality); 196 context->setImageInterpolationQuality(interpolationQuality);
197 context->drawImage(image.get(), alignedRect, CompositeSourceOver, m_renderIm age.shouldRespectImageOrientation()); 197 context->drawImage(image.get(), alignedRect, CompositeSourceOver, m_renderIm age.shouldRespectImageOrientation());
198 context->setImageInterpolationQuality(previousInterpolationQuality); 198 context->setImageInterpolationQuality(previousInterpolationQuality);
199 199
200 InspectorInstrumentation::didPaintImage(&m_renderImage); 200 InspectorInstrumentation::didPaintImage(&m_renderImage);
201 } 201 }
202 202
203 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.
204
203 void ImagePainter::paintBoxDecorationBackground(PaintInfo& paintInfo, const Layo utPoint& paintOffset) 205 void ImagePainter::paintBoxDecorationBackground(PaintInfo& paintInfo, const Layo utPoint& paintOffset)
204 { 206 {
205 // Don't anti-alias the background of an image. See crbug.com/423834 for the reason why. 207 // Don't anti-alias the background of an image. See crbug.com/423834 for the reason why.
206 // However, don't turn off anti-aliasing for subclasses such as video. 208 // However, don't turn off anti-aliasing for subclasses such as video.
207 bool shouldAntialias = !m_renderImage.isRenderImage(); 209 // An additional mega-hack here is to turn off anti-aliasing only for situat ions with a large device scale factor
210 // The referenced bug gives more details about a device with a scale factor greater than 3.4).
211 bool shouldAntialias = !m_renderImage.isRenderImage() || blink::deviceScaleF actor(m_renderImage.frame()) < 3.4;
208 212
209 bool oldShouldAntialias = paintInfo.context->shouldAntialias(); 213 bool oldShouldAntialias = paintInfo.context->shouldAntialias();
210
211 paintInfo.context->setShouldAntialias(shouldAntialias); 214 paintInfo.context->setShouldAntialias(shouldAntialias);
212 BoxPainter(m_renderImage).paintBoxDecorationBackground(paintInfo, paintOffse t); 215 BoxPainter(m_renderImage).paintBoxDecorationBackground(paintInfo, paintOffse t);
216
213 paintInfo.context->setShouldAntialias(oldShouldAntialias); 217 paintInfo.context->setShouldAntialias(oldShouldAntialias);
214 } 218 }
215 219
216 } // namespace blink 220 } // namespace blink
OLDNEW
« 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