Title: [97550] trunk/Source
Revision
97550
Author
[email protected]
Date
2011-10-15 00:44:39 -0700 (Sat, 15 Oct 2011)

Log Message

Add WebAcceleratedContentLayer backed by a texture to support accelerated content hosting
https://bugs.webkit.org/show_bug.cgi?id=70084

Patch by Antoine Labour <[email protected]> on 2011-10-15
Reviewed by James Robinson.

Source/WebCore:

Covered by existing compositing/ tests

* platform/graphics/chromium/LayerChromium.h:
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::pluginLayerProgramFlip):
(WebCore::LayerRendererChromium::cleanupSharedObjects):
* platform/graphics/chromium/LayerRendererChromium.h:
* platform/graphics/chromium/PluginLayerChromium.cpp:
(WebCore::PluginLayerChromium::PluginLayerChromium):
(WebCore::PluginLayerChromium::setTextureId):
(WebCore::PluginLayerChromium::setFlipped):
(WebCore::PluginLayerChromium::pushPropertiesTo):
* platform/graphics/chromium/PluginLayerChromium.h:
(WebCore::PluginLayerChromium::flipped):
* platform/graphics/chromium/cc/CCPluginLayerImpl.cpp:
(WebCore::CCPluginLayerImpl::CCPluginLayerImpl):
(WebCore::CCPluginLayerImpl::draw):
* platform/graphics/chromium/cc/CCPluginLayerImpl.h:
(WebCore::CCPluginLayerImpl::setFlipped):

Source/WebKit/chromium:

* WebKit.gyp:
* public/WebExternalTextureLayer.h: Added.
(WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
(WebKit::WebExternalTextureLayer::~WebExternalTextureLayer):
(WebKit::WebExternalTextureLayer::operator=):
* src/WebExternalTextureLayer.cpp: Copied from Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h.
(WebKit::WebExternalTextureLayer::create):
(WebKit::WebExternalTextureLayer::setTextureId):
(WebKit::WebExternalTextureLayer::textureId):
(WebKit::WebExternalTextureLayer::setFlipped):
(WebKit::WebExternalTextureLayer::flipped):
(WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
(WebKit::WebExternalTextureLayer::operator=):
(WebKit::WebExternalTextureLayer::operator PassRefPtr<WebExternalTextureLayerImpl>):
* src/WebExternalTextureLayerImpl.cpp: Copied from Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h.
(WebKit::WebExternalTextureLayerImpl::create):
(WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
(WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl):
(WebKit::WebExternalTextureLayerImpl::drawsContent):
(WebKit::WebExternalTextureLayerImpl::paintContents):
(WebKit::WebExternalTextureLayerImpl::notifySyncRequired):
* src/WebExternalTextureLayerImpl.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97549 => 97550)


--- trunk/Source/WebCore/ChangeLog	2011-10-15 07:32:36 UTC (rev 97549)
+++ trunk/Source/WebCore/ChangeLog	2011-10-15 07:44:39 UTC (rev 97550)
@@ -1,3 +1,30 @@
+2011-10-15  Antoine Labour  <[email protected]>
+
+        Add WebAcceleratedContentLayer backed by a texture to support accelerated content hosting
+        https://bugs.webkit.org/show_bug.cgi?id=70084
+
+        Reviewed by James Robinson.
+
+        Covered by existing compositing/ tests
+
+        * platform/graphics/chromium/LayerChromium.h:
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::pluginLayerProgramFlip):
+        (WebCore::LayerRendererChromium::cleanupSharedObjects):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+        * platform/graphics/chromium/PluginLayerChromium.cpp:
+        (WebCore::PluginLayerChromium::PluginLayerChromium):
+        (WebCore::PluginLayerChromium::setTextureId):
+        (WebCore::PluginLayerChromium::setFlipped):
+        (WebCore::PluginLayerChromium::pushPropertiesTo):
+        * platform/graphics/chromium/PluginLayerChromium.h:
+        (WebCore::PluginLayerChromium::flipped):
+        * platform/graphics/chromium/cc/CCPluginLayerImpl.cpp:
+        (WebCore::CCPluginLayerImpl::CCPluginLayerImpl):
+        (WebCore::CCPluginLayerImpl::draw):
+        * platform/graphics/chromium/cc/CCPluginLayerImpl.h:
+        (WebCore::CCPluginLayerImpl::setFlipped):
+
 2011-10-15  Michael Nordman  <[email protected]>
 
         [Chromium] Some WebSQLDatabase in worker bug fixes.

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (97549 => 97550)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2011-10-15 07:32:36 UTC (rev 97549)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h	2011-10-15 07:44:39 UTC (rev 97550)
@@ -208,6 +208,8 @@
     // hold context-dependent resources such as textures.
     virtual void cleanupResources();
 
+    void setNeedsCommit();
+
     FloatRect m_dirtyRect;
 
     RefPtr<LayerChromium> m_maskLayer;
@@ -219,8 +221,6 @@
     int m_layerId;
 
 private:
-    void setNeedsCommit();
-
     void setParent(LayerChromium*);
     bool hasAncestor(LayerChromium*) const;
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (97549 => 97550)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-10-15 07:32:36 UTC (rev 97549)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-10-15 07:44:39 UTC (rev 97550)
@@ -752,6 +752,17 @@
     return m_pluginLayerProgram.get();
 }
 
+const CCPluginLayerImpl::ProgramFlip* LayerRendererChromium::pluginLayerProgramFlip()
+{
+    if (!m_pluginLayerProgramFlip)
+        m_pluginLayerProgramFlip = adoptPtr(new CCPluginLayerImpl::ProgramFlip(m_context.get()));
+    if (!m_pluginLayerProgramFlip->initialized()) {
+        TRACE_EVENT("LayerRendererChromium::pluginLayerProgramFlip::initialize", this, 0);
+        m_pluginLayerProgramFlip->initialize(m_context.get());
+    }
+    return m_pluginLayerProgramFlip.get();
+}
+
 const CCVideoLayerImpl::RGBAProgram* LayerRendererChromium::videoLayerRGBAProgram()
 {
     if (!m_videoLayerRGBAProgram)
@@ -797,6 +808,8 @@
         m_canvasLayerProgram->cleanup(m_context.get());
     if (m_pluginLayerProgram)
         m_pluginLayerProgram->cleanup(m_context.get());
+    if (m_pluginLayerProgramFlip)
+        m_pluginLayerProgramFlip->cleanup(m_context.get());
     if (m_renderSurfaceMaskProgram)
         m_renderSurfaceMaskProgram->cleanup(m_context.get());
     if (m_renderSurfaceMaskProgramAA)
@@ -818,6 +831,7 @@
     m_tilerProgramSwizzleAA.clear();
     m_canvasLayerProgram.clear();
     m_pluginLayerProgram.clear();
+    m_pluginLayerProgramFlip.clear();
     m_renderSurfaceMaskProgram.clear();
     m_renderSurfaceMaskProgramAA.clear();
     m_renderSurfaceProgram.clear();

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h (97549 => 97550)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2011-10-15 07:32:36 UTC (rev 97549)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2011-10-15 07:44:39 UTC (rev 97550)
@@ -126,6 +126,7 @@
     const CCTiledLayerImpl::ProgramSwizzleAA* tilerProgramSwizzleAA();
     const CCCanvasLayerImpl::Program* canvasLayerProgram();
     const CCPluginLayerImpl::Program* pluginLayerProgram();
+    const CCPluginLayerImpl::ProgramFlip* pluginLayerProgramFlip();
     const CCVideoLayerImpl::RGBAProgram* videoLayerRGBAProgram();
     const CCVideoLayerImpl::YUVProgram* videoLayerYUVProgram();
 
@@ -205,6 +206,7 @@
     OwnPtr<CCTiledLayerImpl::ProgramSwizzleAA> m_tilerProgramSwizzleAA;
     OwnPtr<CCCanvasLayerImpl::Program> m_canvasLayerProgram;
     OwnPtr<CCPluginLayerImpl::Program> m_pluginLayerProgram;
+    OwnPtr<CCPluginLayerImpl::ProgramFlip> m_pluginLayerProgramFlip;
     OwnPtr<CCRenderSurface::MaskProgram> m_renderSurfaceMaskProgram;
     OwnPtr<CCRenderSurface::Program> m_renderSurfaceProgram;
     OwnPtr<CCRenderSurface::MaskProgramAA> m_renderSurfaceMaskProgramAA;

Modified: trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp (97549 => 97550)


--- trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp	2011-10-15 07:32:36 UTC (rev 97549)
+++ trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp	2011-10-15 07:44:39 UTC (rev 97550)
@@ -44,6 +44,7 @@
 PluginLayerChromium::PluginLayerChromium(CCLayerDelegate* delegate)
     : LayerChromium(delegate)
     , m_textureId(0)
+    , m_flipped(true)
 {
 }
 
@@ -55,14 +56,22 @@
 void PluginLayerChromium::setTextureId(unsigned id)
 {
     m_textureId = id;
+    setNeedsCommit();
 }
 
+void PluginLayerChromium::setFlipped(bool flipped)
+{
+    m_flipped = flipped;
+    setNeedsCommit();
+}
+
 void PluginLayerChromium::pushPropertiesTo(CCLayerImpl* layer)
 {
     LayerChromium::pushPropertiesTo(layer);
 
     CCPluginLayerImpl* pluginLayer = static_cast<CCPluginLayerImpl*>(layer);
     pluginLayer->setTextureId(m_textureId);
+    pluginLayer->setFlipped(m_flipped);
 }
 
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h (97549 => 97550)


--- trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h	2011-10-15 07:32:36 UTC (rev 97549)
+++ trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h	2011-10-15 07:44:39 UTC (rev 97550)
@@ -43,12 +43,17 @@
 
     void setTextureId(unsigned textureId);
     unsigned textureId() const { return m_textureId; }
+    void setFlipped(bool);
+    bool flipped() const { return m_flipped; }
 
     virtual void pushPropertiesTo(CCLayerImpl*);
 
+protected:
+    explicit PluginLayerChromium(CCLayerDelegate*);
+
 private:
-    explicit PluginLayerChromium(CCLayerDelegate*);
     unsigned m_textureId;
+    bool m_flipped;
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp (97549 => 97550)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp	2011-10-15 07:32:36 UTC (rev 97549)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp	2011-10-15 07:44:39 UTC (rev 97550)
@@ -34,11 +34,31 @@
 #include "cc/CCProxy.h"
 #include <wtf/text/WTFString.h>
 
+namespace {
+
+struct PluginProgramBinding {
+    template<class Program> void set(Program* program)
+    {
+        ASSERT(program && program->initialized());
+        programId = program->program();
+        samplerLocation = program->fragmentShader().samplerLocation();
+        matrixLocation = program->vertexShader().matrixLocation();
+        alphaLocation = program->fragmentShader().alphaLocation();
+    }
+    int programId;
+    int samplerLocation;
+    int matrixLocation;
+    int alphaLocation;
+};
+
+} // anonymous namespace
+
 namespace WebCore {
 
 CCPluginLayerImpl::CCPluginLayerImpl(int id)
     : CCLayerImpl(id)
     , m_textureId(0)
+    , m_flipped(true)
 {
 }
 
@@ -49,8 +69,12 @@
 void CCPluginLayerImpl::draw(LayerRendererChromium* layerRenderer)
 {
     ASSERT(CCProxy::isImplThread());
-    const CCPluginLayerImpl::Program* program = layerRenderer->pluginLayerProgram();
-    ASSERT(program && program->initialized());
+    PluginProgramBinding binding;
+    if (m_flipped)
+        binding.set(layerRenderer->pluginLayerProgramFlip());
+    else
+        binding.set(layerRenderer->pluginLayerProgram());
+
     GraphicsContext3D* context = layerRenderer->context();
     GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0));
     GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId));
@@ -62,11 +86,11 @@
     GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
     GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
 
-    GLC(context, context->useProgram(program->program()));
-    GLC(context, context->uniform1i(program->fragmentShader().samplerLocation(), 0));
+    GLC(context, context->useProgram(binding.programId));
+    GLC(context, context->uniform1i(binding.samplerLocation, 0));
     layerRenderer->drawTexturedQuad(drawTransform(), bounds().width(), bounds().height(), drawOpacity(), layerRenderer->sharedGeometryQuad(),
-                                    program->vertexShader().matrixLocation(),
-                                    program->fragmentShader().alphaLocation(),
+                                    binding.matrixLocation,
+                                    binding.alphaLocation,
                                     -1);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h (97549 => 97550)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h	2011-10-15 07:32:36 UTC (rev 97549)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h	2011-10-15 07:44:39 UTC (rev 97550)
@@ -40,13 +40,15 @@
     }
     virtual ~CCPluginLayerImpl();
 
-    typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexFlipAlpha> Program;
+    typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexAlpha> Program;
+    typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexFlipAlpha> ProgramFlip;
 
     virtual void draw(LayerRendererChromium*);
 
     virtual void dumpLayerProperties(TextStream&, int indent) const;
 
     void setTextureId(unsigned id) { m_textureId = id; }
+    void setFlipped(bool flipped) { m_flipped = flipped; }
 
 private:
     explicit CCPluginLayerImpl(int);
@@ -54,6 +56,7 @@
     virtual const char* layerTypeAsString() const { return "PluginLayer"; }
 
     unsigned m_textureId;
+    bool m_flipped;
 };
 
 }

Modified: trunk/Source/WebKit/chromium/ChangeLog (97549 => 97550)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-10-15 07:32:36 UTC (rev 97549)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-10-15 07:44:39 UTC (rev 97550)
@@ -1,3 +1,33 @@
+2011-10-15  Antoine Labour  <[email protected]>
+
+        Add WebAcceleratedContentLayer backed by a texture to support accelerated content hosting
+        https://bugs.webkit.org/show_bug.cgi?id=70084
+
+        Reviewed by James Robinson.
+
+        * WebKit.gyp:
+        * public/WebExternalTextureLayer.h: Added.
+        (WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
+        (WebKit::WebExternalTextureLayer::~WebExternalTextureLayer):
+        (WebKit::WebExternalTextureLayer::operator=):
+        * src/WebExternalTextureLayer.cpp: Copied from Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h.
+        (WebKit::WebExternalTextureLayer::create):
+        (WebKit::WebExternalTextureLayer::setTextureId):
+        (WebKit::WebExternalTextureLayer::textureId):
+        (WebKit::WebExternalTextureLayer::setFlipped):
+        (WebKit::WebExternalTextureLayer::flipped):
+        (WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
+        (WebKit::WebExternalTextureLayer::operator=):
+        (WebKit::WebExternalTextureLayer::operator PassRefPtr<WebExternalTextureLayerImpl>):
+        * src/WebExternalTextureLayerImpl.cpp: Copied from Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h.
+        (WebKit::WebExternalTextureLayerImpl::create):
+        (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
+        (WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl):
+        (WebKit::WebExternalTextureLayerImpl::drawsContent):
+        (WebKit::WebExternalTextureLayerImpl::paintContents):
+        (WebKit::WebExternalTextureLayerImpl::notifySyncRequired):
+        * src/WebExternalTextureLayerImpl.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h.
+
 2011-10-15  Michael Nordman  <[email protected]>
 
         [Chromium] Some WebSQLDatabase in worker bug fixes.

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (97549 => 97550)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2011-10-15 07:32:36 UTC (rev 97549)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2011-10-15 07:44:39 UTC (rev 97550)
@@ -163,6 +163,7 @@
                 'public/WebExceptionCode.h',
                 'public/WebExternalPopupMenu.h',
                 'public/WebExternalPopupMenuClient.h',
+                'public/WebExternalTextureLayer.h',
                 'public/WebFileChooserCompletion.h',
                 'public/WebFileChooserParams.h',
                 'public/WebFileError.h',
@@ -483,6 +484,9 @@
                 'src/WebElement.cpp',
                 'src/WebEntities.cpp',
                 'src/WebEntities.h',
+                'src/WebExternalTextureLayer.cpp',
+                'src/WebExternalTextureLayerImpl.cpp',
+                'src/WebExternalTextureLayerImpl.h',
                 'src/WebFileChooserCompletionImpl.cpp',
                 'src/WebFileChooserCompletionImpl.h',
                 'src/WebFileSystemCallbacksImpl.cpp',

Added: trunk/Source/WebKit/chromium/public/WebExternalTextureLayer.h (0 => 97550)


--- trunk/Source/WebKit/chromium/public/WebExternalTextureLayer.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebExternalTextureLayer.h	2011-10-15 07:44:39 UTC (rev 97550)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebExternalTextureLayer_h
+#define WebExternalTextureLayer_h
+
+#include "WebCommon.h"
+#include "WebLayer.h"
+
+namespace WebKit {
+class WebExternalTextureLayerImpl;
+class WebLayerClient;
+
+// This class represents a layer that renders a texture that is generated
+// externally (not managed by the WebLayerTreeView).
+// The texture will be used by the WebLayerTreeView during compositing passes.
+// When in single-thread mode, this means during WebLayerTreeView::composite().
+// When using the threaded compositor, this can mean at an arbitrary time until
+// the WebLayerTreeView is destroyed.
+class WebExternalTextureLayer : public WebLayer {
+public:
+    static WebExternalTextureLayer create(WebLayerClient*);
+
+    WebExternalTextureLayer() { }
+    WebExternalTextureLayer(const WebExternalTextureLayer& layer) : WebLayer(layer) { }
+    virtual ~WebExternalTextureLayer() { }
+    WebExternalTextureLayer& operator=(const WebExternalTextureLayer& layer)
+    {
+        WebLayer::assign(layer);
+        return *this;
+    }
+
+    // Sets the texture id that represents the layer, in the namespace of the
+    // compositor context.
+    WEBKIT_EXPORT void setTextureId(unsigned);
+    WEBKIT_EXPORT unsigned textureId() const;
+
+    // Sets whether or not the texture should be flipped in the Y direction when
+    // rendered.
+    WEBKIT_EXPORT void setFlipped(bool);
+    WEBKIT_EXPORT bool flipped() const;
+
+#if WEBKIT_IMPLEMENTATION
+    WebExternalTextureLayer(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&);
+    WebExternalTextureLayer& operator=(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&);
+    operator WTF::PassRefPtr<WebExternalTextureLayerImpl>() const;
+#endif
+};
+
+} // namespace WebKit
+
+#endif // WebExternalTextureLayer_h

Copied: trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp (from rev 97549, trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h) (0 => 97550)


--- trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp	2011-10-15 07:44:39 UTC (rev 97550)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebExternalTextureLayer.h"
+
+#include "WebExternalTextureLayerImpl.h"
+#include "WebFloatRect.h"
+
+namespace WebKit {
+
+WebExternalTextureLayer WebExternalTextureLayer::create(WebLayerClient* client)
+{
+    return WebExternalTextureLayer(WebExternalTextureLayerImpl::create(client));
+}
+
+void WebExternalTextureLayer::setTextureId(unsigned id)
+{
+    unwrap<WebExternalTextureLayerImpl>()->setTextureId(id);
+}
+
+unsigned WebExternalTextureLayer::textureId() const
+{
+    return constUnwrap<WebExternalTextureLayerImpl>()->textureId();
+}
+
+void WebExternalTextureLayer::setFlipped(bool flipped)
+{
+    unwrap<WebExternalTextureLayerImpl>()->setFlipped(flipped);
+}
+
+bool WebExternalTextureLayer::flipped() const
+{
+    return constUnwrap<WebExternalTextureLayerImpl>()->flipped();
+}
+
+WebExternalTextureLayer::WebExternalTextureLayer(const PassRefPtr<WebExternalTextureLayerImpl>& node)
+    : WebLayer(node)
+{
+}
+
+WebExternalTextureLayer& WebExternalTextureLayer::operator=(const PassRefPtr<WebExternalTextureLayerImpl>& node)
+{
+    m_private = node;
+    return *this;
+}
+
+WebExternalTextureLayer::operator PassRefPtr<WebExternalTextureLayerImpl>() const
+{
+    return static_cast<WebExternalTextureLayerImpl*>(m_private.get());
+}
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp (from rev 97549, trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h) (0 => 97550)


--- trunk/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp	2011-10-15 07:44:39 UTC (rev 97550)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebExternalTextureLayerImpl.h"
+
+#include "GraphicsContext.h"
+#include "WebCanvas.h"
+#include "WebLayerClient.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<WebExternalTextureLayerImpl> WebExternalTextureLayerImpl::create(WebLayerClient* client)
+{
+    return adoptRef(new WebExternalTextureLayerImpl(client));
+}
+
+WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(WebLayerClient* client)
+    : PluginLayerChromium(this)
+    , m_client(client)
+{
+    setFlipped(false);
+}
+
+WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl()
+{
+}
+
+bool WebExternalTextureLayerImpl::drawsContent() const
+{
+    return !!textureId();
+}
+
+void WebExternalTextureLayerImpl::paintContents(GraphicsContext&, const IntRect&)
+{
+}
+
+void WebExternalTextureLayerImpl::notifySyncRequired()
+{
+    if (m_client)
+        m_client->notifyNeedsComposite();
+}
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h (from rev 97549, trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h) (0 => 97550)


--- trunk/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h	2011-10-15 07:44:39 UTC (rev 97550)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebExternalTextureLayerImpl_h
+#define WebExternalTextureLayerImpl_h
+
+#include "PluginLayerChromium.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+class WebLayerClient;
+
+class WebExternalTextureLayerImpl : public WebCore::PluginLayerChromium, public WebCore::CCLayerDelegate {
+public:
+    static PassRefPtr<WebExternalTextureLayerImpl> create(WebLayerClient*);
+
+protected:
+    WebExternalTextureLayerImpl(WebLayerClient*);
+    virtual ~WebExternalTextureLayerImpl();
+    virtual void paintContents(WebCore::GraphicsContext&, const WebCore::IntRect& clip);
+    virtual void notifySyncRequired();
+    virtual bool drawsContent() const;
+
+    WebLayerClient* m_client;
+};
+
+} // namespace WebKit
+
+#endif // WebExternalTextureLayerImpl_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to