Title: [91375] trunk/Source/WebCore
- Revision
- 91375
- Author
- commit-qu...@webkit.org
- Date
- 2011-07-20 09:42:51 -0700 (Wed, 20 Jul 2011)
Log Message
[skia] disable lcd text when drawing on a transparent layer or canvas
https://bugs.webkit.org/show_bug.cgi?id=64873
Patch by Mike Reed <r...@google.com> on 2011-07-20
Reviewed by Stephen White.
No new tests. canvas sites illustrate the bug. DRT disables LCD
so existing layouttests are not affected by this change.
* platform/graphics/skia/SkiaFontWin.cpp:
(WebCore::isCanvasMultiLayered):
(WebCore::disableTextLCD):
(WebCore::setupPaintForFont):
(WebCore::paintSkiaText):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (91374 => 91375)
--- trunk/Source/WebCore/ChangeLog 2011-07-20 16:33:27 UTC (rev 91374)
+++ trunk/Source/WebCore/ChangeLog 2011-07-20 16:42:51 UTC (rev 91375)
@@ -1,3 +1,19 @@
+2011-07-20 Mike Reed <r...@google.com>
+
+ [skia] disable lcd text when drawing on a transparent layer or canvas
+ https://bugs.webkit.org/show_bug.cgi?id=64873
+
+ Reviewed by Stephen White.
+
+ No new tests. canvas sites illustrate the bug. DRT disables LCD
+ so existing layouttests are not affected by this change.
+
+ * platform/graphics/skia/SkiaFontWin.cpp:
+ (WebCore::isCanvasMultiLayered):
+ (WebCore::disableTextLCD):
+ (WebCore::setupPaintForFont):
+ (WebCore::paintSkiaText):
+
2011-07-20 Ilya Tikhonovsky <loi...@chromium.org>
Web Inspector: add keyboard shortcuts to load/save operations in Timeline panel.
Modified: trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp (91374 => 91375)
--- trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp 2011-07-20 16:33:27 UTC (rev 91374)
+++ trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp 2011-07-20 16:42:51 UTC (rev 91375)
@@ -118,8 +118,26 @@
canvas->drawPosText(glyphs, numGlyphs * sizeof(uint16_t), pos, *paint);
}
-static void setupPaintForFont(HFONT hfont, SkPaint* paint)
+static bool isCanvasMultiLayered(SkCanvas* canvas)
{
+ SkCanvas::LayerIter layerIterator(canvas, false);
+ layerIterator.next();
+ return !layerIterator.done();
+}
+
+// lifted from FontSkia.cpp
+static bool disableTextLCD(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 or when the compositor is being used.
+ return isCanvasMultiLayered(skiaContext->canvas())
+ || skiaContext->isDrawingToImageBuffer();
+}
+
+static void setupPaintForFont(HFONT hfont, SkPaint* paint, PlatformContextSkia* pcs)
+{
// FIXME:
// Much of this logic could also happen in
// FontCustomPlatformData::fontPlatformData and be cached,
@@ -139,7 +157,11 @@
uint32_t flags = paint->getFlags();
// our defaults
flags |= SkPaint::kAntiAlias_Flag;
- flags |= SkPaint::kLCDRenderText_Flag;
+ if (disableTextLCD(pcs))
+ flags &= ~SkPaint::kLCDRenderText_Flag;
+ else
+ flags |= SkPaint::kLCDRenderText_Flag;
+
switch (info.lfQuality) {
case NONANTIALIASED_QUALITY:
flags &= ~SkPaint::kAntiAlias_Flag;
@@ -173,7 +195,7 @@
SkPaint paint;
platformContext->setupPaintForFilling(&paint);
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
- setupPaintForFont(hfont, &paint);
+ setupPaintForFont(hfont, &paint, platformContext);
bool didFill = false;
@@ -190,7 +212,7 @@
paint.reset();
platformContext->setupPaintForStroking(&paint, 0, 0);
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
- setupPaintForFont(hfont, &paint);
+ setupPaintForFont(hfont, &paint, platformContext);
if (didFill) {
// If there is a shadow and we filled above, there will already be
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes