[BlackBerry] Plumb through GraphicsLayer::contentsOpaque() to LayerTiler
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2012 16:03:29 +0000 (16:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2012 16:03:29 +0000 (16:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82457

Patch by Arvid Nilsson <anilsson@rim.com> on 2012-03-28
Reviewed by Rob Buis.

The LayerTiler already knows not to turn on GL_BLEND for opaque layers.
However, it only ever sets the opaque flag for image layers and color
layers, never for content layers.

This was no big deal, because contentsOpaque() is currently false for
all layers except the root layer, which we always drew using the
BlackBerry::WebKit::BackingStore anyway.

When we start using RenderLayerBacking::m_usingTiledCacheLayer=true on
the root layer in situations where the BackingStore is unavailable, we
can speed up rendering of the root layer by honouring the opaque flag.

Fixed by plumbing through the GraphicsLayer::contentsOpaque() flag all
the way to LayerTiler and on to Texture.

* platform/graphics/blackberry/LayerData.h:
(WebCore::LayerData::LayerData):
(WebCore::LayerData::isOpaque):
(LayerData):
* platform/graphics/blackberry/LayerTile.cpp:
(WebCore::LayerTile::updateContents):
* platform/graphics/blackberry/LayerTile.h:
(LayerTile):
* platform/graphics/blackberry/LayerTiler.cpp:
(WebCore::LayerTiler::updateTextureContentsIfNeeded):
(WebCore::LayerTiler::performTileJob):
* platform/graphics/blackberry/LayerTiler.h:
(WebCore::LayerTiler::TextureJob::TextureJob):
(WebCore::LayerTiler::TextureJob::updateContents):
* platform/graphics/blackberry/LayerWebKitThread.h:
(WebCore::LayerWebKitThread::setOpaque):
* platform/graphics/blackberry/Texture.h:
(Texture):
* platform/graphics/blackberry/TextureCacheCompositingThread.cpp:
(WebCore::TextureCacheCompositingThread::updateContents):
* platform/graphics/blackberry/TextureCacheCompositingThread.h:
(TextureCacheCompositingThread):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112407 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/blackberry/LayerData.h
Source/WebCore/platform/graphics/blackberry/LayerTile.cpp
Source/WebCore/platform/graphics/blackberry/LayerTile.h
Source/WebCore/platform/graphics/blackberry/LayerTiler.cpp
Source/WebCore/platform/graphics/blackberry/LayerTiler.h
Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.h
Source/WebCore/platform/graphics/blackberry/Texture.h
Source/WebCore/platform/graphics/blackberry/TextureCacheCompositingThread.cpp
Source/WebCore/platform/graphics/blackberry/TextureCacheCompositingThread.h

index 6674461..d69ff10 100644 (file)
@@ -1,3 +1,48 @@
+2012-03-28  Arvid Nilsson  <anilsson@rim.com>
+
+        [BlackBerry] Plumb through GraphicsLayer::contentsOpaque() to LayerTiler
+        https://bugs.webkit.org/show_bug.cgi?id=82457
+
+        Reviewed by Rob Buis.
+
+        The LayerTiler already knows not to turn on GL_BLEND for opaque layers.
+        However, it only ever sets the opaque flag for image layers and color
+        layers, never for content layers.
+
+        This was no big deal, because contentsOpaque() is currently false for
+        all layers except the root layer, which we always drew using the
+        BlackBerry::WebKit::BackingStore anyway.
+
+        When we start using RenderLayerBacking::m_usingTiledCacheLayer=true on
+        the root layer in situations where the BackingStore is unavailable, we
+        can speed up rendering of the root layer by honouring the opaque flag.
+
+        Fixed by plumbing through the GraphicsLayer::contentsOpaque() flag all
+        the way to LayerTiler and on to Texture.
+
+        * platform/graphics/blackberry/LayerData.h:
+        (WebCore::LayerData::LayerData):
+        (WebCore::LayerData::isOpaque):
+        (LayerData):
+        * platform/graphics/blackberry/LayerTile.cpp:
+        (WebCore::LayerTile::updateContents):
+        * platform/graphics/blackberry/LayerTile.h:
+        (LayerTile):
+        * platform/graphics/blackberry/LayerTiler.cpp:
+        (WebCore::LayerTiler::updateTextureContentsIfNeeded):
+        (WebCore::LayerTiler::performTileJob):
+        * platform/graphics/blackberry/LayerTiler.h:
+        (WebCore::LayerTiler::TextureJob::TextureJob):
+        (WebCore::LayerTiler::TextureJob::updateContents):
+        * platform/graphics/blackberry/LayerWebKitThread.h:
+        (WebCore::LayerWebKitThread::setOpaque):
+        * platform/graphics/blackberry/Texture.h:
+        (Texture):
+        * platform/graphics/blackberry/TextureCacheCompositingThread.cpp:
+        (WebCore::TextureCacheCompositingThread::updateContents):
+        * platform/graphics/blackberry/TextureCacheCompositingThread.h:
+        (TextureCacheCompositingThread):
+
 2012-03-28  Andrey Kosyakov  <caseq@chromium.org>
 
         Web Inspector: nuke HeapGraph.setSize(), do it automagically on update
index 8575786..2a55bcf 100644 (file)
@@ -78,7 +78,7 @@ public:
         , m_suspendTime(0)
         , m_doubleSided(true)
         , m_masksToBounds(false)
-        , m_opaque(true)
+        , m_isOpaque(false)
         , m_preserves3D(false)
         , m_needsDisplayOnBoundsChange(false)
         , m_needsTexture(false)
@@ -113,7 +113,7 @@ public:
 
     float opacity() const { return m_opacity; }
 
-    bool opaque() const { return m_opaque; }
+    bool isOpaque() const { return m_isOpaque; }
 
     FloatPoint position() const { return m_position; }
 
@@ -197,7 +197,7 @@ protected:
 
     unsigned m_doubleSided : 1;
     unsigned m_masksToBounds : 1;
-    unsigned m_opaque : 1;
+    unsigned m_isOpaque : 1;
     unsigned m_preserves3D : 1;
     unsigned m_needsDisplayOnBoundsChange : 1;
 
index f21ea94..dec19d4 100644 (file)
@@ -47,9 +47,9 @@ void LayerTile::setContentsToColor(const Color& color)
     setTexture(textureCacheCompositingThread()->textureForColor(color));
 }
 
-void LayerTile::updateContents(const SkBitmap& contents, const IntRect& dirtyRect, const IntRect& tileRect)
+void LayerTile::updateContents(const SkBitmap& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque)
 {
-    setTexture(textureCacheCompositingThread()->updateContents(m_texture, contents, dirtyRect, tileRect));
+    setTexture(textureCacheCompositingThread()->updateContents(m_texture, contents, dirtyRect, tileRect, isOpaque));
 }
 
 void LayerTile::discardContents()
index 0eddcda..af4403d 100644 (file)
@@ -63,7 +63,7 @@ public:
 
     void setContents(const SkBitmap& contents, const IntRect& tileRect, const TileIndex&, bool isOpaque);
     void setContentsToColor(const Color&);
-    void updateContents(const SkBitmap& contents, const IntRect& dirtyRect, const IntRect& tileRect);
+    void updateContents(const SkBitmap& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque);
     void discardContents();
 
     // The current texture is an accurate preview of this layer, but a more
index 33800e1..1b5a731 100644 (file)
@@ -202,7 +202,7 @@ void LayerTiler::updateTextureContentsIfNeeded(double scale)
                     if (isSolidColor)
                         addTextureJob(TextureJob::setContentsToColor(color, *it));
                     else
-                        addTextureJob(TextureJob::updateContents(bitmap, tileRect));
+                        addTextureJob(TextureJob::updateContents(bitmap, tileRect, m_layer->isOpaque()));
                 }
 
                 finishedJobs.add(*it);
@@ -297,7 +297,7 @@ void LayerTiler::updateTextureContentsIfNeeded(double scale)
                 if (isSolidColor)
                     addTextureJob(TextureJob::setContentsToColor(color, index));
                 else
-                    addTextureJob(TextureJob::updateContents(bitmap, tileRect));
+                    addTextureJob(TextureJob::updateContents(bitmap, tileRect, m_layer->isOpaque()));
             }
         }
     }
@@ -452,7 +452,7 @@ void LayerTiler::performTileJob(LayerTile* tile, const TextureJob& job, const In
         tile->setContents(job.m_contents, tileRect, indexOfTile(tileRect.location()), job.m_isOpaque);
         return;
     case TextureJob::UpdateContents:
-        tile->updateContents(job.m_contents, job.m_dirtyRect, tileRect);
+        tile->updateContents(job.m_contents, job.m_dirtyRect, tileRect, job.m_isOpaque);
         return;
     case TextureJob::DiscardContents:
         tile->discardContents();
index eda9e61..3766629 100644 (file)
@@ -100,7 +100,7 @@ private:
             ASSERT(type == DiscardContents || type == DirtyContents);
         }
 
-        TextureJob(Type type, const SkBitmap& contents, const IntRect& dirtyRect, bool isOpaque = false)
+        TextureJob(Type type, const SkBitmap& contents, const IntRect& dirtyRect, bool isOpaque)
             : m_type(type)
             , m_contents(contents)
             , m_isOpaque(isOpaque)
@@ -121,7 +121,7 @@ private:
 
         static TextureJob setContents(const SkBitmap& contents, bool isOpaque) { return TextureJob(SetContents, contents, IntRect(IntPoint::zero(), IntSize(contents.width(), contents.height())), isOpaque); }
         static TextureJob setContentsToColor(const Color& color, const TileIndex& index) { return TextureJob(SetContentsToColor, color, index); }
-        static TextureJob updateContents(const SkBitmap& contents, const IntRect& dirtyRect) { return TextureJob(UpdateContents, contents, dirtyRect); }
+        static TextureJob updateContents(const SkBitmap& contents, const IntRect& dirtyRect, bool isOpaque) { return TextureJob(UpdateContents, contents, dirtyRect, isOpaque); }
         static TextureJob discardContents(const IntRect& dirtyRect) { return TextureJob(DiscardContents, dirtyRect); }
         static TextureJob resizeContents(const IntSize& newSize) { return TextureJob(ResizeContents, newSize); }
         static TextureJob dirtyContents(const IntRect& dirtyRect) { return TextureJob(DirtyContents, dirtyRect); }
index f4c7441..848c184 100644 (file)
@@ -95,7 +95,7 @@ public:
 
     void setOpacity(float opacity) { m_opacity = opacity; setNeedsCommit(); }
 
-    void setOpaque(bool opaque) { m_opaque = opaque; setNeedsCommit(); }
+    void setOpaque(bool isOpaque) { m_isOpaque = isOpaque; setNeedsCommit(); }
 
     void setPosition(const FloatPoint& position) { m_position = position; setNeedsCommit(); }
 
index 4e996d0..6dc4fdb 100644 (file)
@@ -61,7 +61,7 @@ public:
     void unprotect() { --m_protectionCount; }
     bool protect(const IntSize&);
 
-    void updateContents(const SkBitmap& contents, const IntRect& dirtyRect, const IntRect& tile, bool isOpaque = false);
+    void updateContents(const SkBitmap& contents, const IntRect& dirtyRect, const IntRect& tile, bool isOpaque);
     void setContentsToColor(const Color&);
 
     IntSize size() const { return m_size; }
index fe0c3da..f9f6540 100644 (file)
@@ -254,7 +254,7 @@ PassRefPtr<Texture> TextureCacheCompositingThread::textureForColor(const Color&
     return texture.release();
 }
 
-PassRefPtr<Texture> TextureCacheCompositingThread::updateContents(const RefPtr<Texture>& textureIn, const SkBitmap& contents, const IntRect& dirtyRect, const IntRect& tileRect)
+PassRefPtr<Texture> TextureCacheCompositingThread::updateContents(const RefPtr<Texture>& textureIn, const SkBitmap& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque)
 {
     RefPtr<Texture> texture(textureIn);
 
@@ -266,7 +266,7 @@ PassRefPtr<Texture> TextureCacheCompositingThread::updateContents(const RefPtr<T
     // Protect newly created texture from being evicted.
     TextureProtector protector(texture.get());
 
-    texture->updateContents(contents, dirtyRect, tileRect);
+    texture->updateContents(contents, dirtyRect, tileRect, isOpaque);
 
     return texture.release();
 }
index 82905b9..df7792f 100644 (file)
@@ -54,7 +54,7 @@ public:
     PassRefPtr<Texture> textureForColor(const Color&);
 
     // Update contents of an existing texture, or create a new one if texture is 0.
-    PassRefPtr<Texture> updateContents(const RefPtr<Texture>&, const SkBitmap& contents, const IntRect& dirtyRect, const IntRect& tileRect);
+    PassRefPtr<Texture> updateContents(const RefPtr<Texture>&, const SkBitmap& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque);
 
     size_t memoryUsage() const { return m_memoryUsage; }
     size_t memoryLimit() const { return m_memoryLimit; }