Diff
Modified: trunk/Source/WebCore/ChangeLog (97779 => 97780)
--- trunk/Source/WebCore/ChangeLog 2011-10-18 18:19:32 UTC (rev 97779)
+++ trunk/Source/WebCore/ChangeLog 2011-10-18 19:10:17 UTC (rev 97780)
@@ -1,3 +1,34 @@
+2011-10-18 Shawn Singh <[email protected]>
+
+ [chromium] Tracking update rects in LayerChromium and CCLayerImpl.
+ https://bugs.webkit.org/show_bug.cgi?id=69441
+
+ Reviewed by James Robinson.
+
+ This patch does not do much on its own, but is just part 1 of a
+ string of other patches which will use these rects for
+ visualization and scissoring. The appropriate testing will be
+ associated with those patches.
+
+ * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
+ (WebCore::Canvas2DLayerChromium::updateCompositorResources):
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::pushPropertiesTo):
+ * platform/graphics/chromium/LayerChromium.h:
+ * platform/graphics/chromium/TiledLayerChromium.cpp:
+ (WebCore::TiledLayerChromium::cleanupResources):
+ (WebCore::TiledLayerChromium::updateCompositorResources):
+ (WebCore::TiledLayerChromium::pushPropertiesTo):
+ (WebCore::TiledLayerChromium::prepareToUpdate):
+ * platform/graphics/chromium/TiledLayerChromium.h:
+ * platform/graphics/chromium/VideoLayerChromium.cpp:
+ (WebCore::VideoLayerChromium::updateCompositorResources):
+ * platform/graphics/chromium/WebGLLayerChromium.cpp:
+ (WebCore::WebGLLayerChromium::updateCompositorResources):
+ * platform/graphics/chromium/cc/CCLayerImpl.h:
+ (WebCore::CCLayerImpl::updateRect):
+ (WebCore::CCLayerImpl::setUpdateRect):
+
2011-10-18 Anna Cavender <[email protected]>
Change CodeGeneratorGObject.pm to use g_value_get_uint() instead of g_value_get_ushort()
Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp (97779 => 97780)
--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp 2011-10-18 18:19:32 UTC (rev 97779)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp 2011-10-18 19:10:17 UTC (rev 97780)
@@ -79,6 +79,8 @@
#endif
m_context->flush();
}
+
+ m_updateRect = FloatRect(FloatPoint(), bounds());
resetNeedsDisplay();
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (97779 => 97780)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2011-10-18 18:19:32 UTC (rev 97779)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2011-10-18 19:10:17 UTC (rev 97780)
@@ -296,11 +296,15 @@
layer->setScrollPosition(m_scrollPosition);
layer->setSublayerTransform(m_sublayerTransform);
layer->setTransform(m_transform);
+ layer->setUpdateRect(m_updateRect);
if (maskLayer())
maskLayer()->pushPropertiesTo(layer->maskLayer());
if (replicaLayer())
replicaLayer()->pushPropertiesTo(layer->replicaLayer());
+
+ // Reset any state that should be cleared for the next update.
+ m_updateRect = FloatRect();
}
PassRefPtr<CCLayerImpl> LayerChromium::createCCLayerImpl()
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (97779 => 97780)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2011-10-18 18:19:32 UTC (rev 97779)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2011-10-18 19:10:17 UTC (rev 97780)
@@ -210,8 +210,14 @@
void setNeedsCommit();
+ // The dirty rect is the union of damaged regions that need repainting/updating.
FloatRect m_dirtyRect;
+ // The update rect is the region of the compositor resource that was actually updated by the compositor.
+ // For layers that may do updating outside the compositor's control (i.e. plugin layers), this information
+ // is not available and the update rect will remain empty.
+ FloatRect m_updateRect;
+
RefPtr<LayerChromium> m_maskLayer;
friend class TreeSynchronizer;
Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp (97779 => 97780)
--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp 2011-10-18 18:19:32 UTC (rev 97779)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp 2011-10-18 19:10:17 UTC (rev 97780)
@@ -89,7 +89,7 @@
m_tiler.clear();
m_unusedTiles.clear();
m_paintRect = IntRect();
- m_updateRect = IntRect();
+ m_requestedUpdateRect = IntRect();
}
void TiledLayerChromium::updateTileSizeAndTilingOption()
@@ -154,11 +154,11 @@
void TiledLayerChromium::updateCompositorResources(GraphicsContext3D* context, TextureAllocator* allocator)
{
// Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update.
- if (m_skipsDraw || m_updateRect.isEmpty() || !m_tiler->numTiles())
+ if (m_skipsDraw || m_requestedUpdateRect.isEmpty() || !m_tiler->numTiles())
return;
int left, top, right, bottom;
- m_tiler->contentRectToTileIndices(m_updateRect, left, top, right, bottom);
+ m_tiler->contentRectToTileIndices(m_requestedUpdateRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
UpdatableTile* tile = tileAt(i, j);
@@ -207,6 +207,8 @@
tile->clearDirty();
}
}
+
+ m_updateRect = FloatRect(m_tiler->contentRectToLayerRect(m_paintRect));
}
void TiledLayerChromium::setTilingOption(TilingOption tilingOption)
@@ -349,7 +351,7 @@
m_skipsDraw = false;
if (contentRect.isEmpty()) {
- m_updateRect = IntRect();
+ m_requestedUpdateRect = IntRect();
return;
}
@@ -359,7 +361,7 @@
m_tiler->growLayerToContain(contentRect);
if (!m_tiler->numTiles()) {
- m_updateRect = IntRect();
+ m_requestedUpdateRect = IntRect();
return;
}
@@ -390,7 +392,7 @@
// Due to borders, when the paint rect is extended to tile boundaries, it
// may end up overlapping more tiles than the original content rect. Record
// that original rect so we don't upload more tiles than necessary.
- m_updateRect = contentRect;
+ m_requestedUpdateRect = contentRect;
m_paintRect = m_tiler->layerRectToContentRect(dirtyLayerRect);
if (dirtyLayerRect.isEmpty())
Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h (97779 => 97780)
--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h 2011-10-18 18:19:32 UTC (rev 97779)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h 2011-10-18 19:10:17 UTC (rev 97780)
@@ -67,8 +67,7 @@
void invalidateRect(const IntRect& contentRect);
// Prepare data needed to update textures that intersect with contentRect.
void prepareToUpdate(const IntRect& contentRect);
- // Update invalid textures that intersect with contentRect provided in prepareToUpdate().
- void updateRect(GraphicsContext3D*, LayerTextureUpdater*);
+
virtual void protectVisibleTileTextures();
private:
@@ -85,9 +84,11 @@
TextureManager* textureManager() const;
- // State held between update and upload.
+ // Temporary state held between prepareToUpdate() and updateCompositorResources().
+ IntRect m_requestedUpdateRect;
+ // State held between prepareToUpdate() and pushPropertiesTo(). This represents the area
+ // of the layer that is actually re-painted by WebKit.
IntRect m_paintRect;
- IntRect m_updateRect;
// Tightly packed set of unused tiles.
Vector<RefPtr<UpdatableTile> > m_unusedTiles;
Modified: trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp (97779 => 97780)
--- trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp 2011-10-18 18:19:32 UTC (rev 97779)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp 2011-10-18 19:10:17 UTC (rev 97780)
@@ -134,6 +134,7 @@
m_planes = frame->planes();
ASSERT(m_planes <= MaxPlanes);
+ m_updateRect = FloatRect(FloatPoint(), bounds());
resetNeedsDisplay();
m_provider->putCurrentFrame(frame);
Modified: trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp (97779 => 97780)
--- trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp 2011-10-18 18:19:32 UTC (rev 97779)
+++ trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp 2011-10-18 19:10:17 UTC (rev 97780)
@@ -90,6 +90,7 @@
//
m_context->prepareTexture();
m_context->markLayerComposited();
+ m_updateRect = FloatRect(FloatPoint(), bounds());
resetNeedsDisplay();
m_textureUpdated = false;
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h (97779 => 97780)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h 2011-10-18 18:19:32 UTC (rev 97779)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h 2011-10-18 19:10:17 UTC (rev 97780)
@@ -169,6 +169,8 @@
void setScreenSpaceTransform(const TransformationMatrix& matrix) { m_screenSpaceTransform = matrix; }
const IntRect& drawableContentRect() const { return m_drawableContentRect; }
void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
+ const FloatRect& updateRect() const { return m_updateRect; }
+ void setUpdateRect(const FloatRect& updateRect) { m_updateRect = updateRect; }
String layerTreeAsText() const;
@@ -256,6 +258,10 @@
// Hierarchical bounding rect containing the layer and its descendants.
IntRect m_drawableContentRect;
+
+ // Rect indicating what was repainted/updated during update.
+ // Note that plugin layers bypass this and leave it empty.
+ FloatRect m_updateRect;
};
void sortLayers(Vector<RefPtr<CCLayerImpl> >::iterator first, Vector<RefPtr<CCLayerImpl> >::iterator end, CCLayerSorter*);