Title: [138987] trunk/Source
Revision
138987
Author
[email protected]
Date
2013-01-07 14:05:33 -0800 (Mon, 07 Jan 2013)

Log Message

[chromium] Fix PlatformContextSkia::setDrawingToImageBuffer abuse
https://bugs.webkit.org/show_bug.cgi?id=104956

Reviewed by James Robinson.

Replaced PlatformContextSkia::SetDrawingToImageBuffer with GraphicsContext::setShouldSmoothFonts.

Source/WebCore:

No new tests needed. No change in functionality.

* platform/graphics/chromium/CompositorHUDFontAtlas.cpp:
(WebCore::CompositorHUDFontAtlas::generateFontAtlas):
* platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp:
(WebCore::OpaqueRectTrackingContentLayerDelegate::paintContents):
* platform/graphics/skia/ImageBufferSkia.cpp:
(WebCore::ImageBuffer::ImageBuffer):
* platform/graphics/skia/PlatformContextSkia.cpp:
(WebCore::PlatformContextSkia::couldUseLCDRenderedText):
(WebCore):

Source/WebKit/chromium:

* src/NonCompositedContentHost.cpp:
(WebKit::NonCompositedContentHost::paintContents):
(WebKit):
(WebKit::NonCompositedContentHost::setShowDebugBorders):
* src/PageWidgetDelegate.cpp:
(WebKit::PageWidgetDelegate::paint):
* src/WebFontImpl.cpp:
(WebKit::WebFontImpl::drawText):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138986 => 138987)


--- trunk/Source/WebCore/ChangeLog	2013-01-07 22:03:53 UTC (rev 138986)
+++ trunk/Source/WebCore/ChangeLog	2013-01-07 22:05:33 UTC (rev 138987)
@@ -1,3 +1,24 @@
+2013-01-07  Alok Priyadarshi  <[email protected]>
+
+        [chromium] Fix PlatformContextSkia::setDrawingToImageBuffer abuse
+        https://bugs.webkit.org/show_bug.cgi?id=104956
+
+        Reviewed by James Robinson.
+
+        Replaced PlatformContextSkia::SetDrawingToImageBuffer with GraphicsContext::setShouldSmoothFonts.
+
+        No new tests needed. No change in functionality.
+
+        * platform/graphics/chromium/CompositorHUDFontAtlas.cpp:
+        (WebCore::CompositorHUDFontAtlas::generateFontAtlas):
+        * platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp:
+        (WebCore::OpaqueRectTrackingContentLayerDelegate::paintContents):
+        * platform/graphics/skia/ImageBufferSkia.cpp:
+        (WebCore::ImageBuffer::ImageBuffer):
+        * platform/graphics/skia/PlatformContextSkia.cpp:
+        (WebCore::PlatformContextSkia::couldUseLCDRenderedText):
+        (WebCore):
+
 2013-01-07  Enrica Casucci  <[email protected]>
 
         Some characters are not rotated properly in vertical text

Modified: trunk/Source/WebCore/platform/graphics/chromium/CompositorHUDFontAtlas.cpp (138986 => 138987)


--- trunk/Source/WebCore/platform/graphics/chromium/CompositorHUDFontAtlas.cpp	2013-01-07 22:03:53 UTC (rev 138986)
+++ trunk/Source/WebCore/platform/graphics/chromium/CompositorHUDFontAtlas.cpp	2013-01-07 22:05:33 UTC (rev 138987)
@@ -60,8 +60,8 @@
     OwnPtr<SkCanvas> canvas = adoptPtr(skia::CreateBitmapCanvas(ATLAS_SIZE, ATLAS_SIZE, false /* opaque */));
 
     PlatformContextSkia platformContext(canvas.get());
-    platformContext.setDrawingToImageBuffer(true);
     GraphicsContext atlasContext(&platformContext);
+    atlasContext.setShouldSmoothFonts(false);
 
     // Clear the entire texture atlas to transparent before drawing fonts.
     atlasContext.setFillColor(Color(0, 0, 0, 0), ColorSpaceDeviceRGB);

Modified: trunk/Source/WebCore/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp (138986 => 138987)


--- trunk/Source/WebCore/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp	2013-01-07 22:03:53 UTC (rev 138986)
+++ trunk/Source/WebCore/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp	2013-01-07 22:05:33 UTC (rev 138987)
@@ -57,11 +57,8 @@
         platformContext.setHintingScaleFactor(canvas->getTotalMatrix().getScaleX());
 #endif
     platformContext.setTrackOpaqueRegion(!m_opaque);
-    // FIXME: Rename PlatformContextSkia::setDrawingToImageBuffer to setCanPaintLCDText.
-    // I also suspect that a function on PlatformContextSkia is not really needed.
-    // GraphicsContext::setAllowsFontSmoothing can be used for this purpose.
-    platformContext.setDrawingToImageBuffer(!(canPaintLCDText && m_opaque));
     GraphicsContext context(&platformContext);
+    context.setShouldSmoothFonts(canPaintLCDText && m_opaque);
 
     // Record transform prior to painting, as all opaque tracking will be
     // relative to this current value.

Modified: trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (138986 => 138987)


--- trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp	2013-01-07 22:03:53 UTC (rev 138986)
+++ trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp	2013-01-07 22:05:33 UTC (rev 138987)
@@ -138,7 +138,7 @@
     m_data.m_canvas = adoptPtr(new SkCanvas(device));
     m_data.m_platformContext.setCanvas(m_data.m_canvas.get());
     m_context = adoptPtr(new GraphicsContext(&m_data.m_platformContext));
-    m_context->platformContext()->setDrawingToImageBuffer(true);
+    m_context->setShouldSmoothFonts(false);
     m_context->scale(FloatSize(m_resolutionScale, m_resolutionScale));
 
     success = true;
@@ -168,7 +168,7 @@
     m_data.m_canvas = canvas.release();
     m_data.m_platformContext.setCanvas(m_data.m_canvas.get());
     m_context = adoptPtr(new GraphicsContext(&m_data.m_platformContext));
-    m_context->platformContext()->setDrawingToImageBuffer(true);
+    m_context->setShouldSmoothFonts(false);
     m_context->scale(FloatSize(m_resolutionScale, m_resolutionScale));
 
     // Make the background transparent. It would be nice if this wasn't

Modified: trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp (138986 => 138987)


--- trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp	2013-01-07 22:03:53 UTC (rev 138986)
+++ trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp	2013-01-07 22:05:33 UTC (rev 138987)
@@ -629,9 +629,7 @@
     if (isDrawingToLayer())
         return false;
 
-    // If this text is not in an image buffer and so won't be externally
-    // composited, then subpixel antialiasing is fine.
-    return !isDrawingToImageBuffer();
+    return m_gc->shouldSmoothFonts();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/chromium/ChangeLog (138986 => 138987)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-01-07 22:03:53 UTC (rev 138986)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-01-07 22:05:33 UTC (rev 138987)
@@ -1,3 +1,21 @@
+2013-01-07  Alok Priyadarshi  <[email protected]>
+
+        [chromium] Fix PlatformContextSkia::setDrawingToImageBuffer abuse
+        https://bugs.webkit.org/show_bug.cgi?id=104956
+
+        Reviewed by James Robinson.
+
+        Replaced PlatformContextSkia::SetDrawingToImageBuffer with GraphicsContext::setShouldSmoothFonts.
+
+        * src/NonCompositedContentHost.cpp:
+        (WebKit::NonCompositedContentHost::paintContents):
+        (WebKit):
+        (WebKit::NonCompositedContentHost::setShowDebugBorders):
+        * src/PageWidgetDelegate.cpp:
+        (WebKit::PageWidgetDelegate::paint):
+        * src/WebFontImpl.cpp:
+        (WebKit::WebFontImpl::drawText):
+
 2013-01-07  Mike West  <[email protected]>
 
         Make the IFRAME_SEAMLESS flag runtime-enabled.

Modified: trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp (138986 => 138987)


--- trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp	2013-01-07 22:03:53 UTC (rev 138986)
+++ trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp	2013-01-07 22:05:33 UTC (rev 138987)
@@ -172,13 +172,6 @@
 
 void NonCompositedContentHost::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect)
 {
-    // FIXME: Remove LCD text setting after it is implemented in chromium.
-    // On non-android platforms, we want to render text with subpixel antialiasing on the root layer
-    // so long as the root is opaque. On android all text is grayscale.
-#if !OS(ANDROID)
-    if (m_graphicsLayer->contentsOpaque())
-        context.platformContext()->setDrawingToImageBuffer(false);
-#endif
     context.translate(-m_layerAdjust);
     WebCore::IntRect adjustedClipRect = clipRect;
     adjustedClipRect.move(m_layerAdjust);

Modified: trunk/Source/WebKit/chromium/src/PageWidgetDelegate.cpp (138986 => 138987)


--- trunk/Source/WebKit/chromium/src/PageWidgetDelegate.cpp	2013-01-07 22:03:53 UTC (rev 138986)
+++ trunk/Source/WebKit/chromium/src/PageWidgetDelegate.cpp	2013-01-07 22:05:33 UTC (rev 138987)
@@ -87,7 +87,7 @@
         return;
     GraphicsContextBuilder builder(canvas);
     GraphicsContext& gc = builder.context();
-    gc.platformContext()->setDrawingToImageBuffer(background == Opaque ? false : true);
+    gc.setShouldSmoothFonts(background == Opaque);
     if (applyDeviceScale) {
         gc.applyDeviceScaleFactor(page->deviceScaleFactor());
         gc.platformContext()->setDeviceScaleFactor(page->deviceScaleFactor());

Modified: trunk/Source/WebKit/chromium/src/WebFontImpl.cpp (138986 => 138987)


--- trunk/Source/WebKit/chromium/src/WebFontImpl.cpp	2013-01-07 22:03:53 UTC (rev 138986)
+++ trunk/Source/WebKit/chromium/src/WebFontImpl.cpp	2013-01-07 22:05:33 UTC (rev 138987)
@@ -98,9 +98,8 @@
     GraphicsContextBuilder builder(canvas);
     GraphicsContext& gc = builder.context();
 
-    gc.platformContext()->setDrawingToImageBuffer(!canvasIsOpaque);
-
     gc.save();
+    gc.setShouldSmoothFonts(canvasIsOpaque);
     gc.setFillColor(color, ColorSpaceDeviceRGB);
     gc.clip(WebCore::FloatRect(clip));
     m_font.drawText(&gc, run, leftBaseline, from, to);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to