Title: [88655] trunk/Source/WebKit2
Revision
88655
Author
[email protected]
Date
2011-06-13 11:09:45 -0700 (Mon, 13 Jun 2011)

Log Message

2011-06-13  No'am Rosenthal  <[email protected]>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] Implement accelerated compositing on WK2 Qt port
        https://bugs.webkit.org/show_bug.cgi?id=56935

        Added WebLayerTreeInfo: a set of structures that can serialize a tree of GraphicsLayers
        across to the UI process.

        Together with Viatcheslav Ostapenko.

        * Scripts/webkit2/messages.py:
        * Shared/WebLayerTreeInfo.cpp: Added.
        * Shared/WebLayerTreeInfo.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (88654 => 88655)


--- trunk/Source/WebKit2/ChangeLog	2011-06-13 18:05:09 UTC (rev 88654)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-13 18:09:45 UTC (rev 88655)
@@ -1,3 +1,19 @@
+2011-06-13  No'am Rosenthal  <[email protected]>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Implement accelerated compositing on WK2 Qt port
+        https://bugs.webkit.org/show_bug.cgi?id=56935
+
+        Added WebLayerTreeInfo: a set of structures that can serialize a tree of GraphicsLayers
+        across to the UI process.
+
+        Together with Viatcheslav Ostapenko.
+
+        * Scripts/webkit2/messages.py:
+        * Shared/WebLayerTreeInfo.cpp: Added.
+        * Shared/WebLayerTreeInfo.h: Added.
+
 2011-06-11  Jer Noble  <[email protected]>
 
         Reviewed by Anders Carlsson.

Added: trunk/Source/WebKit2/Shared/WebLayerTreeInfo.cpp (0 => 88655)


--- trunk/Source/WebKit2/Shared/WebLayerTreeInfo.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/WebLayerTreeInfo.cpp	2011-06-13 18:09:45 UTC (rev 88655)
@@ -0,0 +1,89 @@
+/*
+ Copyright (C) 2010 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(ACCELERATED_COMPOSITING)
+
+#include "WebLayerTreeInfo.h"
+
+#include "SharedMemory.h"
+#include "WebCoreArgumentCoders.h"
+
+using namespace CoreIPC;
+
+namespace WebKit {
+
+void WebLayerInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+    // We have to divide it to several lines, because CoreIPC::In/Out takes a maximum of 10 arguments.
+    encoder->encode(CoreIPC::In(id, name, parent, children, flags, replica, mask));
+    encoder->encode(CoreIPC::In(pos, size, transform, opacity, anchorPoint, childrenTransform, contentsRect));
+    encoder->encode(imageBackingStore ? imageBackingStore->size() : IntSize());
+
+    if (!imageBackingStore)
+        return;
+
+    ShareableBitmap::Handle imageHandle;
+    if (imageBackingStore->createHandle(imageHandle))
+        imageHandle.encode(encoder);
+}
+
+bool WebLayerInfo::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerInfo& info)
+{
+    // We have to divide it to several lines, because CoreIPC::In/Out takes a maximum of 10 arguments.
+    if (!decoder->decode(CoreIPC::Out(info.id, info.name, info.parent, info.children, info.flags, info.replica, info.mask)))
+        return false;
+    if (!decoder->decode(CoreIPC::Out(info.pos, info.size, info.transform, info.opacity, info.anchorPoint, info.childrenTransform, info.contentsRect)))
+        return false;
+
+    IntSize imageBackingStoreSize;
+    if (!decoder->decode(imageBackingStoreSize))
+        return false;
+    if (imageBackingStoreSize.isEmpty())
+        return true;
+
+    ShareableBitmap::Handle imageHandle;
+    if (ShareableBitmap::Handle::decode(decoder, imageHandle))
+        info.imageBackingStore = ShareableBitmap::create(imageHandle);
+    return true;
+}
+
+void WebLayerTreeInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+    encoder->encode(CoreIPC::In(layers, rootLayerID, deletedLayerIDs, contentScale));
+}
+
+bool WebLayerTreeInfo::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerTreeInfo& info)
+{
+    return decoder->decode(CoreIPC::Out(info.layers, info.rootLayerID, info.deletedLayerIDs, info.contentScale));
+}
+
+void WebLayerUpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+    encoder->encode(CoreIPC::In(layerID, rect, bitmapHandle));
+}
+
+bool WebLayerUpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerUpdateInfo& info)
+{
+    return decoder->decode(CoreIPC::Out(info.layerID, info.rect, info.bitmapHandle));
+}
+
+}
+#endif

Added: trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h (0 => 88655)


--- trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h	2011-06-13 18:09:45 UTC (rev 88655)
@@ -0,0 +1,98 @@
+/*
+ Copyright (C) 2010 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.
+ */
+
+#ifndef WebLayerTreeInfo_h
+#define WebLayerTreeInfo_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+#include "FloatRect.h"
+#include "FloatSize.h"
+#include "GraphicsLayer.h"
+#include "ShareableBitmap.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+typedef uint32_t WebLayerID;
+
+struct WebLayerUpdateInfo {
+    WebLayerUpdateInfo() { }
+    WebLayerUpdateInfo(const IntRect& r)
+        : rect(r) { }
+
+    WebLayerID layerID;
+    IntRect rect;
+    ShareableBitmap::Handle bitmapHandle;
+
+    void encode(CoreIPC::ArgumentEncoder*) const;
+    static bool decode(CoreIPC::ArgumentDecoder*, WebLayerUpdateInfo&);
+};
+
+struct WebLayerInfo {
+    String name;
+    WebLayerID id;
+    WebLayerID parent;
+    WebLayerID replica;
+    WebLayerID mask;
+
+    FloatPoint pos;
+    FloatPoint3D anchorPoint;
+    FloatSize size;
+    TransformationMatrix transform;
+    TransformationMatrix childrenTransform;
+    IntRect contentsRect;
+    float opacity;
+
+    union {
+        struct {
+            bool contentsOpaque : 1;
+            bool drawsContent : 1;
+            bool backfaceVisible : 1;
+            bool masksToBounds : 1;
+            bool preserves3D : 1;
+            bool contentNeedsDisplay : 1;
+        };
+        unsigned int flags;
+    };
+    Vector<WebLayerID> children;
+    RefPtr<ShareableBitmap> imageBackingStore;
+
+    void encode(CoreIPC::ArgumentEncoder*) const;
+    static bool decode(CoreIPC::ArgumentDecoder*, WebLayerInfo&);
+};
+
+struct WebLayerTreeInfo {
+    Vector<WebLayerInfo> layers;
+    Vector<WebLayerID> deletedLayerIDs;
+    WebLayerID rootLayerID;
+    float contentScale;
+
+    void encode(CoreIPC::ArgumentEncoder*) const;
+    static bool decode(CoreIPC::ArgumentDecoder*, WebLayerTreeInfo&);
+};
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // WebLayerTreeInfo_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to