[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

agl at chromium.org agl at chromium.org
Thu Oct 29 20:49:39 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit b2e18e9ab410c67c4e7f5cdfff3dceed25525f56
Author: agl at chromium.org <agl at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 21 18:23:12 2009 +0000

    2009-10-21  Adam Langley  <agl at google.com>
    
            Reviewed by Eric Seidel.
    
            Chromium Linux: disable subpixel text on layers.
    
            https://bugs.webkit.org/show_bug.cgi?id=30635
            http://code.google.com/p/chromium/issues/detail?id=25365
    
            With the addition of layers for drawing rounded corners in r49641,
            subpixel text on rounded rectangles broke. This is because the layer
            only contains a single alpha channel and this is insufficient to
            compose subpixel text correctly.
    
            On Windows, a large body of code in TransparencyWin.cpp exists to try
            to deal with this. Even then, in some cases, it downgrades to
            anti-aliased text. We need a fix for the grevious effects quickly thus
            this patch disables subpixel text when rendering into a layer.
    
            This would be covered by existing tests except that subpixel text is
            disabled for pixel tests on Chromium Linux.
    
            * platform/graphics/chromium/FontLinux.cpp:
            (WebCore::isCanvasMultiLayered):
            (WebCore::adjustTextRenderMode):
            (WebCore::Font::drawGlyphs):
            (WebCore::Font::drawComplexText):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49909 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index da20dd3..038dd79 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,31 @@
+2009-10-21  Adam Langley  <agl at google.com>
+
+        Reviewed by Eric Seidel.
+
+        Chromium Linux: disable subpixel text on layers.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30635
+        http://code.google.com/p/chromium/issues/detail?id=25365
+
+        With the addition of layers for drawing rounded corners in r49641,
+        subpixel text on rounded rectangles broke. This is because the layer
+        only contains a single alpha channel and this is insufficient to
+        compose subpixel text correctly.
+
+        On Windows, a large body of code in TransparencyWin.cpp exists to try
+        to deal with this. Even then, in some cases, it downgrades to
+        anti-aliased text. We need a fix for the grevious effects quickly thus
+        this patch disables subpixel text when rendering into a layer.
+
+        This would be covered by existing tests except that subpixel text is
+        disabled for pixel tests on Chromium Linux.
+
+        * platform/graphics/chromium/FontLinux.cpp:
+        (WebCore::isCanvasMultiLayered):
+        (WebCore::adjustTextRenderMode):
+        (WebCore::Font::drawGlyphs):
+        (WebCore::Font::drawComplexText):
+
 2009-10-21  Kevin Ollivier  <kevino at theolliviers.com>
 
         wxMac 10.4 build fix, make sure we specify the Sqlite3 dependency correctly as otherwise
diff --git a/WebCore/platform/graphics/chromium/FontLinux.cpp b/WebCore/platform/graphics/chromium/FontLinux.cpp
index dca0efb..38e7682 100644
--- a/WebCore/platform/graphics/chromium/FontLinux.cpp
+++ b/WebCore/platform/graphics/chromium/FontLinux.cpp
@@ -57,6 +57,23 @@ bool Font::canReturnFallbackFontsForComplexText()
     return false;
 }
 
+static bool isCanvasMultiLayered(SkCanvas* canvas)
+{
+    SkCanvas::LayerIter layerIterator(canvas, false);
+    layerIterator.next();
+    return !layerIterator.done();
+}
+
+static bool adjustTextRenderMode(SkPaint* paint, bool isCanvasMultiLayered)
+{
+    // 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)
+        paint->setLCDRenderText(false);
+}
+
 void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
                       const GlyphBuffer& glyphBuffer,  int from, int numGlyphs,
                       const FloatPoint& point) const {
@@ -84,12 +101,14 @@ 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);
         paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
         paint.setColor(gc->fillColor().rgb());
         canvas->drawPosText(glyphs, numGlyphs << 1, pos, paint);
@@ -102,6 +121,7 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
         SkPaint paint;
         gc->platformContext()->setupPaintForStroking(&paint, 0, 0);
         font->platformData().setupPaint(&paint);
+        adjustTextRenderMode(&paint, haveMultipleLayers);
         paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
         paint.setColor(gc->strokeColor().rgb());
 
@@ -472,15 +492,18 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run,
     }
 
     TextRunWalker walker(run, point.x(), this);
+    bool haveMultipleLayers = isCanvasMultiLayered(canvas);
 
     while (walker.nextScriptRun()) {
         if (fill) {
             walker.fontPlatformDataForScriptRun()->setupPaint(&fillPaint);
+            adjustTextRenderMode(&fillPaint, haveMultipleLayers);
             canvas->drawPosTextH(walker.glyphs(), walker.length() << 1, walker.xPositions(), point.y(), fillPaint);
         }
 
         if (stroke) {
             walker.fontPlatformDataForScriptRun()->setupPaint(&strokePaint);
+            adjustTextRenderMode(&strokePaint, haveMultipleLayers);
             canvas->drawPosTextH(walker.glyphs(), walker.length() << 1, walker.xPositions(), point.y(), strokePaint);
         }
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list