<!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>[173256] trunk/Source/WebCore</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/173256">173256</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2014-09-04 01:28:19 -0700 (Thu, 04 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Get rid of HIGH_DPI_CANVAS leftovers
https://bugs.webkit.org/show_bug.cgi?id=136491
Reviewed by Benjamin Poulain.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::HTMLCanvasElement): Removed m_deviceScaleFactor initializer.
(WebCore::HTMLCanvasElement::reset): Removed checking if the scale factor has changed and
updating m_deviceScaleFactor.
(WebCore::HTMLCanvasElement::convertLogicalToDevice): Removed scaling by the device scale
factor.
(WebCore::HTMLCanvasElement::convertDeviceToLogical): Ditto.
(WebCore::HTMLCanvasElement::createImageBuffer): Replaced m_deviceScaleFactor with a literal
1.
(WebCore::HTMLCanvasElement::targetDeviceScaleFactor): Deleted.
* html/HTMLCanvasElement.h: Removed m_deviceScaleFactor member variable and its getter.
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::putImageData): Removed scaling by the device scale
factor.
* html/canvas/CanvasRenderingContext2D.h:
(WebCore::CanvasRenderingContext2D::webkitBackingStorePixelRatio): Changed to return 1.
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::texImage2D): Replaced deviceScaleFactor() with 1.
(WebCore::WebGLRenderingContext::texSubImage2D): Ditto.</pre>
<h3>Modified Paths</h3>
<ul>
<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="#trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dcpp">trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dh">trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextcpp">trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173255 => 173256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-04 07:41:27 UTC (rev 173255)
+++ trunk/Source/WebCore/ChangeLog        2014-09-04 08:28:19 UTC (rev 173256)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2014-09-04 Dan Bernstein <mitz@apple.com>
+
+ Get rid of HIGH_DPI_CANVAS leftovers
+ https://bugs.webkit.org/show_bug.cgi?id=136491
+
+ Reviewed by Benjamin Poulain.
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::HTMLCanvasElement): Removed m_deviceScaleFactor initializer.
+ (WebCore::HTMLCanvasElement::reset): Removed checking if the scale factor has changed and
+ updating m_deviceScaleFactor.
+ (WebCore::HTMLCanvasElement::convertLogicalToDevice): Removed scaling by the device scale
+ factor.
+ (WebCore::HTMLCanvasElement::convertDeviceToLogical): Ditto.
+ (WebCore::HTMLCanvasElement::createImageBuffer): Replaced m_deviceScaleFactor with a literal
+ 1.
+ (WebCore::HTMLCanvasElement::targetDeviceScaleFactor): Deleted.
+ * html/HTMLCanvasElement.h: Removed m_deviceScaleFactor member variable and its getter.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::putImageData): Removed scaling by the device scale
+ factor.
+ * html/canvas/CanvasRenderingContext2D.h:
+ (WebCore::CanvasRenderingContext2D::webkitBackingStorePixelRatio): Changed to return 1.
+
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::texImage2D): Replaced deviceScaleFactor() with 1.
+ (WebCore::WebGLRenderingContext::texSubImage2D): Ditto.
+
</ins><span class="cx"> 2014-09-03 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><span class="cx"> XMLHttpRequest always defaults Content-Type to application/xml, while it should depend on data type
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCanvasElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (173255 => 173256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp        2014-09-04 07:41:27 UTC (rev 173255)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp        2014-09-04 08:28:19 UTC (rev 173256)
</span><span class="lines">@@ -79,7 +79,6 @@
</span><span class="cx"> , m_size(DefaultWidth, DefaultHeight)
</span><span class="cx"> , m_rendererIsCanvas(false)
</span><span class="cx"> , m_ignoreReset(false)
</span><del>- , m_deviceScaleFactor(targetDeviceScaleFactor())
</del><span class="cx"> , m_originClean(true)
</span><span class="cx"> , m_hasCreatedImageBuffer(false)
</span><span class="cx"> , m_didClearImageBuffer(false)
</span><span class="lines">@@ -313,18 +312,14 @@
</span><span class="cx">
</span><span class="cx"> IntSize oldSize = size();
</span><span class="cx"> IntSize newSize(w, h);
</span><del>- float newDeviceScaleFactor = targetDeviceScaleFactor();
-
</del><span class="cx"> // If the size of an existing buffer matches, we can just clear it instead of reallocating.
</span><span class="cx"> // This optimization is only done for 2D canvases for now.
</span><del>- if (m_hasCreatedImageBuffer && oldSize == newSize && m_deviceScaleFactor == newDeviceScaleFactor && m_context && m_context->is2d()) {
</del><ins>+ if (m_hasCreatedImageBuffer && oldSize == newSize && m_context && m_context->is2d()) {
</ins><span class="cx"> if (!m_didClearImageBuffer)
</span><span class="cx"> clearImageBuffer();
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- m_deviceScaleFactor = newDeviceScaleFactor;
-
</del><span class="cx"> setSurfaceSize(newSize);
</span><span class="cx">
</span><span class="cx"> #if ENABLE(WEBGL)
</span><span class="lines">@@ -348,11 +343,6 @@
</span><span class="cx"> (*it)->canvasResized(*this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-float HTMLCanvasElement::targetDeviceScaleFactor() const
-{
- return 1;
-}
-
</del><span class="cx"> bool HTMLCanvasElement::paintsIntoCanvasBuffer() const
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_context);
</span><span class="lines">@@ -493,7 +483,6 @@
</span><span class="cx"> FloatRect HTMLCanvasElement::convertLogicalToDevice(const FloatRect& logicalRect) const
</span><span class="cx"> {
</span><span class="cx"> FloatRect deviceRect(logicalRect);
</span><del>- deviceRect.scale(m_deviceScaleFactor);
</del><span class="cx">
</span><span class="cx"> float x = floorf(deviceRect.x());
</span><span class="cx"> float y = floorf(deviceRect.y());
</span><span class="lines">@@ -509,15 +498,15 @@
</span><span class="cx">
</span><span class="cx"> FloatSize HTMLCanvasElement::convertLogicalToDevice(const FloatSize& logicalSize) const
</span><span class="cx"> {
</span><del>- float width = ceilf(logicalSize.width() * m_deviceScaleFactor);
- float height = ceilf(logicalSize.height() * m_deviceScaleFactor);
</del><ins>+ float width = ceilf(logicalSize.width());
+ float height = ceilf(logicalSize.height());
</ins><span class="cx"> return FloatSize(width, height);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> FloatSize HTMLCanvasElement::convertDeviceToLogical(const FloatSize& deviceSize) const
</span><span class="cx"> {
</span><del>- float width = ceilf(deviceSize.width() / m_deviceScaleFactor);
- float height = ceilf(deviceSize.height() / m_deviceScaleFactor);
</del><ins>+ float width = ceilf(deviceSize.width());
+ float height = ceilf(deviceSize.height());
</ins><span class="cx"> return FloatSize(width, height);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -570,7 +559,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> RenderingMode renderingMode = shouldAccelerate(bufferSize) ? Accelerated : Unaccelerated;
</span><del>- m_imageBuffer = ImageBuffer::create(size(), m_deviceScaleFactor, ColorSpaceDeviceRGB, renderingMode);
</del><ins>+ m_imageBuffer = ImageBuffer::create(size(), 1, ColorSpaceDeviceRGB, renderingMode);
</ins><span class="cx"> if (!m_imageBuffer)
</span><span class="cx"> return;
</span><span class="cx"> m_imageBuffer->context()->setShadowsIgnoreTransforms(true);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCanvasElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (173255 => 173256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCanvasElement.h        2014-09-04 07:41:27 UTC (rev 173255)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h        2014-09-04 08:28:19 UTC (rev 173256)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">
</span><span class="cx"> void setSize(const IntSize& newSize)
</span><span class="cx"> {
</span><del>- if (newSize == size() && targetDeviceScaleFactor() == m_deviceScaleFactor)
</del><ins>+ if (newSize == size())
</ins><span class="cx"> return;
</span><span class="cx"> m_ignoreReset = true;
</span><span class="cx"> setWidth(newSize.width());
</span><span class="lines">@@ -135,8 +135,6 @@
</span><span class="cx">
</span><span class="cx"> bool shouldAccelerate(const IntSize&) const;
</span><span class="cx">
</span><del>- float deviceScaleFactor() const { return m_deviceScaleFactor; }
-
</del><span class="cx"> private:
</span><span class="cx"> HTMLCanvasElement(const QualifiedName&, Document&);
</span><span class="cx">
</span><span class="lines">@@ -148,8 +146,6 @@
</span><span class="cx">
</span><span class="cx"> void reset();
</span><span class="cx">
</span><del>- float targetDeviceScaleFactor() const;
-
</del><span class="cx"> void createImageBuffer() const;
</span><span class="cx"> void clearImageBuffer() const;
</span><span class="cx">
</span><span class="lines">@@ -172,7 +168,6 @@
</span><span class="cx"> bool m_ignoreReset;
</span><span class="cx"> FloatRect m_dirtyRect;
</span><span class="cx">
</span><del>- float m_deviceScaleFactor;
</del><span class="cx"> bool m_originClean;
</span><span class="cx">
</span><span class="cx"> // m_createdImageBuffer means we tried to malloc the buffer. We didn't necessarily get it.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (173255 => 173256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp        2014-09-04 07:41:27 UTC (rev 173255)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp        2014-09-04 08:28:19 UTC (rev 173256)
</span><span class="lines">@@ -2023,11 +2023,6 @@
</span><span class="cx">
</span><span class="cx"> buffer->putByteArray(Unmultiplied, data->data(), IntSize(data->width(), data->height()), sourceRect, IntPoint(destOffset), coordinateSystem);
</span><span class="cx">
</span><del>- if (coordinateSystem == ImageBuffer::BackingStoreCoordinateSystem) {
- FloatRect dirtyRect = destRect;
- dirtyRect.scale(1 / canvas()->deviceScaleFactor());
- destRect = enclosingIntRect(dirtyRect);
- }
</del><span class="cx"> didDraw(destRect, CanvasDidDrawApplyNone); // ignore transform, shadow and clip
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (173255 => 173256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h        2014-09-04 07:41:27 UTC (rev 173255)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h        2014-09-04 08:28:19 UTC (rev 173256)
</span><span class="lines">@@ -199,7 +199,7 @@
</span><span class="cx">
</span><span class="cx"> void drawFocusIfNeeded(Element*);
</span><span class="cx">
</span><del>- float webkitBackingStorePixelRatio() const { return canvas()->deviceScaleFactor(); }
</del><ins>+ float webkitBackingStorePixelRatio() const { return 1; }
</ins><span class="cx">
</span><span class="cx"> void reset();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (173255 => 173256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2014-09-04 07:41:27 UTC (rev 173255)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2014-09-04 08:28:19 UTC (rev 173256)
</span><span class="lines">@@ -3945,7 +3945,7 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image->renderer());
</span><span class="cx"> if (imageForRender->isSVGImage())
</span><del>- imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width(), image->height(), canvas()->deviceScaleFactor());
</del><ins>+ imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width(), image->height(), 1);
</ins><span class="cx">
</span><span class="cx"> if (!imageForRender || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLImageElement, target, level, internalformat, imageForRender->width(), imageForRender->height(), 0, format, type, 0, 0))
</span><span class="cx"> return;
</span><span class="lines">@@ -4191,7 +4191,7 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image->renderer());
</span><span class="cx"> if (imageForRender->isSVGImage())
</span><del>- imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width(), image->height(), canvas()->deviceScaleFactor());
</del><ins>+ imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width(), image->height(), 1);
</ins><span class="cx">
</span><span class="cx"> if (!imageForRender || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLImageElement, target, level, format, imageForRender->width(), imageForRender->height(), 0, format, type, xoffset, yoffset))
</span><span class="cx"> return;
</span></span></pre>
</div>
</div>
</body>
</html>