diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp | 73 |
1 files changed, 45 insertions, 28 deletions
diff --git a/Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp b/Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp index e760a7dae..03a5eacad 100644 --- a/Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp +++ b/Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp @@ -45,17 +45,6 @@ LayerTreeHostProxy::~LayerTreeHostProxy() m_renderer->detach(); } -void LayerTreeHostProxy::paintToCurrentGLContext(const WebCore::TransformationMatrix& matrix, float opacity, const WebCore::FloatRect& rect) -{ - m_renderer->syncRemoteContent(); - m_renderer->paintToCurrentGLContext(matrix, opacity, rect); -} - -void LayerTreeHostProxy::paintToGraphicsContext(BackingStore::PlatformGraphicsContext context) -{ - m_renderer->paintToGraphicsContext(context); -} - void LayerTreeHostProxy::updateViewport() { m_drawingAreaProxy->updateViewport(); @@ -64,22 +53,29 @@ void LayerTreeHostProxy::updateViewport() void LayerTreeHostProxy::dispatchUpdate(const Function<void()>& function) { m_renderer->appendUpdate(function); - updateViewport(); } -void LayerTreeHostProxy::createTileForLayer(int layerID, int tileID, const WebKit::UpdateInfo& updateInfo) +void LayerTreeHostProxy::createTileForLayer(int layerID, int tileID, const IntRect& targetRect, const WebKit::SurfaceUpdateInfo& updateInfo) { - dispatchUpdate(bind(&WebLayerTreeRenderer::createTile, m_renderer.get(), layerID, tileID, updateInfo.updateScaleFactor)); - updateTileForLayer(layerID, tileID, updateInfo); + dispatchUpdate(bind(&WebLayerTreeRenderer::createTile, m_renderer.get(), layerID, tileID, updateInfo.scaleFactor)); + updateTileForLayer(layerID, tileID, targetRect, updateInfo); } -void LayerTreeHostProxy::updateTileForLayer(int layerID, int tileID, const WebKit::UpdateInfo& updateInfo) +void LayerTreeHostProxy::updateTileForLayer(int layerID, int tileID, const IntRect& targetRect, const WebKit::SurfaceUpdateInfo& updateInfo) { - ASSERT(updateInfo.updateRects.size() == 1); - IntRect sourceRect = updateInfo.updateRects.first(); - IntRect targetRect = updateInfo.updateRectBounds; - RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.bitmapHandle); - dispatchUpdate(bind(&WebLayerTreeRenderer::updateTile, m_renderer.get(), layerID, tileID, sourceRect, targetRect, bitmap)); + RefPtr<ShareableSurface> surface; +#if USE(GRAPHICS_SURFACE) + uint32_t token = updateInfo.surfaceHandle.graphicsSurfaceToken(); + HashMap<uint32_t, RefPtr<ShareableSurface> >::iterator it = m_surfaces.find(token); + if (it == m_surfaces.end()) { + surface = ShareableSurface::create(updateInfo.surfaceHandle); + m_surfaces.add(token, surface); + } else + surface = it->second; +#else + surface = ShareableSurface::create(updateInfo.surfaceHandle); +#endif + dispatchUpdate(bind(&WebLayerTreeRenderer::updateTile, m_renderer.get(), layerID, tileID, WebLayerTreeRenderer::TileUpdate(updateInfo.updateRect, targetRect, surface, updateInfo.surfaceOffset))); } void LayerTreeHostProxy::removeTileForLayer(int layerID, int tileID) @@ -90,21 +86,36 @@ void LayerTreeHostProxy::removeTileForLayer(int layerID, int tileID) void LayerTreeHostProxy::deleteCompositingLayer(WebLayerID id) { dispatchUpdate(bind(&WebLayerTreeRenderer::deleteLayer, m_renderer.get(), id)); + updateViewport(); } void LayerTreeHostProxy::setRootCompositingLayer(WebLayerID id) { dispatchUpdate(bind(&WebLayerTreeRenderer::setRootLayerID, m_renderer.get(), id)); + updateViewport(); } -void LayerTreeHostProxy::syncCompositingLayerState(const WebLayerInfo& info) +void LayerTreeHostProxy::setCompositingLayerState(WebLayerID id, const WebLayerInfo& info) { - dispatchUpdate(bind(&WebLayerTreeRenderer::syncLayerParameters, m_renderer.get(), info)); + dispatchUpdate(bind(&WebLayerTreeRenderer::setLayerState, m_renderer.get(), id, info)); } +void LayerTreeHostProxy::setCompositingLayerChildren(WebLayerID id, const Vector<WebLayerID>& children) +{ + dispatchUpdate(bind(&WebLayerTreeRenderer::setLayerChildren, m_renderer.get(), id, children)); +} + +#if ENABLE(CSS_FILTERS) +void LayerTreeHostProxy::setCompositingLayerFilters(WebLayerID id, const FilterOperations& filters) +{ + dispatchUpdate(bind(&WebLayerTreeRenderer::setLayerFilters, m_renderer.get(), id, filters)); +} +#endif + void LayerTreeHostProxy::didRenderFrame() { dispatchUpdate(bind(&WebLayerTreeRenderer::flushLayerChanges, m_renderer.get())); + updateViewport(); } void LayerTreeHostProxy::createDirectlyCompositedImage(int64_t key, const WebKit::ShareableBitmap::Handle& handle) @@ -118,15 +129,15 @@ void LayerTreeHostProxy::destroyDirectlyCompositedImage(int64_t key) dispatchUpdate(bind(&WebLayerTreeRenderer::destroyImage, m_renderer.get(), key)); } -void LayerTreeHostProxy::setVisibleContentsRectForPanning(const IntRect& rect, const FloatPoint& trajectoryVector) +void LayerTreeHostProxy::setContentsSize(const FloatSize& contentsSize) { - m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::SetVisibleContentsRectForPanning(rect, trajectoryVector), m_drawingAreaProxy->page()->pageID()); + m_renderer->setContentsSize(contentsSize); } -void LayerTreeHostProxy::setVisibleContentsRectForScaling(const IntRect& rect, float scale) +void LayerTreeHostProxy::setVisibleContentsRect(const IntRect& rect, float scale, const FloatPoint& trajectoryVector, const WebCore::FloatPoint& accurateVisibleContentsPosition) { - m_renderer->setVisibleContentsRectForScaling(rect, scale); - m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::SetVisibleContentsRectForScaling(rect, scale), m_drawingAreaProxy->page()->pageID()); + dispatchUpdate(bind(&WebLayerTreeRenderer::setVisibleContentsRect, m_renderer.get(), rect, scale, accurateVisibleContentsPosition)); + m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::SetVisibleContentsRect(rect, scale, trajectoryVector), m_drawingAreaProxy->page()->pageID()); } void LayerTreeHostProxy::renderNextFrame() @@ -134,8 +145,14 @@ void LayerTreeHostProxy::renderNextFrame() m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::RenderNextFrame(), m_drawingAreaProxy->page()->pageID()); } +void LayerTreeHostProxy::didChangeScrollPosition(const IntPoint& position) +{ + dispatchUpdate(bind(&WebLayerTreeRenderer::didChangeScrollPosition, m_renderer.get(), position)); +} + void LayerTreeHostProxy::purgeBackingStores() { + m_renderer->setActive(false); m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::PurgeBackingStores(), m_drawingAreaProxy->page()->pageID()); } |