<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[195848] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/195848">195848</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-01-29 15:15:58 -0800 (Fri, 29 Jan 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>image-rendering: -webkit-optimize-contrast not working for background images
https://bugs.webkit.org/show_bug.cgi?id=97991
Reviewed by Darin Adler.
Source/WebCore:
Don't equate "pixelated" and "crisp-edges" values for image-rendering with low
quality scaling; they should map to InterpolationNone, not InterpolationLow.
To support this change ImageQualityController to return a InterpolationQuality
from the renamed chooseInterpolationQuality(). If the returned value is not
InterpolationDefault, set the GraphicsContext image interpolation when drawing
images and image buffers.
Remove the redundant "useLowQualityScale" from
Test: fast/images/image-rendering-interpolation.html
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::paint):
* html/HTMLCanvasElement.h:
* page/DragController.cpp:
(WebCore::DragController::doImageDrag):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawTiledImage):
(WebCore::GraphicsContext::drawImageBuffer):
(WebCore::GraphicsContext::drawConsumingImageBuffer):
(WebCore::InterpolationQualityMaintainer::InterpolationQualityMaintainer): Deleted.
(WebCore::InterpolationQualityMaintainer::~InterpolationQualityMaintainer): Deleted.
* platform/graphics/GraphicsContext.h:
(WebCore::ImagePaintingOptions::ImagePaintingOptions):
(WebCore::ImagePaintingOptions::usesDefaultInterpolation):
(WebCore::InterpolationQualityMaintainer::InterpolationQualityMaintainer):
(WebCore::InterpolationQualityMaintainer::~InterpolationQualityMaintainer):
* platform/graphics/GraphicsTypes.h:
* platform/graphics/ImageBuffer.h:
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::drawConsuming):
(WebCore::ImageBuffer::draw):
* rendering/ImageQualityController.cpp:
(WebCore::ImageQualityController::interpolationQualityFromStyle):
(WebCore::ImageQualityController::chooseInterpolationQuality):
(WebCore::ImageQualityController::ImageQualityController): Deleted.
(WebCore::ImageQualityController::shouldPaintAtLowQuality): Deleted.
* rendering/ImageQualityController.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::chooseInterpolationQuality):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::shouldPaintAtLowQuality): Deleted.
* rendering/RenderBoxModelObject.h:
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::paintSnapshotImage):
* rendering/RenderHTMLCanvas.cpp:
(WebCore::RenderHTMLCanvas::paintReplaced):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintIntoRect):
* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::paintSnapshot):
* rendering/style/RenderStyle.h:
LayoutTests:
* fast/images/image-rendering-interpolation-expected.html: Added.
* fast/images/image-rendering-interpolation.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLCanvasElementcpp">trunk/Source/WebCore/html/HTMLCanvasElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLCanvasElementh">trunk/Source/WebCore/html/HTMLCanvasElement.h</a></li>
<li><a href="#trunkSourceWebCorepageDragControllercpp">trunk/Source/WebCore/page/DragController.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContextcpp">trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContexth">trunk/Source/WebCore/platform/graphics/GraphicsContext.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsTypesh">trunk/Source/WebCore/platform/graphics/GraphicsTypes.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsImageBufferh">trunk/Source/WebCore/platform/graphics/ImageBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoImageBufferCairocpp">trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgImageBufferCGcpp">trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingImageQualityControllercpp">trunk/Source/WebCore/rendering/ImageQualityController.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingImageQualityControllerh">trunk/Source/WebCore/rendering/ImageQualityController.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjectcpp">trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjecth">trunk/Source/WebCore/rendering/RenderBoxModelObject.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderEmbeddedObjectcpp">trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderHTMLCanvascpp">trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderImagecpp">trunk/Source/WebCore/rendering/RenderImage.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderSnapshottedPlugIncpp">trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Source/WebCore/rendering/style/RenderStyle.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastimagesimagerenderinginterpolationexpectedhtml">trunk/LayoutTests/fast/images/image-rendering-interpolation-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesimagerenderinginterpolationhtml">trunk/LayoutTests/fast/images/image-rendering-interpolation.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/LayoutTests/ChangeLog        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-01-29 Simon Fraser <simon.fraser@apple.com>
+
+ image-rendering: -webkit-optimize-contrast not working for background images
+ https://bugs.webkit.org/show_bug.cgi?id=97991
+
+ Reviewed by Darin Adler.
+
+ * fast/images/image-rendering-interpolation-expected.html: Added.
+ * fast/images/image-rendering-interpolation.html: Added.
+
</ins><span class="cx"> 2016-01-29 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> Modern IDB: storage/indexeddb/modern/index-3.html fails.
</span></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagerenderinginterpolationexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-rendering-interpolation-expected.html (0 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-rendering-interpolation-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/images/image-rendering-interpolation-expected.html        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .clipper {
+ display: inline-block;
+ margin: 2px;
+ height: 100px;
+ width: 100px;
+ overflow: hidden;
+ border: 1px solid black;
+ }
+ img {
+ height: 1100px;
+ width: 1100px;
+ }
+
+ .backgrounder {
+ height: 1100px;
+ width: 1100px;
+ background-image: url('resources/grid-small.png');
+ background-size: 100%;
+ }
+ </style>
+</head>
+<body>
+
+<div class="clipper">
+ <img src="resources/grid-small.png" width="11" height="11">
+</div>
+
+<div class="clipper">
+</div>
+
+<div class="clipper">
+</div>
+
+<div class="clipper">
+ <div class="backgrounder"></div>
+</div>
+
+<div class="clipper">
+</div>
+
+<div class="clipper">
+</div>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagerenderinginterpolationhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-rendering-interpolation.html (0 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-rendering-interpolation.html         (rev 0)
+++ trunk/LayoutTests/fast/images/image-rendering-interpolation.html        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .clipper {
+ display: inline-block;
+ margin: 2px;
+ height: 100px;
+ width: 100px;
+ overflow: hidden;
+ border: 1px solid black;
+ }
+ img {
+ image-rendering: pixelated;
+ height: 1100px;
+ width: 1100px;
+ }
+
+ .backgrounder {
+ height: 1100px;
+ width: 1100px;
+ background-image: url('resources/grid-small.png');
+ background-size: 100%;
+ }
+ </style>
+</head>
+<body>
+
+<div class="clipper">
+ <img src="resources/grid-small.png" width="11" height="11" style="image-rendering: auto;">
+</div>
+
+<div class="clipper">
+ <img src="resources/grid-small.png" width="11" height="11" style="image-rendering: pixelated;">
+</div>
+
+<div class="clipper">
+ <img src="resources/grid-small.png" width="11" height="11" style="image-rendering: crisp-edges;">
+</div>
+
+<div class="clipper">
+ <div class="backgrounder" style="image-rendering: auto;"></div>
+</div>
+
+<div class="clipper">
+ <div class="backgrounder" style="image-rendering: pixelated;"></div>
+</div>
+
+<div class="clipper">
+ <div class="backgrounder" style="image-rendering: crisp-edges;"></div>
+</div>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/ChangeLog        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2016-01-29 Simon Fraser <simon.fraser@apple.com>
+
+ image-rendering: -webkit-optimize-contrast not working for background images
+ https://bugs.webkit.org/show_bug.cgi?id=97991
+
+ Reviewed by Darin Adler.
+
+ Don't equate "pixelated" and "crisp-edges" values for image-rendering with low
+ quality scaling; they should map to InterpolationNone, not InterpolationLow.
+
+ To support this change ImageQualityController to return a InterpolationQuality
+ from the renamed chooseInterpolationQuality(). If the returned value is not
+ InterpolationDefault, set the GraphicsContext image interpolation when drawing
+ images and image buffers.
+
+ Remove the redundant "useLowQualityScale" from
+
+ Test: fast/images/image-rendering-interpolation.html
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::paint):
+ * html/HTMLCanvasElement.h:
+ * page/DragController.cpp:
+ (WebCore::DragController::doImageDrag):
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::drawImage):
+ (WebCore::GraphicsContext::drawTiledImage):
+ (WebCore::GraphicsContext::drawImageBuffer):
+ (WebCore::GraphicsContext::drawConsumingImageBuffer):
+ (WebCore::InterpolationQualityMaintainer::InterpolationQualityMaintainer): Deleted.
+ (WebCore::InterpolationQualityMaintainer::~InterpolationQualityMaintainer): Deleted.
+ * platform/graphics/GraphicsContext.h:
+ (WebCore::ImagePaintingOptions::ImagePaintingOptions):
+ (WebCore::ImagePaintingOptions::usesDefaultInterpolation):
+ (WebCore::InterpolationQualityMaintainer::InterpolationQualityMaintainer):
+ (WebCore::InterpolationQualityMaintainer::~InterpolationQualityMaintainer):
+ * platform/graphics/GraphicsTypes.h:
+ * platform/graphics/ImageBuffer.h:
+ * platform/graphics/cg/ImageBufferCG.cpp:
+ (WebCore::ImageBuffer::drawConsuming):
+ (WebCore::ImageBuffer::draw):
+ * rendering/ImageQualityController.cpp:
+ (WebCore::ImageQualityController::interpolationQualityFromStyle):
+ (WebCore::ImageQualityController::chooseInterpolationQuality):
+ (WebCore::ImageQualityController::ImageQualityController): Deleted.
+ (WebCore::ImageQualityController::shouldPaintAtLowQuality): Deleted.
+ * rendering/ImageQualityController.h:
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::chooseInterpolationQuality):
+ (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+ (WebCore::RenderBoxModelObject::shouldPaintAtLowQuality): Deleted.
+ * rendering/RenderBoxModelObject.h:
+ * rendering/RenderEmbeddedObject.cpp:
+ (WebCore::RenderEmbeddedObject::paintSnapshotImage):
+ * rendering/RenderHTMLCanvas.cpp:
+ (WebCore::RenderHTMLCanvas::paintReplaced):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::paintIntoRect):
+ * rendering/RenderSnapshottedPlugIn.cpp:
+ (WebCore::RenderSnapshottedPlugIn::paintSnapshot):
+ * rendering/style/RenderStyle.h:
+
</ins><span class="cx"> 2016-01-29 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> Modern IDB: storage/indexeddb/modern/index-3.html fails.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCanvasElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -403,7 +403,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>-void HTMLCanvasElement::paint(GraphicsContext& context, const LayoutRect& r, bool useLowQualityScale)
</del><ins>+void HTMLCanvasElement::paint(GraphicsContext& context, const LayoutRect& r)
</ins><span class="cx"> {
</span><span class="cx"> // Clear the dirty rect
</span><span class="cx"> m_dirtyRect = FloatRect();
</span><span class="lines">@@ -426,9 +426,9 @@
</span><span class="cx"> #if ENABLE(CSS_IMAGE_ORIENTATION)
</span><span class="cx"> orientationDescription.setImageOrientationEnum(renderer()->style().imageOrientation());
</span><span class="cx"> #endif
</span><del>- context.drawImage(*m_presentedImage, snappedIntRect(r), ImagePaintingOptions(orientationDescription, useLowQualityScale));
</del><ins>+ context.drawImage(*m_presentedImage, snappedIntRect(r), ImagePaintingOptions(orientationDescription));
</ins><span class="cx"> } else
</span><del>- context.drawImageBuffer(*imageBuffer, snappedIntRect(r), useLowQualityScale);
</del><ins>+ context.drawImageBuffer(*imageBuffer, snappedIntRect(r));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCanvasElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCanvasElement.h        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx"> void didDraw(const FloatRect&);
</span><span class="cx"> void notifyObserversCanvasChanged(const FloatRect&);
</span><span class="cx">
</span><del>- void paint(GraphicsContext&, const LayoutRect&, bool useLowQualityScale = false);
</del><ins>+ void paint(GraphicsContext&, const LayoutRect&);
</ins><span class="cx">
</span><span class="cx"> GraphicsContext* drawingContext() const;
</span><span class="cx"> GraphicsContext* existingDrawingContext() const;
</span></span></pre></div>
<a id="trunkSourceWebCorepageDragControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragController.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragController.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/page/DragController.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -935,10 +935,7 @@
</span><span class="cx"> if (!element.renderer())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- ImageOrientationDescription orientationDescription(element.renderer()->shouldRespectImageOrientation());
-#if ENABLE(CSS_IMAGE_ORIENTATION)
- orientationDescription.setImageOrientationEnum(element.renderer()->style().imageOrientation());
-#endif
</del><ins>+ ImageOrientationDescription orientationDescription(element.renderer()->shouldRespectImageOrientation(), element.renderer()->style().imageOrientation());
</ins><span class="cx">
</span><span class="cx"> Image* image = getImage(element);
</span><span class="cx"> if (image && image->size().height() * image->size().width() <= MaxOriginalImageArea
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -77,30 +77,6 @@
</span><span class="cx"> unsigned m_offset;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-class InterpolationQualityMaintainer {
-public:
- explicit InterpolationQualityMaintainer(GraphicsContext& graphicsContext, InterpolationQuality interpolationQualityToUse)
- : m_graphicsContext(graphicsContext)
- , m_currentInterpolationQuality(graphicsContext.imageInterpolationQuality())
- , m_interpolationQualityChanged(m_currentInterpolationQuality != interpolationQualityToUse)
- {
- if (m_interpolationQualityChanged)
- m_graphicsContext.setImageInterpolationQuality(interpolationQualityToUse);
- }
-
- ~InterpolationQualityMaintainer()
- {
- if (m_interpolationQualityChanged)
- m_graphicsContext.setImageInterpolationQuality(m_currentInterpolationQuality);
- }
-
-private:
- GraphicsContext& m_graphicsContext;
- InterpolationQuality m_currentInterpolationQuality;
- bool m_interpolationQualityChanged;
-};
-
-
</del><span class="cx"> #define CHECK_FOR_CHANGED_PROPERTY(flag, property) \
</span><span class="cx"> if ((m_changeFlags & GraphicsContextState::flag) && (m_state.property != state.property)) \
</span><span class="cx"> changeFlags |= GraphicsContextState::flag;
</span><span class="lines">@@ -767,7 +743,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationLow : imageInterpolationQuality());
</del><ins>+ InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
</ins><span class="cx"> image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_orientationDescription);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -781,7 +757,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationLow : imageInterpolationQuality());
</del><ins>+ InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
</ins><span class="cx"> image.drawTiled(*this, destination, source, tileSize, spacing, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -802,7 +778,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationLow : imageInterpolationQuality());
</del><ins>+ InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
</ins><span class="cx"> image.drawTiled(*this, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions.m_compositeOperator);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -821,8 +797,8 @@
</span><span class="cx"> if (paintingDisabled())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationLow : imageInterpolationQuality());
- image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_useLowQualityScale);
</del><ins>+ InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
+ image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void GraphicsContext::drawConsumingImageBuffer(std::unique_ptr<ImageBuffer> image, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions)
</span><span class="lines">@@ -846,9 +822,8 @@
</span><span class="cx"> if (paintingDisabled() || !image)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationLow : imageInterpolationQuality());
-
- ImageBuffer::drawConsuming(WTFMove(image), *this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_useLowQualityScale);
</del><ins>+ InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
+ ImageBuffer::drawConsuming(WTFMove(image), *this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void GraphicsContext::clipRoundedRect(const FloatRoundedRect& rect)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -102,14 +102,6 @@
</span><span class="cx"> WavyStroke,
</span><span class="cx"> };
</span><span class="cx">
</span><del>-enum InterpolationQuality {
- InterpolationDefault,
- InterpolationNone,
- InterpolationLow,
- InterpolationMedium,
- InterpolationHigh
-};
-
</del><span class="cx"> namespace DisplayList {
</span><span class="cx"> class Recorder;
</span><span class="cx"> }
</span><span class="lines">@@ -194,34 +186,36 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> struct ImagePaintingOptions {
</span><del>- ImagePaintingOptions(CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), bool useLowQualityScale = false)
</del><ins>+ ImagePaintingOptions(CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), InterpolationQuality interpolationQuality = InterpolationDefault)
</ins><span class="cx"> : m_compositeOperator(compositeOperator)
</span><span class="cx"> , m_blendMode(blendMode)
</span><span class="cx"> , m_orientationDescription(orientationDescription)
</span><del>- , m_useLowQualityScale(useLowQualityScale)
</del><ins>+ , m_interpolationQuality(interpolationQuality)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ImagePaintingOptions(ImageOrientationDescription orientationDescription, bool useLowQualityScale = false, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal)
</del><ins>+ ImagePaintingOptions(ImageOrientationDescription orientationDescription, InterpolationQuality interpolationQuality = InterpolationDefault, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal)
</ins><span class="cx"> : m_compositeOperator(compositeOperator)
</span><span class="cx"> , m_blendMode(blendMode)
</span><span class="cx"> , m_orientationDescription(orientationDescription)
</span><del>- , m_useLowQualityScale(useLowQualityScale)
</del><ins>+ , m_interpolationQuality(interpolationQuality)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ImagePaintingOptions(bool useLowQualityScale, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal)
</del><ins>+ ImagePaintingOptions(InterpolationQuality interpolationQuality, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal)
</ins><span class="cx"> : m_compositeOperator(compositeOperator)
</span><span class="cx"> , m_blendMode(blendMode)
</span><span class="cx"> , m_orientationDescription(orientationDescription)
</span><del>- , m_useLowQualityScale(useLowQualityScale)
</del><ins>+ , m_interpolationQuality(interpolationQuality)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><ins>+
+ bool usesDefaultInterpolation() const { return m_interpolationQuality == InterpolationDefault; }
</ins><span class="cx">
</span><span class="cx"> CompositeOperator m_compositeOperator;
</span><span class="cx"> BlendMode m_blendMode;
</span><span class="cx"> ImageOrientationDescription m_orientationDescription;
</span><del>- bool m_useLowQualityScale;
</del><ins>+ InterpolationQuality m_interpolationQuality;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> struct GraphicsContextStateChange {
</span><span class="lines">@@ -657,6 +651,34 @@
</span><span class="cx"> bool m_saveAndRestore;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+class InterpolationQualityMaintainer {
+public:
+ explicit InterpolationQualityMaintainer(GraphicsContext& graphicsContext, InterpolationQuality interpolationQualityToUse)
+ : m_graphicsContext(graphicsContext)
+ , m_currentInterpolationQuality(graphicsContext.imageInterpolationQuality())
+ , m_interpolationQualityChanged(interpolationQualityToUse != InterpolationDefault && m_currentInterpolationQuality != interpolationQualityToUse)
+ {
+ if (m_interpolationQualityChanged)
+ m_graphicsContext.setImageInterpolationQuality(interpolationQualityToUse);
+ }
+
+ explicit InterpolationQualityMaintainer(GraphicsContext& graphicsContext, Optional<InterpolationQuality> interpolationQuality)
+ : InterpolationQualityMaintainer(graphicsContext, interpolationQuality ? interpolationQuality.value() : graphicsContext.imageInterpolationQuality())
+ {
+ }
+
+ ~InterpolationQualityMaintainer()
+ {
+ if (m_interpolationQualityChanged)
+ m_graphicsContext.setImageInterpolationQuality(m_currentInterpolationQuality);
+ }
+
+private:
+ GraphicsContext& m_graphicsContext;
+ InterpolationQuality m_currentInterpolationQuality;
+ bool m_interpolationQualityChanged;
+};
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // GraphicsContext_h
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsTypes.h (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsTypes.h        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/platform/graphics/GraphicsTypes.h        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -75,6 +75,14 @@
</span><span class="cx"> SpreadMethodRepeat
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+enum InterpolationQuality {
+ InterpolationDefault,
+ InterpolationNone,
+ InterpolationLow,
+ InterpolationMedium,
+ InterpolationHigh
+};
+
</ins><span class="cx"> enum LineCap { ButtCap, RoundCap, SquareCap };
</span><span class="cx">
</span><span class="cx"> enum LineJoin { MiterJoin, RoundJoin, BevelJoin };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsImageBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -142,10 +142,10 @@
</span><span class="cx"> void flushContext() const;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false);
</del><ins>+ void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal);
</ins><span class="cx"> void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
</span><span class="cx">
</span><del>- static void drawConsuming(std::unique_ptr<ImageBuffer>, GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false);
</del><ins>+ static void drawConsuming(std::unique_ptr<ImageBuffer>, GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal);
</ins><span class="cx">
</span><span class="cx"> inline void genericConvertToLuminanceMask();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscairoImageBufferCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -214,17 +214,17 @@
</span><span class="cx"> return DontCopyBackingStore;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
</del><ins>+void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode)
</ins><span class="cx"> {
</span><del>- imageBuffer->draw(destContext, destRect, srcRect, op, blendMode, useLowQualityScale);
</del><ins>+ imageBuffer->draw(destContext, destRect, srcRect, op, blendMode);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ImageBuffer::draw(GraphicsContext& destinationContext, const FloatRect& destRect, const FloatRect& srcRect,
</span><del>- CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
</del><ins>+ CompositeOperator op, BlendMode blendMode)
</ins><span class="cx"> {
</span><span class="cx"> BackingStoreCopy copyMode = &destinationContext == &context() ? CopyBackingStore : DontCopyBackingStore;
</span><span class="cx"> RefPtr<Image> image = copyImage(copyMode);
</span><del>- destinationContext.drawImage(*image, destRect, srcRect, ImagePaintingOptions(op, blendMode, ImageOrientationDescription(), useLowQualityScale));
</del><ins>+ destinationContext.drawImage(*image, destRect, srcRect, ImagePaintingOptions(op, blendMode, ImageOrientationDescription()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ImageBuffer::drawPattern(GraphicsContext& context, const FloatRect& srcRect, const AffineTransform& patternTransform,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgImageBufferCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -264,11 +264,11 @@
</span><span class="cx"> return image;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
</del><ins>+void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode)
</ins><span class="cx"> {
</span><span class="cx"> #if USE(IOSURFACE_CANVAS_BACKING_STORE)
</span><span class="cx"> if (!imageBuffer->m_data.surface) {
</span><del>- imageBuffer->draw(destContext, destRect, srcRect, op, blendMode, useLowQualityScale);
</del><ins>+ imageBuffer->draw(destContext, destRect, srcRect, op, blendMode);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -283,11 +283,11 @@
</span><span class="cx"> adjustedSrcRect.scale(resolutionScale, resolutionScale);
</span><span class="cx"> destContext.drawNativeImage(image.get(), backingStoreSize, destRect, adjustedSrcRect, op, blendMode);
</span><span class="cx"> #else
</span><del>- imageBuffer->draw(destContext, destRect, srcRect, op, blendMode, useLowQualityScale);
</del><ins>+ imageBuffer->draw(destContext, destRect, srcRect, op, blendMode);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ImageBuffer::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, bool)
</del><ins>+void ImageBuffer::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode)
</ins><span class="cx"> {
</span><span class="cx"> RetainPtr<CGImageRef> image;
</span><span class="cx"> if (&destContext == &context() || destContext.isAcceleratedContext())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingImageQualityControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/ImageQualityController.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/ImageQualityController.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/rendering/ImageQualityController.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -40,8 +40,6 @@
</span><span class="cx"> ImageQualityController::ImageQualityController(const RenderView& renderView)
</span><span class="cx"> : m_renderView(renderView)
</span><span class="cx"> , m_timer(*this, &ImageQualityController::highQualityRepaintTimerFired)
</span><del>- , m_animatedResizeIsActive(false)
- , m_liveResizeOptimizationIsActive(false)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -99,24 +97,31 @@
</span><span class="cx"> m_timer.startOneShot(cLowQualityTimeThreshold);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext& context, RenderBoxModelObject* object, Image& image, const void *layer, const LayoutSize& size)
</del><ins>+Optional<InterpolationQuality> ImageQualityController::interpolationQualityFromStyle(const RenderStyle& style)
</ins><span class="cx"> {
</span><del>- // If the image is not a bitmap image, then none of this is relevant and we just paint at high
- // quality.
- if (!(image.isBitmapImage() || image.isPDFDocumentImage()) || context.paintingDisabled())
- return false;
-
- switch (object->style().imageRendering()) {
</del><ins>+ switch (style.imageRendering()) {
</ins><span class="cx"> case ImageRenderingOptimizeSpeed:
</span><ins>+ return InterpolationLow;
</ins><span class="cx"> case ImageRenderingCrispEdges:
</span><span class="cx"> case ImageRenderingPixelated:
</span><del>- return true;
</del><ins>+ return InterpolationNone;
</ins><span class="cx"> case ImageRenderingOptimizeQuality:
</span><del>- return false; // FIXME: CSS 3 Images says that optimizeQuality should behave like 'auto', but that prevents authors from overriding this low quality rendering behavior.
</del><ins>+ return InterpolationDefault; // FIXME: CSS 3 Images says that optimizeQuality should behave like 'auto', but that prevents authors from overriding this low quality rendering behavior.
</ins><span class="cx"> case ImageRenderingAuto:
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+ return Nullopt;
+}
</ins><span class="cx">
</span><ins>+InterpolationQuality ImageQualityController::chooseInterpolationQuality(GraphicsContext& context, RenderBoxModelObject* object, Image& image, const void *layer, const LayoutSize& size)
+{
+ // If the image is not a bitmap image, then none of this is relevant and we just paint at high quality.
+ if (!(image.isBitmapImage() || image.isPDFDocumentImage()) || context.paintingDisabled())
+ return InterpolationDefault;
+
+ if (Optional<InterpolationQuality> styleInterpolation = interpolationQualityFromStyle(object->style()))
+ return styleInterpolation.value();
+
</ins><span class="cx"> // Make sure to use the unzoomed image size, since if a full page zoom is in effect, the image
</span><span class="cx"> // is actually being scaled.
</span><span class="cx"> IntSize imageSize(image.width(), image.height());
</span><span class="lines">@@ -141,10 +146,10 @@
</span><span class="cx"> set(object, innerMap, layer, size);
</span><span class="cx"> restartTimer();
</span><span class="cx"> m_liveResizeOptimizationIsActive = true;
</span><del>- return true;
</del><ins>+ return InterpolationLow;
</ins><span class="cx"> }
</span><span class="cx"> if (m_liveResizeOptimizationIsActive)
</span><del>- return false;
</del><ins>+ return InterpolationDefault;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const AffineTransform& currentTransform = context.getCTM();
</span><span class="lines">@@ -152,21 +157,21 @@
</span><span class="cx"> if (!contextIsScaled && size == imageSize) {
</span><span class="cx"> // There is no scale in effect. If we had a scale in effect before, we can just remove this object from the list.
</span><span class="cx"> removeLayer(object, innerMap, layer);
</span><del>- return false;
</del><ins>+ return InterpolationDefault;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // There is no need to hash scaled images that always use low quality mode when the page demands it. This is the iChat case.
</span><span class="cx"> if (m_renderView.frame().page()->inLowQualityImageInterpolationMode()) {
</span><span class="cx"> double totalPixels = static_cast<double>(image.width()) * static_cast<double>(image.height());
</span><span class="cx"> if (totalPixels > cInterpolationCutoff)
</span><del>- return true;
</del><ins>+ return InterpolationLow;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // If an animated resize is active, paint in low quality and kick the timer ahead.
</span><span class="cx"> if (m_animatedResizeIsActive) {
</span><span class="cx"> set(object, innerMap, layer, size);
</span><span class="cx"> restartTimer();
</span><del>- return true;
</del><ins>+ return InterpolationLow;
</ins><span class="cx"> }
</span><span class="cx"> // If this is the first time resizing this image, or its size is the
</span><span class="cx"> // same as the last resize, draw at high res, but record the paint
</span><span class="lines">@@ -174,13 +179,13 @@
</span><span class="cx"> if (isFirstResize || oldSize == size) {
</span><span class="cx"> restartTimer();
</span><span class="cx"> set(object, innerMap, layer, size);
</span><del>- return false;
</del><ins>+ return InterpolationDefault;
</ins><span class="cx"> }
</span><span class="cx"> // If the timer is no longer active, draw at high quality and don't
</span><span class="cx"> // set the timer.
</span><span class="cx"> if (!m_timer.isActive()) {
</span><span class="cx"> removeLayer(object, innerMap, layer);
</span><del>- return false;
</del><ins>+ return InterpolationDefault;
</ins><span class="cx"> }
</span><span class="cx"> // This object has been resized to two different sizes while the timer
</span><span class="cx"> // is active, so draw at low quality, set the flag for animated resizes and
</span><span class="lines">@@ -188,7 +193,7 @@
</span><span class="cx"> set(object, innerMap, layer, size);
</span><span class="cx"> m_animatedResizeIsActive = true;
</span><span class="cx"> restartTimer();
</span><del>- return true;
</del><ins>+ return InterpolationLow;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingImageQualityControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/ImageQualityController.h (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/ImageQualityController.h        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/rendering/ImageQualityController.h        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -26,24 +26,28 @@
</span><span class="cx"> #ifndef ImageQualityController_h
</span><span class="cx"> #define ImageQualityController_h
</span><span class="cx">
</span><ins>+#include "GraphicsTypes.h"
</ins><span class="cx"> #include "Timer.h"
</span><span class="cx"> #include <wtf/HashMap.h>
</span><ins>+#include <wtf/Optional.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class Frame;
</del><span class="cx"> class GraphicsContext;
</span><span class="cx"> class Image;
</span><span class="cx"> class LayoutSize;
</span><span class="cx"> class RenderBoxModelObject;
</span><span class="cx"> class RenderView;
</span><ins>+class RenderStyle;
</ins><span class="cx">
</span><span class="cx"> class ImageQualityController {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(ImageQualityController); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx"> explicit ImageQualityController(const RenderView&);
</span><span class="cx">
</span><del>- bool shouldPaintAtLowQuality(GraphicsContext&, RenderBoxModelObject*, Image&, const void* layer, const LayoutSize&);
</del><ins>+ static Optional<InterpolationQuality> interpolationQualityFromStyle(const RenderStyle&);
+ InterpolationQuality chooseInterpolationQuality(GraphicsContext&, RenderBoxModelObject*, Image&, const void* layer, const LayoutSize&);
+
</ins><span class="cx"> void rendererWillBeDestroyed(RenderBoxModelObject& renderer) { removeObject(&renderer); }
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -59,8 +63,8 @@
</span><span class="cx"> const RenderView& m_renderView;
</span><span class="cx"> ObjectLayerSizeMap m_objectLayerSizeMap;
</span><span class="cx"> Timer m_timer;
</span><del>- bool m_animatedResizeIsActive;
- bool m_liveResizeOptimizationIsActive;
</del><ins>+ bool m_animatedResizeIsActive { false };
+ bool m_liveResizeOptimizationIsActive { false };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -161,11 +161,6 @@
</span><span class="cx"> layer()->backing()->suspendAnimations(time);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext& context, Image& image, const void* layer, const LayoutSize& size)
-{
- return view().imageQualityController().shouldPaintAtLowQuality(context, this, image, layer, size);
-}
-
</del><span class="cx"> RenderBoxModelObject::RenderBoxModelObject(Element& element, Ref<RenderStyle>&& style, BaseTypeFlags baseTypeFlags)
</span><span class="cx"> : RenderLayerModelObject(element, WTFMove(style), baseTypeFlags | RenderBoxModelObjectFlag)
</span><span class="cx"> {
</span><span class="lines">@@ -594,6 +589,11 @@
</span><span class="cx"> context.setLegacyShadow(shadowOffset, boxShadow->radius(), boxShadow->color());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+InterpolationQuality RenderBoxModelObject::chooseInterpolationQuality(GraphicsContext& context, Image& image, const void* layer, const LayoutSize& size)
+{
+ return view().imageQualityController().chooseInterpolationQuality(context, this, image, layer, size);
+}
+
</ins><span class="cx"> void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const IntRect& maskRect, InlineFlowBox* box, const LayoutRect& scrolledPaintRect)
</span><span class="cx"> {
</span><span class="cx"> GraphicsContext& maskImageContext = maskImage->context();
</span><span class="lines">@@ -834,8 +834,9 @@
</span><span class="cx"> if (!geometry.destRect().isEmpty() && (image = bgImage->image(backgroundObject ? backgroundObject : this, geometry.tileSize()))) {
</span><span class="cx"> CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer->composite() : op;
</span><span class="cx"> context.setDrawLuminanceMask(bgLayer->maskSourceType() == MaskLuminance);
</span><del>- bool useLowQualityScaling = shouldPaintAtLowQuality(context, *image, bgLayer, geometry.tileSize());
- context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer->blendMode(), ImageOrientationDescription(), useLowQualityScaling));
</del><ins>+
+ InterpolationQuality interpolation = chooseInterpolationQuality(context, *image, bgLayer, geometry.tileSize());
+ context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer->blendMode(), ImageOrientationDescription(), interpolation));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -251,7 +251,7 @@
</span><span class="cx"> RoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(const GraphicsContext&, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox*, const LayoutSize&, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
</span><span class="cx"> LayoutRect borderInnerRectAdjustedForBleedAvoidance(const GraphicsContext&, const LayoutRect&, BackgroundBleedAvoidance) const;
</span><span class="cx">
</span><del>- bool shouldPaintAtLowQuality(GraphicsContext&, Image&, const void*, const LayoutSize&);
</del><ins>+ InterpolationQuality chooseInterpolationQuality(GraphicsContext&, Image&, const void*, const LayoutSize&);
</ins><span class="cx">
</span><span class="cx"> RenderBoxModelObject* continuation() const;
</span><span class="cx"> void setContinuation(RenderBoxModelObject*);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderEmbeddedObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -214,12 +214,9 @@
</span><span class="cx"> if (alignedRect.width() <= 0 || alignedRect.height() <= 0)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, &image, alignedRect.size());
- ImageOrientationDescription orientationDescription(shouldRespectImageOrientation());
-#if ENABLE(CSS_IMAGE_ORIENTATION)
- orientationDescription.setImageOrientationEnum(style().imageOrientation());
-#endif
- context.drawImage(image, alignedRect, ImagePaintingOptions(orientationDescription, useLowQualityScaling));
</del><ins>+ InterpolationQuality interpolation = chooseInterpolationQuality(context, image, &image, alignedRect.size());
+ ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation());
+ context.drawImage(image, alignedRect, ImagePaintingOptions(orientationDescription, interpolation));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderEmbeddedObject::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderHTMLCanvascpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "GraphicsContext.h"
</span><span class="cx"> #include "HTMLCanvasElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><ins>+#include "ImageQualityController.h"
</ins><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PaintInfo.h"
</span><span class="cx"> #include "RenderView.h"
</span><span class="lines">@@ -84,8 +85,8 @@
</span><span class="cx"> page->addRelevantRepaintedObject(this, intersection(replacedContentRect, contentBoxRect));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool useLowQualityScale = style().imageRendering() == ImageRenderingCrispEdges || style().imageRendering() == ImageRenderingPixelated || style().imageRendering() == ImageRenderingOptimizeSpeed;
- canvasElement().paint(context, replacedContentRect, useLowQualityScale);
</del><ins>+ InterpolationQualityMaintainer interpolationMaintainer(context, ImageQualityController::interpolationQualityFromStyle(style()));
+ canvasElement().paint(context, replacedContentRect);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderHTMLCanvas::canvasSizeChanged()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderImage.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -547,14 +547,13 @@
</span><span class="cx">
</span><span class="cx"> HTMLImageElement* imageElement = is<HTMLImageElement>(element()) ? downcast<HTMLImageElement>(element()) : nullptr;
</span><span class="cx"> CompositeOperator compositeOperator = imageElement ? imageElement->compositeOperator() : CompositeSourceOver;
</span><ins>+
+ // FIXME: Document when image != img.get().
</ins><span class="cx"> Image* image = imageResource().image().get();
</span><del>- bool useLowQualityScaling = image && shouldPaintAtLowQuality(context, *image, image, LayoutSize(rect.size()));
- ImageOrientationDescription orientationDescription(shouldRespectImageOrientation());
-#if ENABLE(CSS_IMAGE_ORIENTATION)
- orientationDescription.setImageOrientationEnum(style().imageOrientation());
-#endif
- context.drawImage(*img, rect,
- ImagePaintingOptions(compositeOperator, BlendModeNormal, orientationDescription, useLowQualityScaling));
</del><ins>+ InterpolationQuality interpolation = image ? chooseInterpolationQuality(context, *image, image, LayoutSize(rect.size())) : InterpolationDefault;
+
+ ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation());
+ context.drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendModeNormal, orientationDescription, interpolation));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderImage::boxShadowShouldBeAppliedToBackground(const LayoutPoint& paintOffset, BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox*) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderSnapshottedPlugIncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -135,13 +135,9 @@
</span><span class="cx"> if (alignedRect.width() <= 0 || alignedRect.height() <= 0)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- bool useLowQualityScaling = shouldPaintAtLowQuality(context, *image, image, alignedRect.size());
-
- ImageOrientationDescription orientationDescription(shouldRespectImageOrientation());
-#if ENABLE(CSS_IMAGE_ORIENTATION)
- orientationDescription.setImageOrientationEnum(style().imageOrientation());
-#endif
- context.drawImage(*image, alignedRect, ImagePaintingOptions(orientationDescription, useLowQualityScaling));
</del><ins>+ InterpolationQuality interpolation = chooseInterpolationQuality(context, *image, image, alignedRect.size());
+ ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation());
+ context.drawImage(*image, alignedRect, ImagePaintingOptions(orientationDescription, interpolation));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CursorDirective RenderSnapshottedPlugIn::getCursor(const LayoutPoint& point, Cursor& overrideCursor) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (195847 => 195848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2016-01-29 23:13:25 UTC (rev 195847)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2016-01-29 23:15:58 UTC (rev 195848)
</span><span class="lines">@@ -1163,9 +1163,14 @@
</span><span class="cx"> bool isFlippedLinesWritingMode() const { return WebCore::isFlippedLinesWritingMode(writingMode()); }
</span><span class="cx"> bool isFlippedBlocksWritingMode() const { return WebCore::isFlippedWritingMode(writingMode()); }
</span><span class="cx">
</span><ins>+ ImageOrientationEnum imageOrientation() const
+ {
</ins><span class="cx"> #if ENABLE(CSS_IMAGE_ORIENTATION)
</span><del>- ImageOrientationEnum imageOrientation() const { return static_cast<ImageOrientationEnum>(rareInheritedData->m_imageOrientation); }
</del><ins>+ return static_cast<ImageOrientationEnum>(rareInheritedData->m_imageOrientation);
+#else
+ return DefaultImageOrientation;
</ins><span class="cx"> #endif
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>