[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

jamesr at google.com jamesr at google.com
Wed Dec 22 13:15:24 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 322477559a462de2e07a9be29154e8939a4f4207
Author: jamesr at google.com <jamesr at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 9 23:44:38 2010 +0000

    2010-09-09  Alexey Marinichev  <amarinichev at chromium.org>
    
            Reviewed by James Robinson.
    
            [chromium] Disable subpixel rendering in Linux when GPU compositor is active
            https://bugs.webkit.org/show_bug.cgi?id=45087
    
            Covered by all tests that activate the compositor and contain text.
    
            * platform/graphics/chromium/ContentLayerChromium.cpp:
            (WebCore::ContentLayerChromium::updateContents):
            * platform/graphics/chromium/FontLinux.cpp:
            (WebCore::adjustTextRenderMode): Added a check to see if the compositor is active.
            (WebCore::Font::drawGlyphs):
            (WebCore::Font::drawComplexText):
            * platform/graphics/chromium/LayerRendererChromium.cpp:
            (WebCore::LayerRendererChromium::setRootLayerCanvasSize):
            * platform/graphics/chromium/VideoLayerChromium.cpp:
            (WebCore::VideoLayerChromium::updateContents):
            * platform/graphics/skia/ImageBufferSkia.cpp:
            (WebCore::ImageBuffer::ImageBuffer):
            (WebCore::ImageBuffer::clip):
            * platform/graphics/skia/PlatformContextSkia.cpp:
            Made setDrawingToImageBuffer and isDrawingToImageBuffer available to
            Linux; removed all #if OS(WINDOWS) || OS(LINUX).
            (WebCore::PlatformContextSkia::State::State):
            (WebCore::PlatformContextSkia::PlatformContextSkia):
            (WebCore::PlatformContextSkia::isDrawingToImageBuffer):
            (WebCore::PlatformContextSkia::save):
            (WebCore::PlatformContextSkia::beginLayerClippedToImage):
            (WebCore::PlatformContextSkia::restore):
            (WebCore::PlatformContextSkia::applyClipFromImage):
            * platform/graphics/skia/PlatformContextSkia.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67126 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 78d98c4..77c42e6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-09-09  Alexey Marinichev  <amarinichev at chromium.org>
+
+        Reviewed by James Robinson.
+
+        [chromium] Disable subpixel rendering in Linux when GPU compositor is active
+        https://bugs.webkit.org/show_bug.cgi?id=45087
+
+        Covered by all tests that activate the compositor and contain text.
+
+        * platform/graphics/chromium/ContentLayerChromium.cpp:
+        (WebCore::ContentLayerChromium::updateContents):
+        * platform/graphics/chromium/FontLinux.cpp:
+        (WebCore::adjustTextRenderMode): Added a check to see if the compositor is active.
+        (WebCore::Font::drawGlyphs):
+        (WebCore::Font::drawComplexText):
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::setRootLayerCanvasSize):
+        * platform/graphics/chromium/VideoLayerChromium.cpp:
+        (WebCore::VideoLayerChromium::updateContents):
+        * platform/graphics/skia/ImageBufferSkia.cpp:
+        (WebCore::ImageBuffer::ImageBuffer):
+        (WebCore::ImageBuffer::clip):
+        * platform/graphics/skia/PlatformContextSkia.cpp:
+        Made setDrawingToImageBuffer and isDrawingToImageBuffer available to
+        Linux; removed all #if OS(WINDOWS) || OS(LINUX).
+        (WebCore::PlatformContextSkia::State::State):
+        (WebCore::PlatformContextSkia::PlatformContextSkia):
+        (WebCore::PlatformContextSkia::isDrawingToImageBuffer):
+        (WebCore::PlatformContextSkia::save):
+        (WebCore::PlatformContextSkia::beginLayerClippedToImage):
+        (WebCore::PlatformContextSkia::restore):
+        (WebCore::PlatformContextSkia::applyClipFromImage):
+        * platform/graphics/skia/PlatformContextSkia.h:
+
 2010-09-09  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
index 5c8b869..48119bb 100644
--- a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
@@ -176,14 +176,9 @@ void ContentLayerChromium::updateContents()
     canvas.set(new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), false));
     skiaContext.set(new PlatformContextSkia(canvas.get()));
 
-#if OS(WINDOWS)
-    // This is needed to get text to show up correctly. Without it,
-    // GDI renders with zero alpha and the text becomes invisible.
-    // Unfortunately, setting this to true disables cleartype.
+    // This is needed to get text to show up correctly.
     // FIXME: Does this take us down a very slow text rendering path?
-    // FIXME: why is this is a windows-only call ?
     skiaContext->setDrawingToImageBuffer(true);
-#endif
 
     graphicsContext.set(new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(skiaContext.get())));
 
diff --git a/WebCore/platform/graphics/chromium/FontLinux.cpp b/WebCore/platform/graphics/chromium/FontLinux.cpp
index ab3045e..696cd9c 100644
--- a/WebCore/platform/graphics/chromium/FontLinux.cpp
+++ b/WebCore/platform/graphics/chromium/FontLinux.cpp
@@ -65,13 +65,13 @@ static bool isCanvasMultiLayered(SkCanvas* canvas)
     return !layerIterator.done();
 }
 
-static void adjustTextRenderMode(SkPaint* paint, bool isCanvasMultiLayered)
+static void adjustTextRenderMode(SkPaint* paint, PlatformContextSkia* skiaContext)
 {
     // Our layers only have a single alpha channel. This means that subpixel
     // rendered text cannot be compositied correctly when the layer is
     // collapsed. Therefore, subpixel text is disabled when we are drawing
-    // onto a layer.
-    if (isCanvasMultiLayered)
+    // onto a layer or when the compositor is being used.
+    if (isCanvasMultiLayered(skiaContext->canvas()) || skiaContext->isDrawingToImageBuffer())
         paint->setLCDRenderText(false);
 }
 
@@ -104,14 +104,13 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
 
     SkCanvas* canvas = gc->platformContext()->canvas();
     int textMode = gc->platformContext()->getTextDrawingMode();
-    bool haveMultipleLayers = isCanvasMultiLayered(canvas);
 
     // We draw text up to two times (once for fill, once for stroke).
     if (textMode & cTextFill) {
         SkPaint paint;
         gc->platformContext()->setupPaintForFilling(&paint);
         font->platformData().setupPaint(&paint);
-        adjustTextRenderMode(&paint, haveMultipleLayers);
+        adjustTextRenderMode(&paint, gc->platformContext());
         paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
         paint.setColor(gc->fillColor().rgb());
         canvas->drawPosText(glyphs, numGlyphs << 1, pos, paint);
@@ -124,7 +123,7 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
         SkPaint paint;
         gc->platformContext()->setupPaintForStroking(&paint, 0, 0);
         font->platformData().setupPaint(&paint);
-        adjustTextRenderMode(&paint, haveMultipleLayers);
+        adjustTextRenderMode(&paint, gc->platformContext());
         paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
         paint.setColor(gc->strokeColor().rgb());
 
@@ -646,7 +645,6 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run,
     }
 
     TextRunWalker walker(run, point.x(), this);
-    bool haveMultipleLayers = isCanvasMultiLayered(canvas);
     walker.setWordSpacingAdjustment(wordSpacing());
     walker.setLetterSpacingAdjustment(letterSpacing());
     walker.setPadding(run.padding());
@@ -654,13 +652,13 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run,
     while (walker.nextScriptRun()) {
         if (fill) {
             walker.fontPlatformDataForScriptRun()->setupPaint(&fillPaint);
-            adjustTextRenderMode(&fillPaint, haveMultipleLayers);
+            adjustTextRenderMode(&fillPaint, gc->platformContext());
             canvas->drawPosTextH(walker.glyphs(), walker.length() << 1, walker.xPositions(), point.y(), fillPaint);
         }
 
         if (stroke) {
             walker.fontPlatformDataForScriptRun()->setupPaint(&strokePaint);
-            adjustTextRenderMode(&strokePaint, haveMultipleLayers);
+            adjustTextRenderMode(&strokePaint, gc->platformContext());
             canvas->drawPosTextH(walker.glyphs(), walker.length() << 1, walker.xPositions(), point.y(), strokePaint);
         }
     }
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index 789298a..4708310 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -125,10 +125,7 @@ void LayerRendererChromium::setRootLayerCanvasSize(const IntSize& size)
     // the old ones.
     m_rootLayerCanvas = new skia::PlatformCanvas(size.width(), size.height(), false);
     m_rootLayerSkiaContext = new PlatformContextSkia(m_rootLayerCanvas.get());
-#if OS(WINDOWS)
-    // FIXME: why is this is a windows-only call ?
     m_rootLayerSkiaContext->setDrawingToImageBuffer(true);
-#endif
     m_rootLayerGraphicsContext = new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_rootLayerSkiaContext.get()));
 #elif PLATFORM(CG)
     // Release the previous CGBitmapContext before reallocating the backing store as a precaution.
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
index 7ff98b9..c0da285 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
@@ -96,14 +96,9 @@ void VideoLayerChromium::updateContents()
         m_canvas = new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), true);
         m_skiaContext = new PlatformContextSkia(m_canvas.get());
 
-#if OS(WINDOWS)
-        // This is needed to get text to show up correctly. Without it,
-        // GDI renders with zero alpha and the text becomes invisible.
-        // Unfortunately, setting this to true disables cleartype.
+        // This is needed to get text to show up correctly.
         // FIXME: Does this take us down a very slow text rendering path?
-        // FIXME: Why is this is a windows-only call?
         m_skiaContext->setDrawingToImageBuffer(true);
-#endif
         m_graphicsContext = new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_skiaContext.get()));
     }
 
diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
index 9c96673..2be7dc5 100644
--- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
@@ -69,9 +69,7 @@ ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace imageColorSpace, b
 
     m_data.m_platformContext.setCanvas(&m_data.m_canvas);
     m_context.set(new GraphicsContext(&m_data.m_platformContext));
-#if OS(WINDOWS)
     m_context->platformContext()->setDrawingToImageBuffer(true);
-#endif
 
     // Make the background transparent. It would be nice if this wasn't
     // required, but the canvas is currently filled with the magic transparency
@@ -102,9 +100,7 @@ PassRefPtr<Image> ImageBuffer::copyImage() const
 
 void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const
 {
-#if OS(LINUX) || OS(WINDOWS)
     context->platformContext()->beginLayerClippedToImage(rect, this);
-#endif
 }
 
 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect,
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
index f0d6548..f0073e2 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
@@ -97,12 +97,10 @@ struct PlatformContextSkia::State {
     // color to produce a new output color.
     SkColor applyAlpha(SkColor) const;
 
-#if OS(LINUX) || OS(WINDOWS)
     // If non-empty, the current State is clipped to this image.
     SkBitmap m_imageBufferClip;
     // If m_imageBufferClip is non-empty, this is the region the image is clipped to.
     FloatRect m_clip;
-#endif
 
     // This is a list of clipping paths which are currently active, in the
     // order in which they were pushed.
@@ -158,10 +156,8 @@ PlatformContextSkia::State::State(const State& other)
     , m_lineJoin(other.m_lineJoin)
     , m_dash(other.m_dash)
     , m_textDrawingMode(other.m_textDrawingMode)
-#if OS(LINUX) || OS(WINDOWS)
     , m_imageBufferClip(other.m_imageBufferClip)
     , m_clip(other.m_clip)
-#endif
     , m_antiAliasClipPaths(other.m_antiAliasClipPaths)
     , m_interpolationQuality(other.m_interpolationQuality)
     , m_canvasClipApplied(other.m_canvasClipApplied)
@@ -209,9 +205,7 @@ SkColor PlatformContextSkia::State::applyAlpha(SkColor c) const
 // Danger: canvas can be NULL.
 PlatformContextSkia::PlatformContextSkia(skia::PlatformCanvas* canvas)
     : m_canvas(canvas)
-#if OS(WINDOWS)
     , m_drawingToImageBuffer(false)
-#endif
     , m_useGPU(false)
     , m_gpuCanvas(0)
     , m_backingStoreState(None)
@@ -231,7 +225,6 @@ void PlatformContextSkia::setCanvas(skia::PlatformCanvas* canvas)
     m_canvas = canvas;
 }
 
-#if OS(WINDOWS)
 void PlatformContextSkia::setDrawingToImageBuffer(bool value)
 {
     m_drawingToImageBuffer = value;
@@ -241,7 +234,6 @@ bool PlatformContextSkia::isDrawingToImageBuffer() const
 {
     return m_drawingToImageBuffer;
 }
-#endif
 
 void PlatformContextSkia::save()
 {
@@ -250,17 +242,14 @@ void PlatformContextSkia::save()
     m_stateStack.append(m_state->cloneInheritedProperties());
     m_state = &m_stateStack.last();
 
-#if OS(LINUX) || OS(WINDOWS)
     // The clip image only needs to be applied once. Reset the image so that we
     // don't attempt to clip multiple times.
     m_state->m_imageBufferClip.reset();
-#endif
 
     // Save our native canvas.
     canvas()->save();
 }
 
-#if OS(LINUX) || OS(WINDOWS)
 void PlatformContextSkia::beginLayerClippedToImage(const FloatRect& rect,
                                                    const ImageBuffer* imageBuffer)
 {
@@ -289,7 +278,6 @@ void PlatformContextSkia::beginLayerClippedToImage(const FloatRect& rect,
         m_state->m_imageBufferClip = *bitmap;
     }
 }
-#endif
 
 void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath)
 {
@@ -308,12 +296,10 @@ void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath)
 
 void PlatformContextSkia::restore()
 {
-#if OS(LINUX) || OS(WINDOWS)
     if (!m_state->m_imageBufferClip.empty()) {
         applyClipFromImage(m_state->m_clip, m_state->m_imageBufferClip);
         canvas()->restore();
     }
-#endif
 
     if (!m_state->m_antiAliasClipPaths.isEmpty())
         applyAntiAliasedClipPaths(m_state->m_antiAliasClipPaths);
@@ -638,7 +624,6 @@ bool PlatformContextSkia::hasImageResamplingHint() const
     return !m_imageResamplingHintSrcSize.isEmpty() && !m_imageResamplingHintDstSize.isEmpty();
 }
 
-#if OS(LINUX) || OS(WINDOWS)
 void PlatformContextSkia::applyClipFromImage(const FloatRect& rect, const SkBitmap& imageBuffer)
 {
     // NOTE: this assumes the image mask contains opaque black for the portions that are to be shown, as such we
@@ -647,7 +632,6 @@ void PlatformContextSkia::applyClipFromImage(const FloatRect& rect, const SkBitm
     paint.setXfermodeMode(SkXfermode::kDstIn_Mode);
     m_canvas->drawBitmap(imageBuffer, SkFloatToScalar(rect.x()), SkFloatToScalar(rect.y()), &paint);
 }
-#endif
 
 void PlatformContextSkia::applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths)
 {
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.h b/WebCore/platform/graphics/skia/PlatformContextSkia.h
index e6d5875..4ba85d1 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.h
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.h
@@ -78,7 +78,6 @@ public:
     // to the constructor.
     void setCanvas(skia::PlatformCanvas*);
 
-#if OS(WINDOWS)
     // If false we're rendering to a GraphicsContext for a web page, if false
     // we're not (as is the case when rendering to a canvas object).
     // If this is true the contents have not been marked up with the magic
@@ -86,7 +85,6 @@ public:
     // correctly updated.
     void setDrawingToImageBuffer(bool);
     bool isDrawingToImageBuffer() const;
-#endif
 
     void save();
     void restore();
@@ -95,9 +93,7 @@ public:
     // |rect|. This layer is implicitly restored when the next restore is
     // invoked.
     // NOTE: |imageBuffer| may be deleted before the |restore| is invoked.
-#if OS(LINUX) || OS(WINDOWS)
     void beginLayerClippedToImage(const FloatRect&, const ImageBuffer*);
-#endif
     void clipPathAntiAliased(const SkPath&);
 
     // Sets up the common flags on a paint for antialiasing, effects, etc.
@@ -197,11 +193,9 @@ public:
     void markDirtyRect(const IntRect& rect);
 
 private:
-#if OS(LINUX) || OS(WINDOWS)
     // Used when restoring and the state has an image clip. Only shows the pixels in
     // m_canvas that are also in imageBuffer.
     void applyClipFromImage(const FloatRect&, const SkBitmap&);
-#endif
     void applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths);
 
     void uploadSoftwareToHardware(CompositeOperator) const;
@@ -227,9 +221,7 @@ private:
     // Values are used in ImageSkia.cpp
     IntSize m_imageResamplingHintSrcSize;
     FloatSize m_imageResamplingHintDstSize;
-#if OS(WINDOWS)
     bool m_drawingToImageBuffer;
-#endif
     bool m_useGPU;
     OwnPtr<GLES2Canvas> m_gpuCanvas;
     mutable enum { None, Software, Mixed, Hardware } m_backingStoreState;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list