- Revision
- 107943
- Author
- [email protected]
- Date
- 2012-02-16 08:53:31 -0800 (Thu, 16 Feb 2012)
Log Message
[Qt][WK2] Allow opaque tiles
https://bugs.webkit.org/show_bug.cgi?id=78809
Source/WebCore:
Add a supportsAlpha property to TiledBackingStore.
We invalidate all the tiles if that property changes, because the buffers need to be
recreated in a different format.
Reviewed by Kenneth Rohde Christiansen.
No behavior changes.
* platform/graphics/TiledBackingStore.cpp:
(WebCore::TiledBackingStore::TiledBackingStore):
(WebCore::TiledBackingStore::setSupportsAlpha):
(WebCore):
* platform/graphics/TiledBackingStore.h:
(TiledBackingStore):
(WebCore::TiledBackingStore::supportsAlpha):
Source/WebKit2:
Set the supportsAlpha flag for TiledBackingStore when the layer has contentsOpaque enabled.
Use the flag for ShareableBitmaps created by TiledBackingStore.
For now this will not have impact on performance/memory, because we allocate the same type
of buffers for opaque and transparent tiles.
Reviewed by Kenneth Rohde Christiansen.
* WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::setContentsOpaque):
(WebCore::WebGraphicsLayer::setContentsScale):
(WebCore::WebGraphicsLayer::createBackingStore):
(WebCore):
(WebCore::WebGraphicsLayer::updateContentBuffers):
* WebProcess/WebCoreSupport/WebGraphicsLayer.h:
(WebGraphicsLayer):
* WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp:
(WebKit::TiledBackingStoreRemoteTile::updateBackBuffer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (107942 => 107943)
--- trunk/Source/WebCore/ChangeLog 2012-02-16 16:46:06 UTC (rev 107942)
+++ trunk/Source/WebCore/ChangeLog 2012-02-16 16:53:31 UTC (rev 107943)
@@ -1,3 +1,24 @@
+2012-02-16 No'am Rosenthal <[email protected]>
+
+ [Qt][WK2] Allow opaque tiles
+ https://bugs.webkit.org/show_bug.cgi?id=78809
+
+ Add a supportsAlpha property to TiledBackingStore.
+ We invalidate all the tiles if that property changes, because the buffers need to be
+ recreated in a different format.
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ No behavior changes.
+
+ * platform/graphics/TiledBackingStore.cpp:
+ (WebCore::TiledBackingStore::TiledBackingStore):
+ (WebCore::TiledBackingStore::setSupportsAlpha):
+ (WebCore):
+ * platform/graphics/TiledBackingStore.h:
+ (TiledBackingStore):
+ (WebCore::TiledBackingStore::supportsAlpha):
+
2012-02-16 Sergio Villar Senin <[email protected]>
[soup] Move important SoupSession feature initialization to WebCore
Modified: trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp (107942 => 107943)
--- trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp 2012-02-16 16:46:06 UTC (rev 107942)
+++ trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp 2012-02-16 16:53:31 UTC (rev 107943)
@@ -46,6 +46,7 @@
, m_contentsScale(1.f)
, m_pendingScale(0)
, m_contentsFrozen(false)
+ , m_supportsAlpha(false)
{
}
@@ -507,6 +508,14 @@
}
}
+void TiledBackingStore::setSupportsAlpha(bool a)
+{
+ if (a == supportsAlpha())
+ return;
+ m_supportsAlpha = a;
+ invalidate(contentsRect());
}
+}
+
#endif
Modified: trunk/Source/WebCore/platform/graphics/TiledBackingStore.h (107942 => 107943)
--- trunk/Source/WebCore/platform/graphics/TiledBackingStore.h 2012-02-16 16:46:06 UTC (rev 107942)
+++ trunk/Source/WebCore/platform/graphics/TiledBackingStore.h 2012-02-16 16:53:31 UTC (rev 107943)
@@ -73,6 +73,9 @@
double tileDistance(const IntRect& viewport, const Tile::Coordinate&) const;
float coverageRatio(const WebCore::IntRect& contentsRect);
+ void setSupportsAlpha(bool);
+ bool supportsAlpha() const { return m_supportsAlpha; }
+
private:
void startTileBufferUpdateTimer();
void startTileCreationTimer();
@@ -120,6 +123,7 @@
float m_pendingScale;
bool m_contentsFrozen;
+ bool m_supportsAlpha;
friend class Tile;
};
Modified: trunk/Source/WebKit2/ChangeLog (107942 => 107943)
--- trunk/Source/WebKit2/ChangeLog 2012-02-16 16:46:06 UTC (rev 107942)
+++ trunk/Source/WebKit2/ChangeLog 2012-02-16 16:53:31 UTC (rev 107943)
@@ -1,3 +1,27 @@
+2012-02-16 No'am Rosenthal <[email protected]>
+
+ [Qt][WK2] Allow opaque tiles
+ https://bugs.webkit.org/show_bug.cgi?id=78809
+
+ Set the supportsAlpha flag for TiledBackingStore when the layer has contentsOpaque enabled.
+ Use the flag for ShareableBitmaps created by TiledBackingStore.
+
+ For now this will not have impact on performance/memory, because we allocate the same type
+ of buffers for opaque and transparent tiles.
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+ (WebCore::WebGraphicsLayer::setContentsOpaque):
+ (WebCore::WebGraphicsLayer::setContentsScale):
+ (WebCore::WebGraphicsLayer::createBackingStore):
+ (WebCore):
+ (WebCore::WebGraphicsLayer::updateContentBuffers):
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+ (WebGraphicsLayer):
+ * WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp:
+ (WebKit::TiledBackingStoreRemoteTile::updateBackBuffer):
+
2012-02-16 Sergio Villar Senin <[email protected]>
[soup] Move important SoupSession feature initialization to WebCore
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp (107942 => 107943)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp 2012-02-16 16:46:06 UTC (rev 107942)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp 2012-02-16 16:53:31 UTC (rev 107943)
@@ -251,6 +251,8 @@
{
if (contentsOpaque() == b)
return;
+ if (m_mainBackingStore)
+ m_mainBackingStore->setSupportsAlpha(!b);
GraphicsLayer::setContentsOpaque(b);
notifyChange();
}
@@ -488,11 +490,17 @@
m_contentsScale = scale;
if (m_mainBackingStore && m_mainBackingStore->contentsScale() != scale) {
m_previousBackingStore = m_mainBackingStore.release();
- m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
- m_mainBackingStore->setContentsScale(scale);
+ createBackingStore();
}
}
+void WebGraphicsLayer::createBackingStore()
+{
+ m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
+ m_mainBackingStore->setSupportsAlpha(!contentsOpaque());
+ m_mainBackingStore->setContentsScale(m_contentsScale);
+}
+
void WebGraphicsLayer::tiledBackingStorePaint(GraphicsContext* context, const IntRect& rect)
{
if (rect.isEmpty())
@@ -576,10 +584,8 @@
m_inUpdateMode = true;
// This is the only place we (re)create the main tiled backing store,
// once we have a remote client and we are ready to send our data to the UI process.
- if (!m_mainBackingStore) {
- m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
- m_mainBackingStore->setContentsScale(m_contentsScale);
- }
+ if (!m_mainBackingStore)
+ createBackingStore();
m_mainBackingStore->updateTileBuffers();
m_inUpdateMode = false;
}
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h (107942 => 107943)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h 2012-02-16 16:46:06 UTC (rev 107942)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h 2012-02-16 16:53:31 UTC (rev 107943)
@@ -158,6 +158,7 @@
void notifyChange();
void notifyChangeRecursively();
+ void createBackingStore();
HashSet<String> m_transformAnimations;
bool selfOrAncestorHasActiveTransformAnimations() const;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp (107942 => 107943)
--- trunk/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp 2012-02-16 16:46:06 UTC (rev 107942)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp 2012-02-16 16:53:31 UTC (rev 107943)
@@ -84,7 +84,7 @@
// for us to be able to draw this buffer on the ShareableBitmap right after.
m_tiledBackingStore->client()->tiledBackingStorePaint(m_localBuffer->context(), m_tiledBackingStore->mapToContents(m_dirtyRect));
- RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(m_rect.size(), ShareableBitmap::SupportsAlpha);
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(m_rect.size(), m_tiledBackingStore->supportsAlpha() ? ShareableBitmap::SupportsAlpha : 0);
OwnPtr<GraphicsContext> graphicsContext(bitmap->createGraphicsContext());
graphicsContext->drawImageBuffer(m_localBuffer.get(), ColorSpaceDeviceRGB, IntPoint(0, 0));