- Revision
- 113345
- Author
- [email protected]
- Date
- 2012-04-05 11:49:13 -0700 (Thu, 05 Apr 2012)
Log Message
[Chromium] With the skia port, setting LCD text filtering is causing
texture cache invalidations of gpu canvas backing store
https://bugs.webkit.org/show_bug.cgi?id=74183
Patch by Justin Novosad <[email protected]> on 2012-04-05
Reviewed by Stephen White.
Source/WebCore:
Replacing unnecessary usage of SkCanvas::LayerIter with calls to
SkCanvas::isDrawingToLayer(). Same results, lower overhead, and no
GPU texture invalidation.
* platform/graphics/chromium/FontChromiumWin.cpp:
(WebCore):
(WebCore::TransparencyAwareFontPainter::initializeForGDI):
* platform/graphics/harfbuzz/FontHarfBuzz.cpp:
(WebCore):
(WebCore::adjustTextRenderMode):
* platform/graphics/skia/FontSkia.cpp:
(WebCore):
(WebCore::adjustTextRenderMode):
* platform/graphics/skia/SkiaFontWin.cpp:
(WebCore):
(WebCore::disableTextLCD):
* rendering/RenderThemeChromiumWin.cpp:
(WebCore):
Source/WebKit/chromium:
Replacing unnecessary usage of SkCanvas::LayerIter with call to
SkCanvas::isDrawingToLayer(). Same results, lower overhead, and no
GPU texture invalidation.
* src/WebFontImpl.cpp:
(WebKit::WebFontImpl::drawText):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (113344 => 113345)
--- trunk/Source/WebCore/ChangeLog 2012-04-05 18:47:43 UTC (rev 113344)
+++ trunk/Source/WebCore/ChangeLog 2012-04-05 18:49:13 UTC (rev 113345)
@@ -1,3 +1,30 @@
+2012-04-05 Justin Novosad <[email protected]>
+
+ [Chromium] With the skia port, setting LCD text filtering is causing
+ texture cache invalidations of gpu canvas backing store
+ https://bugs.webkit.org/show_bug.cgi?id=74183
+
+ Reviewed by Stephen White.
+
+ Replacing unnecessary usage of SkCanvas::LayerIter with calls to
+ SkCanvas::isDrawingToLayer(). Same results, lower overhead, and no
+ GPU texture invalidation.
+
+ * platform/graphics/chromium/FontChromiumWin.cpp:
+ (WebCore):
+ (WebCore::TransparencyAwareFontPainter::initializeForGDI):
+ * platform/graphics/harfbuzz/FontHarfBuzz.cpp:
+ (WebCore):
+ (WebCore::adjustTextRenderMode):
+ * platform/graphics/skia/FontSkia.cpp:
+ (WebCore):
+ (WebCore::adjustTextRenderMode):
+ * platform/graphics/skia/SkiaFontWin.cpp:
+ (WebCore):
+ (WebCore::disableTextLCD):
+ * rendering/RenderThemeChromiumWin.cpp:
+ (WebCore):
+
2012-04-05 Zan Dobersek <[email protected]>
media/track/track-webvtt-tc004-magic-header.html flakily times out
Modified: trunk/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp (113344 => 113345)
--- trunk/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp 2012-04-05 18:47:43 UTC (rev 113344)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp 2012-04-05 18:49:13 UTC (rev 113345)
@@ -55,13 +55,6 @@
#if !USE(SKIA_TEXT)
namespace {
-bool canvasHasMultipleLayers(const SkCanvas* canvas)
-{
- SkCanvas::LayerIter iter(const_cast<SkCanvas*>(canvas), false);
- iter.next(); // There is always at least one layer.
- return !iter.done(); // There is > 1 layer if the the iterator can stil advance.
-}
-
class TransparencyAwareFontPainter {
public:
TransparencyAwareFontPainter(GraphicsContext*, const FloatPoint&);
@@ -147,7 +140,7 @@
// this mode and it will apply the color.
m_transparency.setTextCompositeColor(color);
color = SkColorSetRGB(0, 0, 0);
- } else if (m_createdTransparencyLayer || canvasHasMultipleLayers(m_platformContext->canvas())) {
+ } else if (m_createdTransparencyLayer || m_platformContext->canvas()->isDrawingToLayer()) {
// When we're drawing a web page, we know the background is opaque,
// but if we're drawing to a layer, we still need extra work.
layerMode = TransparencyWin::OpaqueCompositeLayer;
Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp (113344 => 113345)
--- trunk/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp 2012-04-05 18:47:43 UTC (rev 113344)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp 2012-04-05 18:49:13 UTC (rev 113345)
@@ -60,20 +60,13 @@
return false;
}
-static bool isCanvasMultiLayered(SkCanvas* canvas)
-{
- SkCanvas::LayerIter layerIterator(canvas, false);
- layerIterator.next();
- return !layerIterator.done();
-}
-
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 or when the compositor is being used.
- if (isCanvasMultiLayered(skiaContext->canvas()) || skiaContext->isDrawingToImageBuffer())
+ if (skiaContext->canvas()->isDrawingToLayer() || skiaContext->isDrawingToImageBuffer())
paint->setLCDRenderText(false);
}
Modified: trunk/Source/WebCore/platform/graphics/skia/FontSkia.cpp (113344 => 113345)
--- trunk/Source/WebCore/platform/graphics/skia/FontSkia.cpp 2012-04-05 18:47:43 UTC (rev 113344)
+++ trunk/Source/WebCore/platform/graphics/skia/FontSkia.cpp 2012-04-05 18:49:13 UTC (rev 113345)
@@ -54,20 +54,13 @@
return true;
}
-static bool isCanvasMultiLayered(SkCanvas* canvas)
-{
- SkCanvas::LayerIter layerIterator(canvas, false);
- layerIterator.next();
- return !layerIterator.done();
-}
-
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 or when the compositor is being used.
- if (isCanvasMultiLayered(skiaContext->canvas()) || skiaContext->isDrawingToImageBuffer())
+ if (skiaContext->canvas()->isDrawingToLayer() || skiaContext->isDrawingToImageBuffer())
paint->setLCDRenderText(false);
}
Modified: trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp (113344 => 113345)
--- trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp 2012-04-05 18:47:43 UTC (rev 113344)
+++ trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp 2012-04-05 18:49:13 UTC (rev 113345)
@@ -137,13 +137,6 @@
}
}
-static bool isCanvasMultiLayered(SkCanvas* canvas)
-{
- SkCanvas::LayerIter layerIterator(canvas, false);
- layerIterator.next();
- return !layerIterator.done();
-}
-
// lifted from FontSkia.cpp
static bool disableTextLCD(PlatformContextSkia* skiaContext)
{
@@ -151,7 +144,7 @@
// 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())
+ return skiaContext->canvas()->isDrawingToLayer()
|| skiaContext->isDrawingToImageBuffer();
}
Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp (113344 => 113345)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp 2012-04-05 18:47:43 UTC (rev 113344)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp 2012-04-05 18:49:13 UTC (rev 113345)
@@ -102,18 +102,11 @@
private:
- static bool canvasHasMultipleLayers(const SkCanvas* canvas)
- {
- SkCanvas::LayerIter iter(const_cast<SkCanvas*>(canvas), false);
- iter.next(); // There is always at least one layer.
- return !iter.done(); // There is > 1 layer if the the iterator can stil advance.
- }
-
static TransparencyWin::LayerMode getLayerMode(GraphicsContext* context, TransparencyWin::TransformMode transformMode)
{
if (context->platformContext()->isDrawingToImageBuffer()) // Might have transparent background.
return TransparencyWin::WhiteLayer;
- if (canvasHasMultipleLayers(context->platformContext()->canvas())) // Needs antialiasing help.
+ if (context->platformContext()->canvas()->isDrawingToLayer()) // Needs antialiasing help.
return TransparencyWin::OpaqueCompositeLayer;
// Nothing interesting.
return transformMode == TransparencyWin::KeepTransform ? TransparencyWin::NoLayer : TransparencyWin::OpaqueCompositeLayer;
Modified: trunk/Source/WebKit/chromium/ChangeLog (113344 => 113345)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-04-05 18:47:43 UTC (rev 113344)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-04-05 18:49:13 UTC (rev 113345)
@@ -1,3 +1,18 @@
+2012-04-05 Justin Novosad <[email protected]>
+
+ [Chromium] With the skia port, setting LCD text filtering is causing
+ texture cache invalidations of gpu canvas backing store
+ https://bugs.webkit.org/show_bug.cgi?id=74183
+
+ Reviewed by Stephen White.
+
+ Replacing unnecessary usage of SkCanvas::LayerIter with call to
+ SkCanvas::isDrawingToLayer(). Same results, lower overhead, and no
+ GPU texture invalidation.
+
+ * src/WebFontImpl.cpp:
+ (WebKit::WebFontImpl::drawText):
+
2012-04-05 Lei Zhang <[email protected]>
[Chromium] Properly align members in WebInputEvent and subclasses to make Valgrind happy.
Modified: trunk/Source/WebKit/chromium/src/WebFontImpl.cpp (113344 => 113345)
--- trunk/Source/WebKit/chromium/src/WebFontImpl.cpp 2012-04-05 18:47:43 UTC (rev 113344)
+++ trunk/Source/WebKit/chromium/src/WebFontImpl.cpp 2012-04-05 18:49:13 UTC (rev 113345)
@@ -113,24 +113,19 @@
gc.restore();
#if defined(WIN32)
- if (canvasIsOpaque && SkColorGetA(color) == 0xFF) {
- SkCanvas::LayerIter iter(const_cast<SkCanvas*>(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