Title: [135620] trunk/Source
Revision
135620
Author
[email protected]
Date
2012-11-23 08:51:15 -0800 (Fri, 23 Nov 2012)

Log Message

[TexMap] Remove dependency of TextureMapperLayer on GraphicsLayerTextureMapper.
https://bugs.webkit.org/show_bug.cgi?id=103046

Patch by Huang Dongsung <[email protected]> on 2012-11-23
Reviewed by Noam Rosenthal.

Source/WebCore:

It is a preparation patch for Threaded Coordinated Graphics on WK1.

We want to make TextureMapperLayer into an actor model. After making an actor
model, GraphicsLayerTextureMapper and LayerTreeRenderer will communicate with
TextureMapperLayer using message passing. In the first step, we want to hide
GraphicsLayerTextureMapper from TextureMapperLayer.

There are 2 kinds of dependencies of TextureMapperLayer in GraphicsLayerTextureMapper.
1. To query layer states
2. To paint layer contents

In this patch, we removed the second dependency. Currently, TextureMapperLayer
requests painting contents to GraphicsLayerTextureMapper in WK1 while
Coordinated Graphics prepares the contents in LayerTreeRenderer. This patch
makes WK1 prepare the contents in GraphicsLayerTextureMapper like
LayerTreeRenderer.

We will remove the first dependency in a follow-up patch.

Covered by existing layout tests.

* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper):
(WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):
(WebCore::GraphicsLayerTextureMapper::flushCompositingState):
(WebCore):
(WebCore::GraphicsLayerTextureMapper::didFlushCompositingState):
(WebCore::GraphicsLayerTextureMapper::didFlushCompositingStateRecursive):
(WebCore::GraphicsLayerTextureMapper::updateBackingStore):
(WebCore::GraphicsLayerTextureMapper::prepareBackingStore):
(WebCore::GraphicsLayerTextureMapper::shouldHaveBackingStore):
(WebCore::GraphicsLayerTextureMapper::drawRepaintCounter):
(WebCore::GraphicsLayerTextureMapper::setDebugBorder):
* platform/graphics/texmap/GraphicsLayerTextureMapper.h:
(GraphicsLayerTextureMapper):
(WebCore::GraphicsLayerTextureMapper::setHasOwnBackingStore):
* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::rootLayer):
(WebCore::TextureMapperLayer::paintSelf):
(WebCore::TextureMapperLayer::textureMapper):
(WebCore):
(WebCore::TextureMapperLayer::flushCompositingState):
(WebCore::TextureMapperLayer::flushCompositingStateSelf):
* platform/graphics/texmap/TextureMapperLayer.h:
(WebCore):
(WebCore::TextureMapperLayer::TextureMapperLayer):
(TextureMapperLayer):
(WebCore::TextureMapperLayer::setBackingStore):
(State):
(WebCore::TextureMapperLayer::State::State):

Source/WebKit2:

This patch makes GraphicsLayerTextureMapper create its own backing
store. However, LayerTreeRenderer also creates its own backing store. So
when LayerTreeRenderer uses GraphicsLayerTextureMapper,
LayerTreeRenderer needs GraphicsLayerTextureMapper to not create its own
backing store.

* UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
(WebKit::LayerTreeRenderer::createLayer):
(WebKit::LayerTreeRenderer::getBackingStore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135619 => 135620)


--- trunk/Source/WebCore/ChangeLog	2012-11-23 16:47:57 UTC (rev 135619)
+++ trunk/Source/WebCore/ChangeLog	2012-11-23 16:51:15 UTC (rev 135620)
@@ -1,3 +1,61 @@
+2012-11-23  Huang Dongsung  <[email protected]>
+
+        [TexMap] Remove dependency of TextureMapperLayer on GraphicsLayerTextureMapper.
+        https://bugs.webkit.org/show_bug.cgi?id=103046
+
+        Reviewed by Noam Rosenthal.
+
+        It is a preparation patch for Threaded Coordinated Graphics on WK1.
+
+        We want to make TextureMapperLayer into an actor model. After making an actor
+        model, GraphicsLayerTextureMapper and LayerTreeRenderer will communicate with
+        TextureMapperLayer using message passing. In the first step, we want to hide
+        GraphicsLayerTextureMapper from TextureMapperLayer.
+
+        There are 2 kinds of dependencies of TextureMapperLayer in GraphicsLayerTextureMapper.
+        1. To query layer states
+        2. To paint layer contents
+
+        In this patch, we removed the second dependency. Currently, TextureMapperLayer
+        requests painting contents to GraphicsLayerTextureMapper in WK1 while
+        Coordinated Graphics prepares the contents in LayerTreeRenderer. This patch
+        makes WK1 prepare the contents in GraphicsLayerTextureMapper like
+        LayerTreeRenderer.
+
+        We will remove the first dependency in a follow-up patch.
+
+        Covered by existing layout tests.
+
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+        (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper):
+        (WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):
+        (WebCore::GraphicsLayerTextureMapper::flushCompositingState):
+        (WebCore):
+        (WebCore::GraphicsLayerTextureMapper::didFlushCompositingState):
+        (WebCore::GraphicsLayerTextureMapper::didFlushCompositingStateRecursive):
+        (WebCore::GraphicsLayerTextureMapper::updateBackingStore):
+        (WebCore::GraphicsLayerTextureMapper::prepareBackingStore):
+        (WebCore::GraphicsLayerTextureMapper::shouldHaveBackingStore):
+        (WebCore::GraphicsLayerTextureMapper::drawRepaintCounter):
+        (WebCore::GraphicsLayerTextureMapper::setDebugBorder):
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
+        (GraphicsLayerTextureMapper):
+        (WebCore::GraphicsLayerTextureMapper::setHasOwnBackingStore):
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::rootLayer):
+        (WebCore::TextureMapperLayer::paintSelf):
+        (WebCore::TextureMapperLayer::textureMapper):
+        (WebCore):
+        (WebCore::TextureMapperLayer::flushCompositingState):
+        (WebCore::TextureMapperLayer::flushCompositingStateSelf):
+        * platform/graphics/texmap/TextureMapperLayer.h:
+        (WebCore):
+        (WebCore::TextureMapperLayer::TextureMapperLayer):
+        (TextureMapperLayer):
+        (WebCore::TextureMapperLayer::setBackingStore):
+        (State):
+        (WebCore::TextureMapperLayer::State::State):
+
 2012-11-23  Carlos Garcia Campos  <[email protected]>
 
         [ENCHANT] Infinite loop when end word position is not found

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (135619 => 135620)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2012-11-23 16:47:57 UTC (rev 135619)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2012-11-23 16:51:15 UTC (rev 135620)
@@ -20,10 +20,18 @@
 #include "config.h"
 #include "GraphicsLayerTextureMapper.h"
 
+#include "GraphicsContext.h"
 #include "GraphicsLayerAnimation.h"
 #include "GraphicsLayerFactory.h"
-#include "TextureMapperLayer.h"
+#include "ImageBuffer.h"
+#include "NotImplemented.h"
+#include <wtf/CurrentTime.h>
 
+#if USE(CAIRO)
+#include "CairoUtilities.h"
+#include <wtf/text/CString.h>
+#endif
+
 namespace WebCore {
 
 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient* client)
@@ -47,7 +55,9 @@
     , m_compositedNativeImagePtr(0)
     , m_changeMask(0)
     , m_needsDisplay(false)
+    , m_hasOwnBackingStore(true)
     , m_fixedToViewport(false)
+    , m_debugBorderWidth(0)
     , m_contentsLayer(0)
     , m_animationStartedTimer(this, &GraphicsLayerTextureMapper::animationStartedTimerFired)
 {
@@ -61,13 +71,6 @@
     client()->notifyFlushRequired(this);
 }
 
-void GraphicsLayerTextureMapper::didSynchronize()
-{
-    m_changeMask = 0;
-    m_needsDisplay = false;
-    m_needsDisplayRect = IntRect();
-}
-
 void GraphicsLayerTextureMapper::setName(const String& name)
 {
     GraphicsLayer::setName(name);
@@ -377,6 +380,7 @@
 void GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly()
 {
     m_layer->flushCompositingState(this);
+    didFlushCompositingState();
 }
 
 /* \reimp (GraphicsLayer.h)
@@ -384,8 +388,122 @@
 void GraphicsLayerTextureMapper::flushCompositingState(const FloatRect&)
 {
     m_layer->flushCompositingState(this, TextureMapperLayer::TraverseDescendants);
+    didFlushCompositingStateRecursive();
 }
 
+void GraphicsLayerTextureMapper::didFlushCompositingState()
+{
+    updateBackingStore();
+    m_changeMask = 0;
+    m_needsDisplay = false;
+    m_needsDisplayRect = IntRect();
+}
+
+void GraphicsLayerTextureMapper::didFlushCompositingStateRecursive()
+{
+    didFlushCompositingState();
+    for (size_t i = 0; i < children().size(); ++i)
+        toGraphicsLayerTextureMapper(children()[i])->didFlushCompositingStateRecursive();
+    if (maskLayer())
+        toGraphicsLayerTextureMapper(maskLayer())->didFlushCompositingStateRecursive();
+    if (replicaLayer())
+        toGraphicsLayerTextureMapper(replicaLayer())->didFlushCompositingStateRecursive();
+}
+
+void GraphicsLayerTextureMapper::updateBackingStore()
+{
+    if (!m_hasOwnBackingStore)
+        return;
+
+    prepareBackingStore();
+    m_layer->setBackingStore(m_backingStore);
+}
+
+void GraphicsLayerTextureMapper::prepareBackingStore()
+{
+    if (!shouldHaveBackingStore()) {
+        m_backingStore.clear();
+        return;
+    }
+
+    IntRect dirtyRect = enclosingIntRect(FloatRect(FloatPoint::zero(), m_size));
+    if (!m_needsDisplay)
+        dirtyRect.intersect(enclosingIntRect(m_needsDisplayRect));
+    if (dirtyRect.isEmpty())
+        return;
+
+    TextureMapper* textureMapper = m_layer->textureMapper();
+    ASSERT(textureMapper);
+
+    if (!m_backingStore)
+        m_backingStore = TextureMapperTiledBackingStore::create();
+
+    // Paint the entire dirty rect into an image buffer. This ensures we only paint once.
+    OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(dirtyRect.size());
+    GraphicsContext* context = imageBuffer->context();
+    context->setImageInterpolationQuality(textureMapper->imageInterpolationQuality());
+    context->setTextDrawingMode(textureMapper->textDrawingMode());
+    context->translate(-dirtyRect.x(), -dirtyRect.y());
+    paintGraphicsLayerContents(*context, dirtyRect);
+
+    if (isShowingRepaintCounter()) {
+        incrementRepaintCount();
+        drawRepaintCounter(context);
+    }
+
+    RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
+#if PLATFORM(QT)
+    ASSERT(dynamic_cast<TextureMapperTiledBackingStore*>(m_backingStore.get()));
+#endif
+    TextureMapperTiledBackingStore* backingStore = static_cast<TextureMapperTiledBackingStore*>(m_backingStore.get());
+    backingStore->updateContents(textureMapper, image.get(), m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData);
+
+    backingStore->setShowDebugBorders(isShowingDebugBorder());
+    backingStore->setDebugBorder(m_debugBorderColor, m_debugBorderWidth);
+
+    m_needsDisplay = false;
+    m_needsDisplayRect = IntRect();
+}
+
+bool GraphicsLayerTextureMapper::shouldHaveBackingStore() const
+{
+    return drawsContent() && contentsAreVisible() && !m_size.isEmpty();
+}
+
+#if USE(CAIRO)
+void GraphicsLayerTextureMapper::drawRepaintCounter(GraphicsContext* context)
+{
+    cairo_t* cr = context->platformContext()->cr();
+    cairo_save(cr);
+
+    CString repaintCount = String::format("%i", this->repaintCount()).utf8();
+    cairo_select_font_face(cr, "sans-serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+    cairo_set_font_size(cr, 18);
+
+    cairo_text_extents_t repaintTextExtents;
+    cairo_text_extents(cr, repaintCount.data(), &repaintTextExtents);
+
+    static const int repaintCountBorderWidth = 10;
+    setSourceRGBAFromColor(cr, isShowingDebugBorder() ? m_debugBorderColor : Color(0, 255, 0, 127));
+    cairo_rectangle(cr, 0, 0,
+        repaintTextExtents.width + (repaintCountBorderWidth * 2),
+        repaintTextExtents.height + (repaintCountBorderWidth * 2));
+    cairo_fill(cr);
+
+    cairo_set_source_rgb(cr, 1, 1, 1);
+    cairo_move_to(cr, repaintCountBorderWidth, repaintTextExtents.height + repaintCountBorderWidth);
+    cairo_show_text(cr, repaintCount.data());
+
+    cairo_restore(cr);
+}
+#else
+void GraphicsLayerTextureMapper::drawRepaintCounter(GraphicsContext* context)
+{
+    notImplemented();
+}
+
+#endif
+
 bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)
 {
     ASSERT(!keyframesName.isEmpty());
@@ -429,7 +547,10 @@
 
 void GraphicsLayerTextureMapper::setDebugBorder(const Color& color, float width)
 {
-    m_layer->setDebugBorder(color, width);
+    // The default values for GraphicsLayer debug borders are a little
+    // hard to see (some less than one pixel wide), so we double their size here.
+    m_debugBorderColor = color;
+    m_debugBorderWidth = width * 2;
 }
 
 #if ENABLE(CSS_FILTERS)

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (135619 => 135620)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2012-11-23 16:47:57 UTC (rev 135619)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2012-11-23 16:51:15 UTC (rev 135620)
@@ -25,11 +25,10 @@
 #include "GraphicsLayerClient.h"
 #include "Image.h"
 #include "TextureMapperLayer.h"
+#include "Timer.h"
 
 namespace WebCore {
 
-class TextureMapperLayer;
-class BitmapTexture;
 class TextureMapper;
 
 class GraphicsLayerTextureMapper : public GraphicsLayer {
@@ -76,7 +75,6 @@
 
     void notifyChange(TextureMapperLayer::ChangeMask);
     inline int changeMask() const { return m_changeMask; }
-    void didSynchronize();
 
     virtual bool addAnimation(const KeyframeValueList&, const IntSize&, const Animation*, const String&, double);
     virtual void pauseAnimation(const String&, double);
@@ -84,8 +82,6 @@
     void setAnimations(const GraphicsLayerAnimations&);
 
     TextureMapperLayer* layer() const { return m_layer.get(); }
-    bool needsDisplay() const { return m_needsDisplay; }
-    IntRect needsDisplayRect() const { return enclosingIntRect(m_needsDisplayRect); }
 
     virtual void setDebugBorder(const Color&, float width);
 
@@ -93,22 +89,38 @@
     virtual bool setFilters(const FilterOperations&);
 #endif
 
+    // FIXME: It will be removed after removing dependency of LayerTreeRenderer on GraphicsLayerTextureMapper.
+    void setHasOwnBackingStore(bool b) { m_hasOwnBackingStore = b; }
+
     void setFixedToViewport(bool fixed) { m_fixedToViewport = fixed; }
     bool fixedToViewport() const { return m_fixedToViewport; }
 
 private:
     virtual void willBeDestroyed();
+    void didFlushCompositingState();
+    void didFlushCompositingStateRecursive();
+    void updateBackingStore();
+    void prepareBackingStore();
+    bool shouldHaveBackingStore() const;
+    void drawRepaintCounter(GraphicsContext*);
+    void animationStartedTimerFired(Timer<GraphicsLayerTextureMapper>*);
 
     OwnPtr<TextureMapperLayer> m_layer;
     RefPtr<TextureMapperTiledBackingStore> m_compositedImage;
     NativeImagePtr m_compositedNativeImagePtr;
+    RefPtr<TextureMapperBackingStore> m_backingStore;
+
     int m_changeMask;
     bool m_needsDisplay;
+    bool m_hasOwnBackingStore;
     bool m_fixedToViewport;
+
+    Color m_debugBorderColor;
+    float m_debugBorderWidth;
+
     TextureMapperPlatformLayer* m_contentsLayer;
     FloatRect m_needsDisplayRect;
     GraphicsLayerAnimations m_animations;
-    void animationStartedTimerFired(Timer<GraphicsLayerTextureMapper>*);
     Timer<GraphicsLayerTextureMapper> m_animationStartedTimer;
 };
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (135619 => 135620)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2012-11-23 16:47:57 UTC (rev 135619)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2012-11-23 16:51:15 UTC (rev 135620)
@@ -20,20 +20,10 @@
 #include "config.h"
 #include "TextureMapperLayer.h"
 
-#include "stdio.h"
-
 #if USE(ACCELERATED_COMPOSITING)
 
 #include "GraphicsLayerTextureMapper.h"
-#include "ImageBuffer.h"
-#include "NotImplemented.h"
-#include <wtf/MathExtras.h>
 
-#if USE(CAIRO)
-#include "CairoUtilities.h"
-#include <wtf/text/CString.h>
-#endif
-
 namespace WebCore {
 
 TextureMapperLayer* toTextureMapperLayer(GraphicsLayer* layer)
@@ -41,7 +31,7 @@
     return layer ? toGraphicsLayerTextureMapper(layer)->layer() : 0;
 }
 
-TextureMapperLayer* TextureMapperLayer::rootLayer()
+const TextureMapperLayer* TextureMapperLayer::rootLayer() const
 {
     if (m_effectTarget)
         return m_effectTarget->rootLayer();
@@ -95,56 +85,6 @@
         sortByZOrder(m_children, 0, m_children.size());
 }
 
-void TextureMapperLayer::updateBackingStore(TextureMapper* textureMapper, GraphicsLayerTextureMapper* layer)
-{
-    if (!layer || !textureMapper)
-        return;
-
-    if (!m_shouldUpdateBackingStoreFromLayer)
-        return;
-
-    if (!m_state.drawsContent || !m_state.contentsVisible || m_size.isEmpty()) {
-        m_backingStore.clear();
-        return;
-    }
-
-    IntRect dirtyRect = enclosingIntRect(layerRect());
-    if (!m_state.needsDisplay)
-        dirtyRect.intersect(enclosingIntRect(m_state.needsDisplayRect));
-    if (dirtyRect.isEmpty())
-        return;
-
-    if (!m_backingStore)
-        m_backingStore = TextureMapperTiledBackingStore::create();
-
-#if PLATFORM(QT)
-    ASSERT(dynamic_cast<TextureMapperTiledBackingStore*>(m_backingStore.get()));
-#endif
-
-    // Paint the entire dirty rect into an image buffer. This ensures we only paint once.
-    OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(dirtyRect.size());
-    GraphicsContext* context = imageBuffer->context();
-    context->setImageInterpolationQuality(textureMapper->imageInterpolationQuality());
-    context->setTextDrawingMode(textureMapper->textDrawingMode());
-    context->translate(-dirtyRect.x(), -dirtyRect.y());
-    layer->paintGraphicsLayerContents(*context, dirtyRect);
-
-    if (layer->isShowingRepaintCounter()) {
-        layer->incrementRepaintCount();
-        drawRepaintCounter(context, layer);
-    }
-
-    RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
-    TextureMapperTiledBackingStore* backingStore = static_cast<TextureMapperTiledBackingStore*>(m_backingStore.get());
-    backingStore->updateContents(textureMapper, image.get(), m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData);
-
-    backingStore->setShowDebugBorders(layer->isShowingDebugBorder());
-    backingStore->setDebugBorder(m_debugBorderColor, m_debugBorderWidth);
-
-    m_state.needsDisplay = false;
-    m_state.needsDisplayRect = IntRect();
-}
-
 void TextureMapperLayer::paint()
 {
     computeTransformsRecursive();
@@ -170,6 +110,7 @@
     RefPtr<BitmapTexture> mask = options.mask;
 
     if (m_backingStore) {
+        ASSERT(m_state.drawsContent && m_state.contentsVisible && !m_size.isEmpty());
         ASSERT(!layerRect().isEmpty());
         m_backingStore->paintToTextureMapper(options.textureMapper, layerRect(), transform, opacity, mask.get());
     }
@@ -406,9 +347,14 @@
         m_parent->m_children.remove(m_parent->m_children.find(this));
 }
 
+TextureMapper* TextureMapperLayer::textureMapper() const
+{
+    return rootLayer()->m_textureMapper;
+}
+
 void TextureMapperLayer::flushCompositingState(GraphicsLayerTextureMapper* graphicsLayer, int options)
 {
-    flushCompositingState(graphicsLayer, rootLayer()->m_textureMapper, options);
+    flushCompositingState(graphicsLayer, textureMapper(), options);
 }
 
 void TextureMapperLayer::flushCompositingStateSelf(GraphicsLayerTextureMapper* graphicsLayer, TextureMapper*)
@@ -489,9 +435,6 @@
 #endif
     m_fixedToViewport = graphicsLayer->fixedToViewport();
 
-    m_state.needsDisplay = m_state.needsDisplay || graphicsLayer->needsDisplay();
-    if (!m_state.needsDisplay)
-        m_state.needsDisplayRect.unite(graphicsLayer->needsDisplayRect());
     m_contentsLayer = graphicsLayer->platformLayer();
 
     m_transform.setPosition(adjustedPosition());
@@ -539,10 +482,8 @@
     if (!textureMapper)
         return;
 
-    if (graphicsLayer && !(options & ComputationsOnly)) {
+    if (graphicsLayer && !(options & ComputationsOnly))
         flushCompositingStateSelf(graphicsLayer, textureMapper);
-        graphicsLayer->didSynchronize();
-    }
 
     if (graphicsLayer && m_state.maskLayer) {
         m_state.maskLayer->flushCompositingState(toGraphicsLayerTextureMapper(graphicsLayer->maskLayer()), textureMapper);
@@ -556,7 +497,6 @@
         m_state.replicaLayer->flushCompositingState(toGraphicsLayerTextureMapper(graphicsLayer->replicaLayer()), textureMapper);
 
     syncAnimations();
-    updateBackingStore(textureMapper, graphicsLayer);
 
     if (!(options & TraverseDescendants))
         options = ComputationsOnly;
@@ -598,48 +538,5 @@
     m_transform.setPosition(adjustedPosition());
 }
 
-void TextureMapperLayer::setDebugBorder(const Color& color, float width)
-{
-    // The default values for GraphicsLayer debug borders are a little
-    // hard to see (some less than one pixel wide), so we double their size here.
-    m_debugBorderColor = color;
-    m_debugBorderWidth = width * 2;
 }
-
-#if USE(CAIRO)
-void TextureMapperLayer::drawRepaintCounter(GraphicsContext* context, GraphicsLayer* layer)
-{
-
-    cairo_t* cr = context->platformContext()->cr();
-    cairo_save(cr);
-
-    CString repaintCount = String::format("%i", layer->repaintCount()).utf8();
-    cairo_select_font_face(cr, "sans-serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-    cairo_set_font_size(cr, 18);
-
-    cairo_text_extents_t repaintTextExtents;
-    cairo_text_extents(cr, repaintCount.data(), &repaintTextExtents);
-
-    static const int repaintCountBorderWidth = 10;
-    setSourceRGBAFromColor(cr, layer->isShowingDebugBorder() ? m_debugBorderColor : Color(0, 255, 0, 127));
-    cairo_rectangle(cr, 0, 0,
-                    repaintTextExtents.width + (repaintCountBorderWidth * 2),
-                    repaintTextExtents.height + (repaintCountBorderWidth * 2));
-    cairo_fill(cr);
-
-    cairo_set_source_rgb(cr, 1, 1, 1);
-    cairo_move_to(cr, repaintCountBorderWidth, repaintTextExtents.height + repaintCountBorderWidth);
-    cairo_show_text(cr, repaintCount.data());
-
-    cairo_restore(cr);
-}
-#else
-void TextureMapperLayer::drawRepaintCounter(GraphicsContext* context, GraphicsLayer* layer)
-{
-    notImplemented();
-}
-
 #endif
-
-}
-#endif

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (135619 => 135620)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2012-11-23 16:47:57 UTC (rev 135619)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2012-11-23 16:51:15 UTC (rev 135620)
@@ -24,24 +24,15 @@
 
 #include "FilterOperations.h"
 #include "FloatRect.h"
-#include "GraphicsContext.h"
 #include "GraphicsLayer.h"
 #include "GraphicsLayerAnimation.h"
 #include "GraphicsLayerTransform.h"
-#include "Image.h"
-#include "IntPointHash.h"
 #include "TextureMapper.h"
 #include "TextureMapperBackingStore.h"
-#include "Timer.h"
-#include "TransformOperations.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
 class TextureMapperPlatformLayer;
-class TextureMapperLayer;
 class GraphicsLayerTextureMapper;
 
 class TextureMapperPaintOptions {
@@ -107,13 +98,12 @@
         , m_contentsLayer(0)
         , m_opacity(1)
         , m_centerZ(0)
-        , m_shouldUpdateBackingStoreFromLayer(true)
         , m_textureMapper(0)
-        , m_debugBorderWidth(0)
     { }
 
     virtual ~TextureMapperLayer();
 
+    TextureMapper* textureMapper() const;
     void flushCompositingState(GraphicsLayerTextureMapper*, int syncOptions = 0);
     void flushCompositingState(GraphicsLayerTextureMapper*, TextureMapper*, int syncOptions = 0);
     IntSize size() const { return IntSize(m_size.width(), m_size.height()); }
@@ -127,18 +117,16 @@
 
     void paint();
 
-    void setShouldUpdateBackingStoreFromLayer(bool b) { m_shouldUpdateBackingStoreFromLayer = b; }
-    void setBackingStore(TextureMapperBackingStore* backingStore) { m_backingStore = backingStore; }
+    void setBackingStore(PassRefPtr<TextureMapperBackingStore> backingStore) { m_backingStore = backingStore; }
     PassRefPtr<TextureMapperBackingStore> backingStore() { return m_backingStore; }
     void clearBackingStoresRecursive();
 
     void setScrollPositionDeltaIfNeeded(const FloatSize&);
 
-    void setDebugBorder(const Color&, float width);
     void applyAnimationsRecursively();
 
 private:
-    TextureMapperLayer* rootLayer();
+    const TextureMapperLayer* rootLayer() const;
     void computeTransformsRecursive();
     void computeOverlapsIfNeeded();
     void computeTiles();
@@ -161,10 +149,7 @@
     void paintSelf(const TextureMapperPaintOptions&);
     void paintSelfAndChildren(const TextureMapperPaintOptions&);
     void paintSelfAndChildrenWithReplica(const TextureMapperPaintOptions&);
-    void updateBackingStore(TextureMapper*, GraphicsLayerTextureMapper*);
 
-    void drawRepaintCounter(GraphicsContext*, GraphicsLayer*);
-
     // GraphicsLayerAnimation::Client
     void setAnimatedTransform(const TransformationMatrix& matrix) { setTransform(matrix); }
     void setAnimatedOpacity(float opacity) { setOpacity(opacity); }
@@ -202,7 +187,6 @@
 #endif
     float m_centerZ;
     String m_name;
-    bool m_shouldUpdateBackingStoreFromLayer;
 
     struct State {
         FloatPoint pos;
@@ -212,7 +196,6 @@
         TransformationMatrix childrenTransform;
         float opacity;
         FloatRect contentsRect;
-        FloatRect needsDisplayRect;
         int descendantsWithContent;
         TextureMapperLayer* maskLayer;
         TextureMapperLayer* replicaLayer;
@@ -227,7 +210,6 @@
         bool contentsOpaque : 1;
         bool backfaceVisibility : 1;
         bool visible : 1;
-        bool needsDisplay: 1;
         bool mightHaveOverlaps : 1;
         bool needsRepaint;
         State()
@@ -241,7 +223,6 @@
             , contentsOpaque(false)
             , backfaceVisibility(false)
             , visible(true)
-            , needsDisplay(true)
             , mightHaveOverlaps(false)
             , needsRepaint(false)
         {
@@ -253,8 +234,6 @@
     GraphicsLayerAnimations m_animations;
     FloatSize m_scrollPositionDelta;
     bool m_fixedToViewport;
-    Color m_debugBorderColor;
-    float m_debugBorderWidth;
 };
 
 

Modified: trunk/Source/WebKit2/ChangeLog (135619 => 135620)


--- trunk/Source/WebKit2/ChangeLog	2012-11-23 16:47:57 UTC (rev 135619)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-23 16:51:15 UTC (rev 135620)
@@ -1,5 +1,22 @@
 2012-11-23  Huang Dongsung  <[email protected]>
 
+        [TexMap] Remove dependency of TextureMapperLayer on GraphicsLayerTextureMapper.
+        https://bugs.webkit.org/show_bug.cgi?id=103046
+
+        Reviewed by Noam Rosenthal.
+
+        This patch makes GraphicsLayerTextureMapper create its own backing
+        store. However, LayerTreeRenderer also creates its own backing store. So
+        when LayerTreeRenderer uses GraphicsLayerTextureMapper,
+        LayerTreeRenderer needs GraphicsLayerTextureMapper to not create its own
+        backing store.
+
+        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
+        (WebKit::LayerTreeRenderer::createLayer):
+        (WebKit::LayerTreeRenderer::getBackingStore):
+
+2012-11-23  Huang Dongsung  <[email protected]>
+
         REGRESSION(r135486): ASSERT(isMainThread()) hit in LayerTreeRenderer::setActive(bool)
         https://bugs.webkit.org/show_bug.cgi?id=103077
 

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp (135619 => 135620)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp	2012-11-23 16:47:57 UTC (rev 135619)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp	2012-11-23 16:51:15 UTC (rev 135620)
@@ -86,9 +86,8 @@
 
 PassOwnPtr<GraphicsLayer> LayerTreeRenderer::createLayer(WebLayerID)
 {
-    GraphicsLayer* newLayer = new GraphicsLayerTextureMapper(this);
-    TextureMapperLayer* layer = toTextureMapperLayer(newLayer);
-    layer->setShouldUpdateBackingStoreFromLayer(false);
+    GraphicsLayerTextureMapper* newLayer = new GraphicsLayerTextureMapper(this);
+    newLayer->setHasOwnBackingStore(false);
     return adoptPtr(newLayer);
 }
 
@@ -411,7 +410,7 @@
     RefPtr<CoordinatedBackingStore> backingStore = static_cast<CoordinatedBackingStore*>(layer->backingStore().get());
     if (!backingStore) {
         backingStore = CoordinatedBackingStore::create();
-        layer->setBackingStore(backingStore.get());
+        layer->setBackingStore(backingStore);
     }
     ASSERT(backingStore);
     return backingStore;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to