Diff
Modified: trunk/Source/WebCore/ChangeLog (173255 => 173256)
--- 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)
@@ -1,3 +1,32 @@
+2014-09-04 Dan Bernstein <[email protected]>
+
+ 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.
+
2014-09-03 Youenn Fablet <[email protected]>
XMLHttpRequest always defaults Content-Type to application/xml, while it should depend on data type
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (173255 => 173256)
--- 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)
@@ -79,7 +79,6 @@
, m_size(DefaultWidth, DefaultHeight)
, m_rendererIsCanvas(false)
, m_ignoreReset(false)
- , m_deviceScaleFactor(targetDeviceScaleFactor())
, m_originClean(true)
, m_hasCreatedImageBuffer(false)
, m_didClearImageBuffer(false)
@@ -313,18 +312,14 @@
IntSize oldSize = size();
IntSize newSize(w, h);
- float newDeviceScaleFactor = targetDeviceScaleFactor();
-
// If the size of an existing buffer matches, we can just clear it instead of reallocating.
// This optimization is only done for 2D canvases for now.
- if (m_hasCreatedImageBuffer && oldSize == newSize && m_deviceScaleFactor == newDeviceScaleFactor && m_context && m_context->is2d()) {
+ if (m_hasCreatedImageBuffer && oldSize == newSize && m_context && m_context->is2d()) {
if (!m_didClearImageBuffer)
clearImageBuffer();
return;
}
- m_deviceScaleFactor = newDeviceScaleFactor;
-
setSurfaceSize(newSize);
#if ENABLE(WEBGL)
@@ -348,11 +343,6 @@
(*it)->canvasResized(*this);
}
-float HTMLCanvasElement::targetDeviceScaleFactor() const
-{
- return 1;
-}
-
bool HTMLCanvasElement::paintsIntoCanvasBuffer() const
{
ASSERT(m_context);
@@ -493,7 +483,6 @@
FloatRect HTMLCanvasElement::convertLogicalToDevice(const FloatRect& logicalRect) const
{
FloatRect deviceRect(logicalRect);
- deviceRect.scale(m_deviceScaleFactor);
float x = floorf(deviceRect.x());
float y = floorf(deviceRect.y());
@@ -509,15 +498,15 @@
FloatSize HTMLCanvasElement::convertLogicalToDevice(const FloatSize& logicalSize) const
{
- float width = ceilf(logicalSize.width() * m_deviceScaleFactor);
- float height = ceilf(logicalSize.height() * m_deviceScaleFactor);
+ float width = ceilf(logicalSize.width());
+ float height = ceilf(logicalSize.height());
return FloatSize(width, height);
}
FloatSize HTMLCanvasElement::convertDeviceToLogical(const FloatSize& deviceSize) const
{
- float width = ceilf(deviceSize.width() / m_deviceScaleFactor);
- float height = ceilf(deviceSize.height() / m_deviceScaleFactor);
+ float width = ceilf(deviceSize.width());
+ float height = ceilf(deviceSize.height());
return FloatSize(width, height);
}
@@ -570,7 +559,7 @@
return;
RenderingMode renderingMode = shouldAccelerate(bufferSize) ? Accelerated : Unaccelerated;
- m_imageBuffer = ImageBuffer::create(size(), m_deviceScaleFactor, ColorSpaceDeviceRGB, renderingMode);
+ m_imageBuffer = ImageBuffer::create(size(), 1, ColorSpaceDeviceRGB, renderingMode);
if (!m_imageBuffer)
return;
m_imageBuffer->context()->setShadowsIgnoreTransforms(true);
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (173255 => 173256)
--- 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)
@@ -81,7 +81,7 @@
void setSize(const IntSize& newSize)
{
- if (newSize == size() && targetDeviceScaleFactor() == m_deviceScaleFactor)
+ if (newSize == size())
return;
m_ignoreReset = true;
setWidth(newSize.width());
@@ -135,8 +135,6 @@
bool shouldAccelerate(const IntSize&) const;
- float deviceScaleFactor() const { return m_deviceScaleFactor; }
-
private:
HTMLCanvasElement(const QualifiedName&, Document&);
@@ -148,8 +146,6 @@
void reset();
- float targetDeviceScaleFactor() const;
-
void createImageBuffer() const;
void clearImageBuffer() const;
@@ -172,7 +168,6 @@
bool m_ignoreReset;
FloatRect m_dirtyRect;
- float m_deviceScaleFactor;
bool m_originClean;
// m_createdImageBuffer means we tried to malloc the buffer. We didn't necessarily get it.
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (173255 => 173256)
--- 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)
@@ -2023,11 +2023,6 @@
buffer->putByteArray(Unmultiplied, data->data(), IntSize(data->width(), data->height()), sourceRect, IntPoint(destOffset), coordinateSystem);
- if (coordinateSystem == ImageBuffer::BackingStoreCoordinateSystem) {
- FloatRect dirtyRect = destRect;
- dirtyRect.scale(1 / canvas()->deviceScaleFactor());
- destRect = enclosingIntRect(dirtyRect);
- }
didDraw(destRect, CanvasDidDrawApplyNone); // ignore transform, shadow and clip
}
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (173255 => 173256)
--- 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)
@@ -199,7 +199,7 @@
void drawFocusIfNeeded(Element*);
- float webkitBackingStorePixelRatio() const { return canvas()->deviceScaleFactor(); }
+ float webkitBackingStorePixelRatio() const { return 1; }
void reset();
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (173255 => 173256)
--- 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)
@@ -3945,7 +3945,7 @@
RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image->renderer());
if (imageForRender->isSVGImage())
- imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width(), image->height(), canvas()->deviceScaleFactor());
+ imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width(), image->height(), 1);
if (!imageForRender || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLImageElement, target, level, internalformat, imageForRender->width(), imageForRender->height(), 0, format, type, 0, 0))
return;
@@ -4191,7 +4191,7 @@
RefPtr<Image> imageForRender = image->cachedImage()->imageForRenderer(image->renderer());
if (imageForRender->isSVGImage())
- imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width(), image->height(), canvas()->deviceScaleFactor());
+ imageForRender = drawImageIntoBuffer(imageForRender.get(), image->width(), image->height(), 1);
if (!imageForRender || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLImageElement, target, level, format, imageForRender->width(), imageForRender->height(), 0, format, type, xoffset, yoffset))
return;