Title: [120644] trunk/Source
Revision
120644
Author
[email protected]
Date
2012-06-18 16:54:22 -0700 (Mon, 18 Jun 2012)

Log Message

[chromium] Use WebImageLayer in GraphicsLayerChromium for image layers
https://bugs.webkit.org/show_bug.cgi?id=89150

Reviewed by Adrienne Walker.

Source/Platform:

Adds a WebImageLayer type to represent layers backed by (guess what) Images.

* Platform.gypi:
* chromium/public/WebImageLayer.h: Added.
(WebCore):
(WebKit):
(WebImageLayer):
(WebKit::WebImageLayer::WebImageLayer):
(WebKit::WebImageLayer::~WebImageLayer):

Source/WebCore:

Uses WebImageLayer instead of ImageLayerChromium for GraphicsLayerChromium::setContentsToImage.

* platform/graphics/chromium/GraphicsLayerChromium.cpp:
(WebCore::GraphicsLayerChromium::setContentsToImage):

Source/WebKit/chromium:

Implementation of WebImageLayer. Note: This could (should?) live in WebCore/platform/chromium/support/, but it's
here to be next to the other Web*Layer.cpp implementation files.

* WebKit.gyp:
* src/WebImageLayer.cpp: Added.
(WebKit):
(WebKit::WebImageLayer::create):
(WebKit::WebImageLayer::WebImageLayer):
(WebKit::WebImageLayer::setBitmap):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (120643 => 120644)


--- trunk/Source/Platform/ChangeLog	2012-06-18 23:41:17 UTC (rev 120643)
+++ trunk/Source/Platform/ChangeLog	2012-06-18 23:54:22 UTC (rev 120644)
@@ -1,5 +1,22 @@
 2012-06-14  James Robinson  <[email protected]>
 
+        [chromium] Use WebImageLayer in GraphicsLayerChromium for image layers
+        https://bugs.webkit.org/show_bug.cgi?id=89150
+
+        Reviewed by Adrienne Walker.
+
+        Adds a WebImageLayer type to represent layers backed by (guess what) Images.
+
+        * Platform.gypi:
+        * chromium/public/WebImageLayer.h: Added.
+        (WebCore):
+        (WebKit):
+        (WebImageLayer):
+        (WebKit::WebImageLayer::WebImageLayer):
+        (WebKit::WebImageLayer::~WebImageLayer):
+
+2012-06-14  James Robinson  <[email protected]>
+
         [chromium] GraphicsLayerChromium should use WebContentLayer directly
         https://bugs.webkit.org/show_bug.cgi?id=89145
 

Modified: trunk/Source/Platform/Platform.gypi (120643 => 120644)


--- trunk/Source/Platform/Platform.gypi	2012-06-18 23:41:17 UTC (rev 120643)
+++ trunk/Source/Platform/Platform.gypi	2012-06-18 23:54:22 UTC (rev 120644)
@@ -66,6 +66,7 @@
             'chromium/public/WebICECandidateDescriptor.h',
             'chromium/public/WebICEOptions.h',
             'chromium/public/WebImage.h',
+            'chromium/public/WebImageLayer.h',
             'chromium/public/WebIOSurfaceLayer.h',
             'chromium/public/WebLayer.h',
             'chromium/public/WebLayerTreeView.h',
@@ -115,6 +116,7 @@
             'chromium/public/WebURLRequest.h',
             'chromium/public/WebURLResponse.h',
             'chromium/public/WebVector.h',
+            'chromium/public/WebVideoLayer.h',
             'chromium/public/WebVideoFrame.h',
             'chromium/public/WebVideoFrameProvider.h',
             'chromium/public/WebWorkerRunLoop.h',

Added: trunk/Source/Platform/chromium/public/WebImageLayer.h (0 => 120644)


--- trunk/Source/Platform/chromium/public/WebImageLayer.h	                        (rev 0)
+++ trunk/Source/Platform/chromium/public/WebImageLayer.h	2012-06-18 23:54:22 UTC (rev 120644)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012 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 WebImageLayer_h
+#define WebImageLayer_h
+
+#include "SkBitmap.h"
+#include "WebCommon.h"
+#include "WebLayer.h"
+
+namespace WebCore {
+class ImageLayerChromium;
+}
+
+namespace WebKit {
+
+class WebImageLayer : public WebLayer {
+public:
+    WEBKIT_EXPORT static WebImageLayer create();
+
+    WebImageLayer() { }
+    virtual ~WebImageLayer() { }
+
+    WEBKIT_EXPORT void setBitmap(SkBitmap);
+
+#if WEBKIT_IMPLEMENTATION
+    explicit WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium>);
+#endif
+};
+
+} // namespace WebKit
+
+#endif // WebImageLayer_h
Property changes on: trunk/Source/Platform/chromium/public/WebImageLayer.h
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (120643 => 120644)


--- trunk/Source/WebCore/ChangeLog	2012-06-18 23:41:17 UTC (rev 120643)
+++ trunk/Source/WebCore/ChangeLog	2012-06-18 23:54:22 UTC (rev 120644)
@@ -1,5 +1,17 @@
 2012-06-14  James Robinson  <[email protected]>
 
+        [chromium] Use WebImageLayer in GraphicsLayerChromium for image layers
+        https://bugs.webkit.org/show_bug.cgi?id=89150
+
+        Reviewed by Adrienne Walker.
+
+        Uses WebImageLayer instead of ImageLayerChromium for GraphicsLayerChromium::setContentsToImage.
+
+        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+        (WebCore::GraphicsLayerChromium::setContentsToImage):
+
+2012-06-14  James Robinson  <[email protected]>
+
         [chromium] GraphicsLayerChromium should use WebContentLayer directly
         https://bugs.webkit.org/show_bug.cgi?id=89145
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp (120643 => 120644)


--- trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp	2012-06-18 23:41:17 UTC (rev 120643)
+++ trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp	2012-06-18 23:54:22 UTC (rev 120644)
@@ -52,7 +52,6 @@
 #include "FloatRect.h"
 #include "GraphicsContext.h"
 #include "Image.h"
-#include "ImageLayerChromium.h"
 #include "LayerChromium.h"
 #include "LinkHighlight.h"
 #include "NativeImageSkia.h"
@@ -67,6 +66,7 @@
 #include <public/WebFilterOperations.h>
 #include <public/WebFloatPoint.h>
 #include <public/WebFloatRect.h>
+#include <public/WebImageLayer.h>
 #include <public/WebSize.h>
 #include <public/WebTransformationMatrix.h>
 #include <wtf/CurrentTime.h>
@@ -460,15 +460,15 @@
     bool childrenChanged = false;
     if (image) {
         if (m_contentsLayer.isNull() || m_contentsLayerPurpose != ContentsLayerForImage) {
-            RefPtr<ImageLayerChromium> imageLayer = ImageLayerChromium::create();
-            setupContentsLayer(imageLayer.get());
+            WebKit::WebImageLayer imageLayer = WebKit::WebImageLayer::create();
+            setupContentsLayer(imageLayer.unwrap<LayerChromium>());
             m_contentsLayerPurpose = ContentsLayerForImage;
             childrenChanged = true;
         }
-        ImageLayerChromium* imageLayer = static_cast<ImageLayerChromium*>(m_contentsLayer.unwrap<LayerChromium>());
+        WebKit::WebImageLayer imageLayer = m_contentsLayer.to<WebKit::WebImageLayer>();
         NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame();
-        imageLayer->setBitmap(nativeImage->bitmap());
-        imageLayer->setOpaque(image->isBitmapImage() && !image->currentFrameHasAlpha());
+        imageLayer.setBitmap(nativeImage->bitmap());
+        imageLayer.setOpaque(image->isBitmapImage() && !image->currentFrameHasAlpha());
         updateContentsRect();
     } else {
         if (!m_contentsLayer.isNull()) {

Modified: trunk/Source/WebKit/chromium/ChangeLog (120643 => 120644)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-18 23:41:17 UTC (rev 120643)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-18 23:54:22 UTC (rev 120644)
@@ -1,5 +1,22 @@
 2012-06-14  James Robinson  <[email protected]>
 
+        [chromium] Use WebImageLayer in GraphicsLayerChromium for image layers
+        https://bugs.webkit.org/show_bug.cgi?id=89150
+
+        Reviewed by Adrienne Walker.
+
+        Implementation of WebImageLayer. Note: This could (should?) live in WebCore/platform/chromium/support/, but it's
+        here to be next to the other Web*Layer.cpp implementation files.
+
+        * WebKit.gyp:
+        * src/WebImageLayer.cpp: Added.
+        (WebKit):
+        (WebKit::WebImageLayer::create):
+        (WebKit::WebImageLayer::WebImageLayer):
+        (WebKit::WebImageLayer::setBitmap):
+
+2012-06-14  James Robinson  <[email protected]>
+
         [chromium] GraphicsLayerChromium should use WebContentLayer directly
         https://bugs.webkit.org/show_bug.cgi?id=89145
 

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (120643 => 120644)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2012-06-18 23:41:17 UTC (rev 120643)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2012-06-18 23:54:22 UTC (rev 120644)
@@ -569,6 +569,7 @@
                 'src/WebIOSurfaceLayer.cpp',
                 'src/WebImageCG.cpp',
                 'src/WebImageDecoder.cpp',
+                'src/WebImageLayer.cpp',
                 'src/WebImageSkia.cpp',
                 'src/WebInputElement.cpp',
                 'src/WebInputEvent.cpp',

Added: trunk/Source/WebKit/chromium/src/WebImageLayer.cpp (0 => 120644)


--- trunk/Source/WebKit/chromium/src/WebImageLayer.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebImageLayer.cpp	2012-06-18 23:54:22 UTC (rev 120644)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 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 <public/WebImageLayer.h>
+
+#include "ImageLayerChromium.h"
+
+namespace WebKit {
+
+WebImageLayer WebImageLayer::create()
+{
+    return WebImageLayer(WebCore::ImageLayerChromium::create());
+}
+
+WebImageLayer::WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium> layer)
+    : WebLayer(layer)
+{
+}
+
+void WebImageLayer::setBitmap(SkBitmap bitmap)
+{
+    return unwrap<WebCore::ImageLayerChromium>()->setBitmap(bitmap);
+}
+
+} // namespace WebKit
Property changes on: trunk/Source/WebKit/chromium/src/WebImageLayer.cpp
___________________________________________________________________

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to