From 2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 7 May 2012 11:21:11 +0200 Subject: Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286) --- Source/WebKit/chromium/src/WebFontImpl.cpp | 31 +++++++++++++----------------- 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'Source/WebKit/chromium/src/WebFontImpl.cpp') diff --git a/Source/WebKit/chromium/src/WebFontImpl.cpp b/Source/WebKit/chromium/src/WebFontImpl.cpp index c92a1f567..f6cf39dbe 100644 --- a/Source/WebKit/chromium/src/WebFontImpl.cpp +++ b/Source/WebKit/chromium/src/WebFontImpl.cpp @@ -113,24 +113,19 @@ void WebFontImpl::drawText(WebCanvas* canvas, const WebTextRun& run, const WebFl gc.restore(); #if defined(WIN32) - if (canvasIsOpaque && SkColorGetA(color) == 0xFF) { - SkCanvas::LayerIter iter(const_cast(canvas), false); - iter.next(); // There is always at least one layer. - bool multipleLayers = !iter.done(); - if (!multipleLayers) { - // The text drawing logic on Windows ignores the alpha component - // intentionally, for performance reasons. - // (Please see TransparencyAwareFontPainter::initializeForGDI in - // FontChromiumWin.cpp.) - const SkBitmap& bitmap = canvas->getTopDevice()->accessBitmap(true); - IntRect textBounds = estimateTextBounds(run, leftBaseline); - IntRect destRect = gc.getCTM().mapRect(textBounds); - destRect.intersect(IntRect(0, 0, bitmap.width(), bitmap.height())); - for (int y = destRect.y(), maxY = destRect.maxY(); y < maxY; y++) { - uint32_t* row = bitmap.getAddr32(0, y); - for (int x = destRect.x(), maxX = destRect.maxX(); x < maxX; x++) - row[x] |= (0xFF << SK_A32_SHIFT); - } + if (canvasIsOpaque && SkColorGetA(color) == 0xFF && !canvas->isDrawingToLayer()) { + // The text drawing logic on Windows ignores the alpha component + // intentionally, for performance reasons. + // (Please see TransparencyAwareFontPainter::initializeForGDI in + // FontChromiumWin.cpp.) + const SkBitmap& bitmap = canvas->getTopDevice()->accessBitmap(true); + IntRect textBounds = estimateTextBounds(run, leftBaseline); + IntRect destRect = gc.getCTM().mapRect(textBounds); + destRect.intersect(IntRect(0, 0, bitmap.width(), bitmap.height())); + for (int y = destRect.y(), maxY = destRect.maxY(); y < maxY; y++) { + uint32_t* row = bitmap.getAddr32(0, y); + for (int x = destRect.x(), maxX = destRect.maxX(); x < maxX; x++) + row[x] |= (0xFF << SK_A32_SHIFT); } } #endif -- cgit v1.2.1