Add a flag to control canvas antialiasing.
authorsenorblanco@chromium.org <senorblanco@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jan 2013 02:58:15 +0000 (02:58 +0000)
committersenorblanco@chromium.org <senorblanco@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jan 2013 02:58:15 +0000 (02:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106255

Reviewed by Darin Fisher.

Source/WebCore:

This flag is not exposed through TestRunner or DRT, so no testing is
possible yet.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createImageBuffer):
* page/Settings.in:

Source/WebKit/chromium:

* public/WebSettings.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setAntialiased2dCanvasEnabled):
* src/WebSettingsImpl.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139026 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/page/Settings.in
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebSettings.h
Source/WebKit/chromium/src/WebSettingsImpl.cpp
Source/WebKit/chromium/src/WebSettingsImpl.h

index 9e3f74d..0b46020 100644 (file)
@@ -1,3 +1,17 @@
+2013-01-07  Stephen White  <senorblanco@chromium.org>
+
+        Add a flag to control canvas antialiasing.
+        https://bugs.webkit.org/show_bug.cgi?id=106255
+
+        Reviewed by Darin Fisher.
+
+        This flag is not exposed through TestRunner or DRT, so no testing is
+        possible yet.
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::createImageBuffer):
+        * page/Settings.in:
+
 2013-01-07  Julien Chaffraix  <jchaffraix@webkit.org>
 
         [CSS Grid Layout] Implement grid items sizing for fixed minmax grid tracks
index 77a4bea..fc40414 100644 (file)
@@ -570,6 +570,8 @@ void HTMLCanvasElement::createImageBuffer() const
         return;
     m_imageBuffer->context()->setShadowsIgnoreTransforms(true);
     m_imageBuffer->context()->setImageInterpolationQuality(DefaultInterpolationQuality);
+    if (document()->settings() && !document()->settings()->antialiased2dCanvasEnabled())
+        m_imageBuffer->context()->setShouldAntialias(false);
     m_imageBuffer->context()->setStrokeThickness(1);
     m_contextStateSaver = adoptPtr(new GraphicsContextStateSaver(*m_imageBuffer->context()));
 
index fe3c8da..dc72dd4 100644 (file)
@@ -101,6 +101,7 @@ openGLMultisamplingEnabled initial=true
 privilegedWebGLExtensionsEnabled initial=false
 accelerated2dCanvasEnabled initial=false
 deferred2dCanvasEnabled initial=false
+antialiased2dCanvasEnabled initial=true
 loadDeferringEnabled initial=true
 webAudioEnabled initial=false
 paginateDuringLayoutEnabled initial=false
index e318ffc..3de4d39 100644 (file)
@@ -1,3 +1,15 @@
+2013-01-07  Stephen White  <senorblanco@chromium.org>
+
+        Add a flag to control canvas antialiasing.
+        https://bugs.webkit.org/show_bug.cgi?id=106255
+
+        Reviewed by Darin Fisher.
+
+        * public/WebSettings.h:
+        * src/WebSettingsImpl.cpp:
+        (WebKit::WebSettingsImpl::setAntialiased2dCanvasEnabled):
+        * src/WebSettingsImpl.h:
+
 2013-01-07  Yusuf Ozuysal  <yusufo@google.com>
 
         Don't use double tap zoom if minimum and maximum page scale is the same
index 974dbeb..54a7a29 100644 (file)
@@ -72,6 +72,7 @@ public:
     virtual void setAllowRunningOfInsecureContent(bool) = 0;
     virtual void setAllowScriptsToCloseWindows(bool) = 0;
     virtual void setAllowUniversalAccessFromFileURLs(bool) = 0;
+    virtual void setAntialiased2dCanvasEnabled(bool) = 0;
     virtual void setApplyDeviceScaleFactorInCompositor(bool) = 0;
     virtual void setApplyPageScaleFactorInCompositor(bool) = 0;
     virtual void setAsynchronousSpellCheckingEnabled(bool) = 0;
index 07c1312..211ef55 100644 (file)
@@ -504,6 +504,11 @@ void WebSettingsImpl::setAccelerated2dCanvasEnabled(bool enabled)
     m_settings->setAccelerated2dCanvasEnabled(enabled);
 }
 
+void WebSettingsImpl::setAntialiased2dCanvasEnabled(bool enabled)
+{
+    m_settings->setAntialiased2dCanvasEnabled(enabled);
+}
+
 void WebSettingsImpl::setDeferred2dCanvasEnabled(bool enabled)
 {
     m_settings->setDeferred2dCanvasEnabled(enabled);
index 04f2e87..ce2d7aa 100644 (file)
@@ -66,6 +66,7 @@ public:
     virtual void setAllowRunningOfInsecureContent(bool);
     virtual void setAllowScriptsToCloseWindows(bool);
     virtual void setAllowUniversalAccessFromFileURLs(bool);
+    virtual void setAntialiased2dCanvasEnabled(bool);
     virtual void setApplyDeviceScaleFactorInCompositor(bool);
     virtual void setApplyPageScaleFactorInCompositor(bool);
     virtual void setAsynchronousSpellCheckingEnabled(bool);