Changeset 49909 in webkit
- Timestamp:
- Oct 21, 2009 11:23:12 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49907 r49909 1 2009-10-21 Adam Langley <agl@google.com> 2 3 Reviewed by Eric Seidel. 4 5 Chromium Linux: disable subpixel text on layers. 6 7 https://bugs.webkit.org/show_bug.cgi?id=30635 8 http://code.google.com/p/chromium/issues/detail?id=25365 9 10 With the addition of layers for drawing rounded corners in r49641, 11 subpixel text on rounded rectangles broke. This is because the layer 12 only contains a single alpha channel and this is insufficient to 13 compose subpixel text correctly. 14 15 On Windows, a large body of code in TransparencyWin.cpp exists to try 16 to deal with this. Even then, in some cases, it downgrades to 17 anti-aliased text. We need a fix for the grevious effects quickly thus 18 this patch disables subpixel text when rendering into a layer. 19 20 This would be covered by existing tests except that subpixel text is 21 disabled for pixel tests on Chromium Linux. 22 23 * platform/graphics/chromium/FontLinux.cpp: 24 (WebCore::isCanvasMultiLayered): 25 (WebCore::adjustTextRenderMode): 26 (WebCore::Font::drawGlyphs): 27 (WebCore::Font::drawComplexText): 28 1 29 2009-10-21 Kevin Ollivier <kevino@theolliviers.com> 2 30 -
trunk/WebCore/platform/graphics/chromium/FontLinux.cpp
r47998 r49909 58 58 } 59 59 60 static bool isCanvasMultiLayered(SkCanvas* canvas) 61 { 62 SkCanvas::LayerIter layerIterator(canvas, false); 63 layerIterator.next(); 64 return !layerIterator.done(); 65 } 66 67 static bool adjustTextRenderMode(SkPaint* paint, bool isCanvasMultiLayered) 68 { 69 // Our layers only have a single alpha channel. This means that subpixel 70 // rendered text cannot be compositied correctly when the layer is 71 // collapsed. Therefore, subpixel text is disabled when we are drawing 72 // onto a layer. 73 if (isCanvasMultiLayered) 74 paint->setLCDRenderText(false); 75 } 76 60 77 void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, 61 78 const GlyphBuffer& glyphBuffer, int from, int numGlyphs, … … 85 102 SkCanvas* canvas = gc->platformContext()->canvas(); 86 103 int textMode = gc->platformContext()->getTextDrawingMode(); 104 bool haveMultipleLayers = isCanvasMultiLayered(canvas); 87 105 88 106 // We draw text up to two times (once for fill, once for stroke). … … 91 109 gc->platformContext()->setupPaintForFilling(&paint); 92 110 font->platformData().setupPaint(&paint); 111 adjustTextRenderMode(&paint, haveMultipleLayers); 93 112 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 94 113 paint.setColor(gc->fillColor().rgb()); … … 103 122 gc->platformContext()->setupPaintForStroking(&paint, 0, 0); 104 123 font->platformData().setupPaint(&paint); 124 adjustTextRenderMode(&paint, haveMultipleLayers); 105 125 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 106 126 paint.setColor(gc->strokeColor().rgb()); … … 473 493 474 494 TextRunWalker walker(run, point.x(), this); 495 bool haveMultipleLayers = isCanvasMultiLayered(canvas); 475 496 476 497 while (walker.nextScriptRun()) { 477 498 if (fill) { 478 499 walker.fontPlatformDataForScriptRun()->setupPaint(&fillPaint); 500 adjustTextRenderMode(&fillPaint, haveMultipleLayers); 479 501 canvas->drawPosTextH(walker.glyphs(), walker.length() << 1, walker.xPositions(), point.y(), fillPaint); 480 502 } … … 482 504 if (stroke) { 483 505 walker.fontPlatformDataForScriptRun()->setupPaint(&strokePaint); 506 adjustTextRenderMode(&strokePaint, haveMultipleLayers); 484 507 canvas->drawPosTextH(walker.glyphs(), walker.length() << 1, walker.xPositions(), point.y(), strokePaint); 485 508 }
Note: See TracChangeset
for help on using the changeset viewer.