2011-03-03 Nat Duca <nduca@chromium.org>

        Reviewed by James Robinson.

        [chromium] Create a LayerChromium layerTreeAsText. Add HUD to
        LayerRendererChromium that draws compositor FPS and, optionally,
        the layer tree.
        https://bugs.webkit.org/show_bug.cgi?id=54710

        * WebCore.gypi:
        * platform/graphics/chromium/Canvas2DLayerChromium.h:
        (WebCore::Canvas2DLayerChromium::drawsContent):
        * platform/graphics/chromium/CanvasLayerChromium.h:
        (WebCore::CanvasLayerChromium::layerTypeAsString):
        * platform/graphics/chromium/ContentLayerChromium.cpp:
        (WebCore::writeIndent):
        (WebCore::ContentLayerChromium::dumpLayerProperties):
        * platform/graphics/chromium/ContentLayerChromium.h:
        (WebCore::ContentLayerChromium::drawsContent):
        (WebCore::ContentLayerChromium::layerTypeAsString):
        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
        (WebCore::GraphicsLayerChromium::setName):
        (WebCore::GraphicsLayerChromium::updateNames):
        (WebCore::GraphicsLayerChromium::updateLayerPreserves3D):
        (WebCore::GraphicsLayerChromium::setupContentsLayer):
        * platform/graphics/chromium/GraphicsLayerChromium.h:
        * platform/graphics/chromium/ImageLayerChromium.h:
        (WebCore::ImageLayerChromium::drawsContent):
        (WebCore::ImageLayerChromium::layerTypeAsString):
        * platform/graphics/chromium/LayerChromium.cpp:
        (WebCore::LayerChromium::LayerChromium):
        (WebCore::LayerChromium::setName):
        (WebCore::LayerChromium::layerTreeAsText):
        (WebCore::writeIndent):
        (WebCore::LayerChromium::dumpLayer):
        (WebCore::LayerChromium::dumpLayerProperties):
        * platform/graphics/chromium/LayerChromium.h:
        (WebCore::LayerChromium::name):
        (WebCore::LayerChromium::drawsContent):
        (WebCore::LayerChromium::debugID):
        (WebCore::LayerChromium::layerTypeAsString):
        * platform/graphics/chromium/LayerRendererChromium.cpp:
        (WebCore::LayerRendererChromium::LayerRendererChromium):
        (WebCore::LayerRendererChromium::~LayerRendererChromium):
        (WebCore::LayerRendererChromium::drawLayers):
        (WebCore::LayerRendererChromium::present):
        (WebCore::LayerRendererChromium::layerTreeAsText):
        (WebCore::LayerRendererChromium::dumpRenderSurfaces):
        * platform/graphics/chromium/LayerRendererChromium.h:
        (WebCore::LayerRendererChromium::getHeadsUpDisplay):
        (WebCore::LayerRendererChromium::rootVisibleRect):
        * platform/graphics/chromium/PluginLayerChromium.h:
        (WebCore::PluginLayerChromium::drawsContent):
        (WebCore::PluginLayerChromium::layerTypeAsString):
        * platform/graphics/chromium/RenderSurfaceChromium.cpp:
        (WebCore::RenderSurfaceChromium::name):
        (WebCore::writeIndent):
        (WebCore::RenderSurfaceChromium::dumpSurface):
        * platform/graphics/chromium/RenderSurfaceChromium.h:
        * platform/graphics/chromium/VideoLayerChromium.h:
        (WebCore::VideoLayerChromium::drawsContent):
        (WebCore::VideoLayerChromium::layerTypeAsString):
        * platform/graphics/chromium/WebGLLayerChromium.h:
        (WebCore::WebGLLayerChromium::drawsContent):
        (WebCore::WebGLLayerChromium::layerTypeAsString):
        * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: Added.
        (WebCore::CCHeadsUpDisplay::CCHeadsUpDisplay):
        (WebCore::CCHeadsUpDisplay::~CCHeadsUpDisplay):
        (WebCore::CCHeadsUpDisplay::draw):
        (WebCore::CCHeadsUpDisplay::drawHudContents):
        (WebCore::CCHeadsUpDisplay::onPresent):
        * platform/graphics/chromium/cc/CCHeadsUpDisplay.h: Added.
        (WebCore::CCHeadsUpDisplay::setShowFPSCounter):
        (WebCore::CCHeadsUpDisplay::showFPSCounter):
        (WebCore::CCHeadsUpDisplay::setShowPlatformLayerTree):
        (WebCore::CCHeadsUpDisplay::showPlatformLayerTree):
        (WebCore::CCHeadsUpDisplay::enabled):
        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
        (WebCore::CCLayerImpl::CCLayerImpl):
        (WebCore::writeIndent):
        (WebCore::CCLayerImpl::dumpLayerProperties):
        * platform/graphics/chromium/cc/CCLayerImpl.h:
        (WebCore::CCLayerImpl::debugID):
        (WebCore::CCLayerImpl::setName):
        (WebCore::CCLayerImpl::name):
2011-03-03  Nat Duca  <nduca@chromium.org>

        Reviewed by James Robinson.

        [chromium] Create a LayerChromium layerTreeAsText. Add HUD to
        LayerRendererChromium that draws compositor FPS and, optionally,
        the layer tree.
        https://bugs.webkit.org/show_bug.cgi?id=54710

        * public/WebSettings.h:
        * src/WebSettingsImpl.cpp:
        (WebKit::WebSettingsImpl::WebSettingsImpl):
        (WebKit::WebSettingsImpl::setShowFPSCounter):
        (WebKit::WebSettingsImpl::setShowPlatformLayerTree):
        * src/WebSettingsImpl.h:
        (WebKit::WebSettingsImpl::showFPSCounter):
        (WebKit::WebSettingsImpl::showPlatformLayerTree):
        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::doComposite):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5570e70a
2011-03-03 Nat Duca <nduca@chromium.org>
Reviewed by James Robinson.
[chromium] Create a LayerChromium layerTreeAsText. Add HUD to
LayerRendererChromium that draws compositor FPS and, optionally,
the layer tree.
https://bugs.webkit.org/show_bug.cgi?id=54710
* WebCore.gypi:
* platform/graphics/chromium/Canvas2DLayerChromium.h:
(WebCore::Canvas2DLayerChromium::drawsContent):
* platform/graphics/chromium/CanvasLayerChromium.h:
(WebCore::CanvasLayerChromium::layerTypeAsString):
* platform/graphics/chromium/ContentLayerChromium.cpp:
(WebCore::writeIndent):
(WebCore::ContentLayerChromium::dumpLayerProperties):
* platform/graphics/chromium/ContentLayerChromium.h:
(WebCore::ContentLayerChromium::drawsContent):
(WebCore::ContentLayerChromium::layerTypeAsString):
* platform/graphics/chromium/GraphicsLayerChromium.cpp:
(WebCore::GraphicsLayerChromium::setName):
(WebCore::GraphicsLayerChromium::updateNames):
(WebCore::GraphicsLayerChromium::updateLayerPreserves3D):
(WebCore::GraphicsLayerChromium::setupContentsLayer):
* platform/graphics/chromium/GraphicsLayerChromium.h:
* platform/graphics/chromium/ImageLayerChromium.h:
(WebCore::ImageLayerChromium::drawsContent):
(WebCore::ImageLayerChromium::layerTypeAsString):
* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::LayerChromium):
(WebCore::LayerChromium::setName):
(WebCore::LayerChromium::layerTreeAsText):
(WebCore::writeIndent):
(WebCore::LayerChromium::dumpLayer):
(WebCore::LayerChromium::dumpLayerProperties):
* platform/graphics/chromium/LayerChromium.h:
(WebCore::LayerChromium::name):
(WebCore::LayerChromium::drawsContent):
(WebCore::LayerChromium::debugID):
(WebCore::LayerChromium::layerTypeAsString):
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::LayerRendererChromium):
(WebCore::LayerRendererChromium::~LayerRendererChromium):
(WebCore::LayerRendererChromium::drawLayers):
(WebCore::LayerRendererChromium::present):
(WebCore::LayerRendererChromium::layerTreeAsText):
(WebCore::LayerRendererChromium::dumpRenderSurfaces):
* platform/graphics/chromium/LayerRendererChromium.h:
(WebCore::LayerRendererChromium::getHeadsUpDisplay):
(WebCore::LayerRendererChromium::rootVisibleRect):
* platform/graphics/chromium/PluginLayerChromium.h:
(WebCore::PluginLayerChromium::drawsContent):
(WebCore::PluginLayerChromium::layerTypeAsString):
* platform/graphics/chromium/RenderSurfaceChromium.cpp:
(WebCore::RenderSurfaceChromium::name):
(WebCore::writeIndent):
(WebCore::RenderSurfaceChromium::dumpSurface):
* platform/graphics/chromium/RenderSurfaceChromium.h:
* platform/graphics/chromium/VideoLayerChromium.h:
(WebCore::VideoLayerChromium::drawsContent):
(WebCore::VideoLayerChromium::layerTypeAsString):
* platform/graphics/chromium/WebGLLayerChromium.h:
(WebCore::WebGLLayerChromium::drawsContent):
(WebCore::WebGLLayerChromium::layerTypeAsString):
* platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: Added.
(WebCore::CCHeadsUpDisplay::CCHeadsUpDisplay):
(WebCore::CCHeadsUpDisplay::~CCHeadsUpDisplay):
(WebCore::CCHeadsUpDisplay::draw):
(WebCore::CCHeadsUpDisplay::drawHudContents):
(WebCore::CCHeadsUpDisplay::onPresent):
* platform/graphics/chromium/cc/CCHeadsUpDisplay.h: Added.
(WebCore::CCHeadsUpDisplay::setShowFPSCounter):
(WebCore::CCHeadsUpDisplay::showFPSCounter):
(WebCore::CCHeadsUpDisplay::setShowPlatformLayerTree):
(WebCore::CCHeadsUpDisplay::showPlatformLayerTree):
(WebCore::CCHeadsUpDisplay::enabled):
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::CCLayerImpl):
(WebCore::writeIndent):
(WebCore::CCLayerImpl::dumpLayerProperties):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(WebCore::CCLayerImpl::debugID):
(WebCore::CCLayerImpl::setName):
(WebCore::CCLayerImpl::name):
2011-03-02 Ojan Vafai <ojan@chromium.org>
Reviewed by Darin Adler.
......
......@@ -2670,6 +2670,8 @@
'platform/graphics/chromium/VideoLayerChromium.h',
'platform/graphics/chromium/WebGLLayerChromium.cpp',
'platform/graphics/chromium/WebGLLayerChromium.h',
'platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp',
'platform/graphics/chromium/cc/CCHeadsUpDisplay.h',
'platform/graphics/chromium/cc/CCLayerImpl.cpp',
'platform/graphics/chromium/cc/CCLayerImpl.h',
'platform/graphics/cocoa/FontPlatformData.h',
......
......@@ -45,7 +45,7 @@ class Canvas2DLayerChromium : public CanvasLayerChromium {
public:
static PassRefPtr<Canvas2DLayerChromium> create(DrawingBuffer*, GraphicsLayerChromium* owner);
virtual ~Canvas2DLayerChromium();
virtual bool drawsContent() { return true; }
virtual bool drawsContent() const { return true; }
virtual void updateContentsIfDirty();
void setTextureChanged();
......
......@@ -49,6 +49,9 @@ public:
protected:
explicit CanvasLayerChromium(GraphicsLayerChromium* owner);
virtual const char* layerTypeAsString() const { return "CanvasLayer"; }
bool m_textureChanged;
unsigned m_textureId;
......
......@@ -39,6 +39,7 @@
#include "LayerRendererChromium.h"
#include "LayerTexture.h"
#include "RenderLayerBacking.h"
#include "TextStream.h"
namespace WebCore {
......@@ -285,6 +286,18 @@ void ContentLayerChromium::bindContentsTexture()
m_contentsTexture->bindTexture();
}
static void writeIndent(TextStream& ts, int indent)
{
for (int i = 0; i != indent; ++i)
ts << " ";
}
void ContentLayerChromium::dumpLayerProperties(TextStream& ts, int indent) const
{
LayerChromium::dumpLayerProperties(ts, indent);
writeIndent(ts, indent);
ts << "skipsDraw: " << m_skipsDraw << "\n";
}
}
#endif // USE(ACCELERATED_COMPOSITING)
......@@ -55,7 +55,7 @@ public:
virtual void bindContentsTexture();
virtual void draw();
virtual bool drawsContent() { return m_owner && m_owner->drawsContent(); }
virtual bool drawsContent() const { return m_owner && m_owner->drawsContent(); }
typedef ProgramBinding<VertexShaderPosTex, FragmentShaderTexAlpha> Program;
......@@ -66,6 +66,9 @@ protected:
bool requiresClippedUpdateRect() const;
void resizeUploadBuffer(const IntSize&);
virtual const char* layerTypeAsString() const { return "ContentLayer"; }
virtual void dumpLayerProperties(TextStream&, int indent) const;
OwnPtr<LayerTexture> m_contentsTexture;
bool m_skipsDraw;
......
......@@ -111,8 +111,20 @@ GraphicsLayerChromium::~GraphicsLayerChromium()
void GraphicsLayerChromium::setName(const String& inName)
{
m_nameBase = inName;
String name = String::format("GraphicsLayerChromium(%p) GraphicsLayer(%p) ", m_layer.get(), this) + inName;
GraphicsLayer::setName(name);
updateNames();
}
void GraphicsLayerChromium::updateNames()
{
if (m_layer)
m_layer->setName("Layer for " + m_nameBase);
if (m_transformLayer)
m_transformLayer->setName("TransformLayer for " + m_nameBase);
if (m_contentsLayer)
m_contentsLayer->setName("ContentsLayer for " + m_nameBase);
}
bool GraphicsLayerChromium::setChildren(const Vector<GraphicsLayer*>& children)
......@@ -590,6 +602,7 @@ void GraphicsLayerChromium::updateLayerPreserves3D()
}
updateOpacityOnLayer();
updateNames();
}
void GraphicsLayerChromium::updateLayerDrawsContent()
......@@ -653,6 +666,7 @@ void GraphicsLayerChromium::setupContentsLayer(LayerChromium* contentsLayer)
}
}
updateDebugIndicators();
updateNames();
}
// This function simply mimics the operation of GraphicsLayerCA
......
......@@ -107,6 +107,7 @@ private:
LayerChromium* hostLayerForSublayers() const;
LayerChromium* layerForSuperlayer() const;
void updateNames();
void updateSublayerList();
void updateLayerPosition();
void updateLayerSize();
......@@ -127,6 +128,8 @@ private:
void setupContentsLayer(LayerChromium*);
LayerChromium* contentsLayer() const { return m_contentsLayer.get(); }
String m_nameBase;
RefPtr<LayerChromium> m_layer;
RefPtr<LayerChromium> m_transformLayer;
RefPtr<LayerChromium> m_contentsLayer;
......
......@@ -51,10 +51,13 @@ public:
static PassRefPtr<ImageLayerChromium> create(GraphicsLayerChromium* owner = 0);
virtual void updateContentsIfDirty();
virtual bool drawsContent() { return m_contents; }
virtual bool drawsContent() const { return m_contents; }
void setContents(Image* image);
protected:
virtual const char* layerTypeAsString() const { return "ImageLayer"; }
private:
virtual void updateTextureIfNeeded();
......
......@@ -42,13 +42,17 @@
#include "PlatformContextSkia.h"
#endif
#include "RenderLayerBacking.h"
#include "TextStream.h"
#include "skia/ext/platform_canvas.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
using namespace std;
#ifndef NDEBUG
static int s_nextLayerDebugID = 1;
#endif
PassRefPtr<LayerChromium> LayerChromium::create(GraphicsLayerChromium* owner)
{
return adoptRef(new LayerChromium(owner));
......@@ -59,6 +63,9 @@ LayerChromium::LayerChromium(GraphicsLayerChromium* owner)
, m_contentsDirty(false)
, m_maskLayer(0)
, m_superlayer(0)
#ifndef NDEBUG
, m_debugID(s_nextLayerDebugID++)
#endif
, m_anchorPoint(0.5, 0.5)
, m_backgroundColor(0, 0, 0, 0)
, m_opacity(1.0)
......@@ -230,6 +237,12 @@ LayerChromium* LayerChromium::superlayer() const
return m_superlayer;
}
void LayerChromium::setName(const String& name)
{
m_name = name;
m_ccLayerImpl->setName(name);
}
void LayerChromium::setNeedsDisplay(const FloatRect& dirtyRect)
{
// Simply mark the contents as dirty. For non-root layers, the call to
......@@ -328,6 +341,50 @@ bool LayerChromium::descendantsDrawContentRecursive()
return false;
}
String LayerChromium::layerTreeAsText() const
{
TextStream ts;
dumpLayer(ts, 0);
return ts.release();
}
static void writeIndent(TextStream& ts, int indent)
{
for (int i = 0; i != indent; ++i)
ts << " ";
}
void LayerChromium::dumpLayer(TextStream& ts, int indent) const
{
writeIndent(ts, indent);
ts << layerTypeAsString() << "(" << m_name << ")\n";
dumpLayerProperties(ts, indent+2);
m_ccLayerImpl->dumpLayerProperties(ts, indent+2);
if (m_replicaLayer) {
writeIndent(ts, indent+2);
ts << "Replica:\n";
m_replicaLayer->dumpLayer(ts, indent+3);
}
if (m_maskLayer) {
writeIndent(ts, indent+2);
ts << "Mask:\n";
m_maskLayer->dumpLayer(ts, indent+3);
}
for (size_t i = 0; i < m_sublayers.size(); ++i)
m_sublayers[i]->dumpLayer(ts, indent+1);
}
void LayerChromium::dumpLayerProperties(TextStream& ts, int indent) const
{
writeIndent(ts, indent);
#ifndef NDEBUG
ts << "debugID: " << debugID() << ", ";
#else
#endif
ts << "drawsContent: " << drawsContent() << "\n";
}
// Begin calls that forward to the CCLayerImpl.
// ==============================================
// These exists just for debugging (via drawDebugBorder()).
......
......@@ -48,6 +48,7 @@
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
namespace skia {
......@@ -100,8 +101,8 @@ public:
void setMasksToBounds(bool masksToBounds) { m_masksToBounds = masksToBounds; }
bool masksToBounds() const { return m_masksToBounds; }
void setName(const String& name) { m_name = name; }
String name() const { return m_name; }
void setName(const String&);
const String& name() const { return m_name; }
void setMaskLayer(LayerChromium* maskLayer) { m_maskLayer = maskLayer; }
CCLayerImpl* maskDrawLayer() const { return m_maskLayer ? m_maskLayer->ccLayerImpl() : 0; }
......@@ -151,7 +152,7 @@ public:
LayerChromium* replicaLayer() { return m_replicaLayer; }
// These methods typically need to be overwritten by derived classes.
virtual bool drawsContent() { return false; }
virtual bool drawsContent() const { return false; }
virtual void updateContentsIfDirty() { }
virtual void unreserveContentsTexture() { }
virtual void bindContentsTexture() { }
......@@ -161,6 +162,13 @@ public:
void setBorderColor(const Color&);
Color borderColor() const;
#ifndef NDEBUG
int debugID() const { return m_debugID; }
#endif
void drawDebugBorder();
String layerTreeAsText() const;
void setBorderWidth(float);
float borderWidth() const;
......@@ -193,6 +201,11 @@ protected:
static void toGLMatrix(float*, const TransformationMatrix&);
void dumpLayer(TextStream&, int indent) const;
virtual const char* layerTypeAsString() const { return "LayerChromium"; }
virtual void dumpLayerProperties(TextStream&, int indent) const;
FloatRect m_dirtyRect;
bool m_contentsDirty;
......@@ -225,6 +238,10 @@ private:
Vector<RefPtr<LayerChromium> > m_sublayers;
LayerChromium* m_superlayer;
#ifndef NDEBUG
int m_debugID;
#endif
// Layer properties.
FloatPoint m_position;
FloatPoint m_anchorPoint;
......
......@@ -40,6 +40,7 @@
#include "LayerChromium.h"
#include "LayerTexture.h"
#include "NotImplemented.h"
#include "TextStream.h"
#include "TextureManager.h"
#include "WebGLLayerChromium.h"
#include "cc/CCLayerImpl.h"
......@@ -116,10 +117,13 @@ LayerRendererChromium::LayerRendererChromium(PassRefPtr<GraphicsContext3D> conte
m_hardwareCompositing = initializeSharedObjects();
m_rootLayerTiler = LayerTilerChromium::create(this, IntSize(256, 256), LayerTilerChromium::NoBorderTexels);
ASSERT(m_rootLayerTiler);
m_headsUpDisplay = CCHeadsUpDisplay::create(this);
}
LayerRendererChromium::~LayerRendererChromium()
{
m_headsUpDisplay.clear(); // Explicitly destroy the HUD before the TextureManager dies.
cleanupSharedObjects();
}
......@@ -322,6 +326,14 @@ void LayerRendererChromium::drawLayers(const IntRect& visibleRect, const IntRect
}
}
if (m_headsUpDisplay->enabled()) {
GLC(m_context.get(), m_context->enable(GraphicsContext3D::BLEND));
GLC(m_context.get(), m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST));
useRenderSurface(m_defaultRenderSurface);
m_headsUpDisplay->draw();
}
GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST));
GLC(m_context.get(), m_context->disable(GraphicsContext3D::BLEND));
}
......@@ -338,6 +350,8 @@ void LayerRendererChromium::present()
// Note that currently this has the same effect as swapBuffers; we should
// consider exposing a different entry point on GraphicsContext3D.
m_context->prepareTexture();
m_headsUpDisplay->onPresent();
}
void LayerRendererChromium::setRootLayer(PassRefPtr<LayerChromium> layer)
......@@ -877,6 +891,26 @@ void LayerRendererChromium::cleanupSharedObjects()
m_textureManager.clear();
}
String LayerRendererChromium::layerTreeAsText() const
{
TextStream ts;
if (m_rootLayer.get()) {
ts << m_rootLayer->layerTreeAsText();
ts << "RenderSurfaces:\n";
dumpRenderSurfaces(ts, 1, m_rootLayer.get());
}
return ts.release();
}
void LayerRendererChromium::dumpRenderSurfaces(TextStream& ts, int indent, LayerChromium* layer) const
{
if (layer->ccLayerImpl()->renderSurface())
layer->ccLayerImpl()->renderSurface()->dumpSurface(ts, indent);
for (size_t i = 0; i < layer->getSublayers().size(); ++i)
dumpRenderSurfaces(ts, indent, layer->getSublayers()[i].get());
}
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
......@@ -43,6 +43,7 @@
#include "RenderSurfaceChromium.h"
#include "SkBitmap.h"
#include "VideoLayerChromium.h"
#include "cc/CCHeadsUpDisplay.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
......@@ -60,6 +61,7 @@ namespace WebCore {
class CCLayerImpl;
class GeometryBinding;
class GraphicsContext3D;
class CCHeadsUpDisplay;
// Class that handles drawing of composited render layers using GL.
class LayerRendererChromium : public RefCounted<LayerRendererChromium> {
......@@ -94,10 +96,6 @@ public:
LayerTexture* getOffscreenLayerTexture();
void copyOffscreenTextureToDisplay();
void setRootLayerCanvasSize(const IntSize&);
GraphicsContext* rootLayerGraphicsContext() const { return m_rootLayerGraphicsContext.get(); }
unsigned createLayerTexture();
void deleteLayerTexture(unsigned);
......@@ -128,8 +126,13 @@ public:
TextureManager* textureManager() const { return m_textureManager.get(); }
CCHeadsUpDisplay* headsUpDisplay() { return m_headsUpDisplay.get(); }
IntRect rootVisibleRect() const { return m_rootVisibleRect; }
void setScissorToRect(const IntRect&);
String layerTreeAsText() const;
private:
explicit LayerRendererChromium(PassRefPtr<GraphicsContext3D> graphicsContext3D);
void updateLayersRecursive(LayerChromium*, const TransformationMatrix& parentMatrix, Vector<CCLayerImpl*>& renderSurfaceLayerList, Vector<CCLayerImpl*>& layerList);
......@@ -148,6 +151,8 @@ private:
static bool compareLayerZ(const CCLayerImpl*, const CCLayerImpl*);
void dumpRenderSurfaces(TextStream&, int indent, LayerChromium*) const;
bool initializeSharedObjects();
void cleanupSharedObjects();
......@@ -183,8 +188,6 @@ private:
OwnPtr<GraphicsContext> m_rootLayerGraphicsContext;
#endif
IntSize m_rootLayerCanvasSize;
IntRect m_rootVisibleRect;
IntRect m_rootContentRect;
......@@ -208,6 +211,8 @@ private:
OwnPtr<TextureManager> m_textureManager;
OwnPtr<CCHeadsUpDisplay> m_headsUpDisplay;
RefPtr<GraphicsContext3D> m_context;
RenderSurfaceChromium* m_defaultRenderSurface;
......
......@@ -37,7 +37,7 @@ namespace WebCore {
class PluginLayerChromium : public LayerChromium {
public:
static PassRefPtr<PluginLayerChromium> create(GraphicsLayerChromium* owner = 0);
virtual bool drawsContent() { return true; }
virtual bool drawsContent() const { return true; }
virtual void updateContentsIfDirty();
virtual void draw();
......@@ -45,6 +45,9 @@ public:
typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexFlipAlpha> Program;
protected:
virtual const char* layerTypeAsString() const { return "PluginLayer"; }
private:
PluginLayerChromium(GraphicsLayerChromium* owner);
unsigned m_textureId;
......
......@@ -31,8 +31,11 @@
#include "cc/CCLayerImpl.h"
#include "GraphicsContext3D.h"
#include "LayerChromium.h"
#include "LayerRendererChromium.h"
#include "LayerTexture.h"
#include "TextStream.h"
#include <wtf/text/CString.h>
namespace WebCore {
......@@ -164,5 +167,29 @@ void RenderSurfaceChromium::draw()
drawSurface(m_maskLayer, m_drawTransform);
}
String RenderSurfaceChromium::name() const
{
#ifndef NDEBUG
return String::format("RenderSurface(id=%i,owner=%s)", m_owningLayer->debugID(), m_owningLayer->name().utf8().data());
#else
return String::format("RenderSurface(owner=%s)", m_owningLayer->name().utf8().data());
#endif
}
static void writeIndent(TextStream& ts, int indent)
{
for (int i = 0; i != indent; ++i)
ts << " ";
}
void RenderSurfaceChromium::dumpSurface(TextStream& ts, int indent) const
{
writeIndent(ts, indent);
ts << name() << "\n";
writeIndent(ts, indent+1);
ts << "contentRect: (" << m_contentRect.x() << ", " << m_contentRect.y() << ", " << m_contentRect.width() << ", " << m_contentRect.height() << "\n";
}
}
#endif // USE(ACCELERATED_COMPOSITING)
......@@ -54,6 +54,9 @@ public:
void cleanupResources();
void draw();
String name() const;
void dumpSurface(TextStream&, int indent) const;
FloatPoint contentRectCenter() const { return FloatRect(m_contentRect).center(); }
IntRect contentRect() const { return m_contentRect; }
......@@ -74,6 +77,7 @@ private:
IntRect m_contentRect;
bool m_skipsDraw;
OwnPtr<LayerTexture> m_contentsTexture;
float m_drawOpacity;
TransformationMatrix m_drawTransform;
......
......@@ -46,7 +46,7 @@ public:
VideoFrameProvider* = 0);
virtual ~VideoLayerChromium();
virtual void updateContentsIfDirty();
virtual bool drawsContent() { return true; }
virtual bool drawsContent() const { return true; }
virtual void draw();
// This function is called by VideoFrameProvider. When this method is called
......@@ -58,6 +58,7 @@ public: