Diff
Modified: trunk/Source/WebCore/ChangeLog (104741 => 104742)
--- trunk/Source/WebCore/ChangeLog 2012-01-11 21:43:15 UTC (rev 104741)
+++ trunk/Source/WebCore/ChangeLog 2012-01-11 21:52:38 UTC (rev 104742)
@@ -1,3 +1,30 @@
+2012-01-11 Alexandre Elias <[email protected]>
+
+ [chromium] Make Skia canvas opaque for root layer tiles
+ https://bugs.webkit.org/show_bug.cgi?id=75939
+
+ Reviewed by James Robinson.
+
+ Skia has extra optimizations if a bitmap has the "opaque" flag -- in
+ particular, it doesn't do an unnecessary memset at creation time.
+ Pass down the LayerChromium's opaque flag to Skia.
+
+ * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp:
+ (WebCore::BitmapCanvasLayerTextureUpdater::setIsNonCompositedContent):
+ * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h:
+ * platform/graphics/chromium/ContentLayerChromium.cpp:
+ (WebCore::ContentLayerChromium::createTextureUpdater):
+ * platform/graphics/chromium/LayerTextureUpdater.h:
+ (WebCore::LayerTextureUpdater::setIsNonCompositedContent):
+ * platform/graphics/chromium/PlatformCanvas.cpp:
+ (WebCore::PlatformCanvas::PlatformCanvas):
+ (WebCore::PlatformCanvas::resize):
+ * platform/graphics/chromium/PlatformCanvas.h:
+ (WebCore::PlatformCanvas::setOpaque):
+ (WebCore::PlatformCanvas::opaque):
+ * platform/graphics/chromium/TiledLayerChromium.cpp:
+ (WebCore::TiledLayerChromium::setIsNonCompositedContent):
+
2012-01-11 Greg Billock <[email protected]>
[Coverity] Address some uninit constructor issues in WebCore/dom
Modified: trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp (104741 => 104742)
--- trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp 2012-01-11 21:43:15 UTC (rev 104741)
+++ trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp 2012-01-11 21:52:38 UTC (rev 104742)
@@ -99,5 +99,10 @@
m_texSubImage.upload(locker.pixels(), contentRect(), sourceRect, destRect, texture->format(), context);
}
+void BitmapCanvasLayerTextureUpdater::setOpaque(bool opaque)
+{
+ m_canvas.setOpaque(opaque);
+}
+
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
Modified: trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h (104741 => 104742)
--- trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h 2012-01-11 21:43:15 UTC (rev 104741)
+++ trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h 2012-01-11 21:52:38 UTC (rev 104742)
@@ -63,6 +63,8 @@
virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale);
void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
+ virtual void setOpaque(bool);
+
private:
BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage);
Modified: trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp (104741 => 104742)
--- trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp 2012-01-11 21:43:15 UTC (rev 104741)
+++ trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp 2012-01-11 21:52:38 UTC (rev 104742)
@@ -131,7 +131,15 @@
#endif // USE(SKIA)
m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub);
+ m_textureUpdater->setOpaque(opaque());
}
+void ContentLayerChromium::setOpaque(bool opaque)
+{
+ LayerChromium::setOpaque(opaque);
+ if (m_textureUpdater)
+ m_textureUpdater->setOpaque(opaque);
}
+
+}
#endif // USE(ACCELERATED_COMPOSITING)
Modified: trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h (104741 => 104742)
--- trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h 2012-01-11 21:43:15 UTC (rev 104741)
+++ trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h 2012-01-11 21:52:38 UTC (rev 104742)
@@ -52,6 +52,8 @@
virtual void paintContentsIfDirty();
virtual void idlePaintContentsIfDirty();
+ virtual void setOpaque(bool);
+
protected:
explicit ContentLayerChromium(CCLayerDelegate*);
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (104741 => 104742)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-01-11 21:43:15 UTC (rev 104741)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-01-11 21:52:38 UTC (rev 104742)
@@ -110,7 +110,7 @@
void setOpacity(float);
float opacity() const { return m_opacity; }
- void setOpaque(bool);
+ virtual void setOpaque(bool);
bool opaque() const { return m_opaque; }
void setPosition(const FloatPoint&);
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h (104741 => 104742)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h 2012-01-11 21:43:15 UTC (rev 104741)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h 2012-01-11 21:52:38 UTC (rev 104742)
@@ -72,6 +72,8 @@
// If the format is TexelFormatBGRA, vec4.x is blue and vec4.z is red.
virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0;
virtual void prepareToUpdate(const IntRect& /* contentRect */, const IntSize& /* tileSize */, int /* borderTexels */, float /* contentsScale */) { }
+
+ virtual void setOpaque(bool) { }
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp (104741 => 104742)
--- trunk/Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp 2012-01-11 21:43:15 UTC (rev 104741)
+++ trunk/Source/WebCore/platform/graphics/chromium/PlatformCanvas.cpp 2012-01-11 21:52:38 UTC (rev 104742)
@@ -41,6 +41,7 @@
namespace WebCore {
PlatformCanvas::PlatformCanvas()
+ : m_opaque(false)
{
}
@@ -53,10 +54,27 @@
if (m_size == size)
return;
m_size = size;
+ createBackingCanvas();
+}
+
+void PlatformCanvas::setOpaque(bool opaque)
+{
+ if (opaque == m_opaque)
+ return;
+
+ m_opaque = opaque;
+ createBackingCanvas();
+}
+
+void PlatformCanvas::createBackingCanvas()
+{
+ if (m_size.isEmpty())
+ return;
+
#if USE(SKIA)
- m_skiaCanvas = adoptPtr(skia::CreateBitmapCanvas(size.width(), size.height(), false));
+ m_skiaCanvas = adoptPtr(skia::CreateBitmapCanvas(m_size.width(), m_size.height(), m_opaque));
#elif USE(CG)
- size_t bufferSize = size.width() * size.height() * 4;
+ size_t bufferSize = m_size.width() * m_size.height() * 4;
m_pixelData = adoptArrayPtr(new uint8_t[bufferSize]);
memset(m_pixelData.get(), 0, bufferSize);
#endif
Modified: trunk/Source/WebCore/platform/graphics/chromium/PlatformCanvas.h (104741 => 104742)
--- trunk/Source/WebCore/platform/graphics/chromium/PlatformCanvas.h 2012-01-11 21:43:15 UTC (rev 104741)
+++ trunk/Source/WebCore/platform/graphics/chromium/PlatformCanvas.h 2012-01-11 21:52:38 UTC (rev 104742)
@@ -98,13 +98,19 @@
void resize(const IntSize&);
IntSize size() const { return m_size; }
+ void setOpaque(bool);
+ bool opaque() const { return m_opaque; }
+
private:
+ void createBackingCanvas();
+
#if USE(SKIA)
OwnPtr<SkCanvas> m_skiaCanvas;
#elif USE(CG)
OwnArrayPtr<uint8_t> m_pixelData;
#endif
IntSize m_size;
+ bool m_opaque;
};
} // namespace WebCore