diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
commit | dd91e772430dc294e3bf478c119ef8d43c0a3358 (patch) | |
tree | 6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp | |
parent | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff) | |
download | qtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz |
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp b/Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp new file mode 100644 index 000000000..e760a7dae --- /dev/null +++ b/Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp @@ -0,0 +1,143 @@ +/* + Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" + +#if USE(UI_SIDE_COMPOSITING) +#include "LayerTreeHostProxy.h" + +#include "LayerTreeHostMessages.h" +#include "UpdateInfo.h" +#include "WebCoreArgumentCoders.h" +#include "WebLayerTreeInfo.h" +#include "WebLayerTreeRenderer.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" + +namespace WebKit { + +using namespace WebCore; + +LayerTreeHostProxy::LayerTreeHostProxy(DrawingAreaProxy* drawingAreaProxy) + : m_drawingAreaProxy(drawingAreaProxy) + , m_renderer(adoptRef(new WebLayerTreeRenderer(this))) +{ +} + +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(); +} + +void LayerTreeHostProxy::dispatchUpdate(const Function<void()>& function) +{ + m_renderer->appendUpdate(function); + updateViewport(); +} + +void LayerTreeHostProxy::createTileForLayer(int layerID, int tileID, const WebKit::UpdateInfo& updateInfo) +{ + dispatchUpdate(bind(&WebLayerTreeRenderer::createTile, m_renderer.get(), layerID, tileID, updateInfo.updateScaleFactor)); + updateTileForLayer(layerID, tileID, updateInfo); +} + +void LayerTreeHostProxy::updateTileForLayer(int layerID, int tileID, const WebKit::UpdateInfo& 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)); +} + +void LayerTreeHostProxy::removeTileForLayer(int layerID, int tileID) +{ + dispatchUpdate(bind(&WebLayerTreeRenderer::removeTile, m_renderer.get(), layerID, tileID)); +} + +void LayerTreeHostProxy::deleteCompositingLayer(WebLayerID id) +{ + dispatchUpdate(bind(&WebLayerTreeRenderer::deleteLayer, m_renderer.get(), id)); +} + +void LayerTreeHostProxy::setRootCompositingLayer(WebLayerID id) +{ + dispatchUpdate(bind(&WebLayerTreeRenderer::setRootLayerID, m_renderer.get(), id)); +} + +void LayerTreeHostProxy::syncCompositingLayerState(const WebLayerInfo& info) +{ + dispatchUpdate(bind(&WebLayerTreeRenderer::syncLayerParameters, m_renderer.get(), info)); +} + +void LayerTreeHostProxy::didRenderFrame() +{ + dispatchUpdate(bind(&WebLayerTreeRenderer::flushLayerChanges, m_renderer.get())); +} + +void LayerTreeHostProxy::createDirectlyCompositedImage(int64_t key, const WebKit::ShareableBitmap::Handle& handle) +{ + RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(handle); + dispatchUpdate(bind(&WebLayerTreeRenderer::createImage, m_renderer.get(), key, bitmap)); +} + +void LayerTreeHostProxy::destroyDirectlyCompositedImage(int64_t key) +{ + dispatchUpdate(bind(&WebLayerTreeRenderer::destroyImage, m_renderer.get(), key)); +} + +void LayerTreeHostProxy::setVisibleContentsRectForPanning(const IntRect& rect, const FloatPoint& trajectoryVector) +{ + m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::SetVisibleContentsRectForPanning(rect, trajectoryVector), m_drawingAreaProxy->page()->pageID()); +} + +void LayerTreeHostProxy::setVisibleContentsRectForScaling(const IntRect& rect, float scale) +{ + m_renderer->setVisibleContentsRectForScaling(rect, scale); + m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::SetVisibleContentsRectForScaling(rect, scale), m_drawingAreaProxy->page()->pageID()); +} + +void LayerTreeHostProxy::renderNextFrame() +{ + m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::RenderNextFrame(), m_drawingAreaProxy->page()->pageID()); +} + +void LayerTreeHostProxy::purgeBackingStores() +{ + m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::PurgeBackingStores(), m_drawingAreaProxy->page()->pageID()); +} + +} +#endif // USE(UI_SIDE_COMPOSITING) |