Title: [111266] trunk/Source/WebCore
- Revision
- 111266
- Author
- [email protected]
- Date
- 2012-03-19 16:11:15 -0700 (Mon, 19 Mar 2012)
Log Message
Make the TileCache work with HiDPI again
https://bugs.webkit.org/show_bug.cgi?id=81569
<rdar://problem/11031542>
Reviewed by Sam Weinig.
Set the contentsScale of the individual tile layers to be the same as the device scale factor.
Also, take into account the fact that the value passed to TileCache::setScale is the product of the
page scale factor and the device scale factor, so divide it by the device scale factor before storing
it in m_scale.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::platformCALayerDeviceScaleFactor):
(WebCore):
* platform/graphics/ca/GraphicsLayerCA.h:
(GraphicsLayerCA):
* platform/graphics/ca/PlatformCALayerClient.h:
(PlatformCALayerClient):
* platform/graphics/ca/mac/TileCache.h:
(TileCache):
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::TileCache):
(WebCore::TileCache::setScale):
(WebCore::TileCache::createTileLayer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (111265 => 111266)
--- trunk/Source/WebCore/ChangeLog 2012-03-19 23:02:32 UTC (rev 111265)
+++ trunk/Source/WebCore/ChangeLog 2012-03-19 23:11:15 UTC (rev 111266)
@@ -1,3 +1,30 @@
+2012-03-19 Anders Carlsson <[email protected]>
+
+ Make the TileCache work with HiDPI again
+ https://bugs.webkit.org/show_bug.cgi?id=81569
+ <rdar://problem/11031542>
+
+ Reviewed by Sam Weinig.
+
+ Set the contentsScale of the individual tile layers to be the same as the device scale factor.
+ Also, take into account the fact that the value passed to TileCache::setScale is the product of the
+ page scale factor and the device scale factor, so divide it by the device scale factor before storing
+ it in m_scale.
+
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::platformCALayerDeviceScaleFactor):
+ (WebCore):
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ (GraphicsLayerCA):
+ * platform/graphics/ca/PlatformCALayerClient.h:
+ (PlatformCALayerClient):
+ * platform/graphics/ca/mac/TileCache.h:
+ (TileCache):
+ * platform/graphics/ca/mac/TileCache.mm:
+ (WebCore::TileCache::TileCache):
+ (WebCore::TileCache::setScale):
+ (WebCore::TileCache::createTileLayer):
+
2012-03-19 Abhishek Arya <[email protected]>
Crash due to layer tree information not updated when moving run-in children.
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (111265 => 111266)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2012-03-19 23:02:32 UTC (rev 111265)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2012-03-19 23:11:15 UTC (rev 111266)
@@ -972,6 +972,11 @@
client()->notifySyncRequired(this);
}
+float GraphicsLayerCA::platformCALayerDeviceScaleFactor()
+{
+ return deviceScaleFactor();
+}
+
void GraphicsLayerCA::commitLayerChangesBeforeSublayers(float pageScaleFactor, const FloatPoint& positionRelativeToBase)
{
if (!m_uncommittedChanges)
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (111265 => 111266)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2012-03-19 23:02:32 UTC (rev 111265)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2012-03-19 23:11:15 UTC (rev 111266)
@@ -158,6 +158,7 @@
virtual bool platformCALayerDrawsContent() const { return drawsContent(); }
virtual void platformCALayerLayerDidDisplay(PlatformLayer* layer) { return layerDidDisplay(layer); }
virtual void platformCALayerDidCreateTiles() OVERRIDE;
+ virtual float platformCALayerDeviceScaleFactor() OVERRIDE;
void updateOpacityOnLayer();
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h (111265 => 111266)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h 2012-03-19 23:02:32 UTC (rev 111265)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h 2012-03-19 23:11:15 UTC (rev 111266)
@@ -60,6 +60,7 @@
virtual void platformCALayerLayerDidDisplay(PlatformLayer*) = 0;
virtual void platformCALayerDidCreateTiles() = 0;
+ virtual float platformCALayerDeviceScaleFactor() = 0;
protected:
virtual ~PlatformCALayerClient() {}
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h (111265 => 111266)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h 2012-03-19 23:02:32 UTC (rev 111265)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h 2012-03-19 23:11:15 UTC (rev 111266)
@@ -98,6 +98,7 @@
IntRect m_tileCoverageRect;
CGFloat m_scale;
+ CGFloat m_deviceScaleFactor;
bool m_acceleratesDrawing;
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (111265 => 111266)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm 2012-03-19 23:02:32 UTC (rev 111265)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm 2012-03-19 23:11:15 UTC (rev 111266)
@@ -55,6 +55,7 @@
, m_tileSize(tileSize)
, m_tileRevalidationTimer(this, &TileCache::tileRevalidationTimerFired)
, m_scale(1)
+ , m_deviceScaleFactor(1)
, m_acceleratesDrawing(false)
, m_tileDebugBorderWidth(0)
{
@@ -169,19 +170,28 @@
void TileCache::setScale(CGFloat scale)
{
- if (m_scale == scale)
+ PlatformCALayer* platformLayer = PlatformCALayer::platformCALayer(m_tileCacheLayer);
+ float deviceScaleFactor = platformLayer->owner()->platformCALayerDeviceScaleFactor();
+
+ // The scale we get is the produce of the page scale factor and device scale factor.
+ // Divide by the device scale factor so we'll get the page scale factor.
+ scale /= deviceScaleFactor;
+
+ if (m_scale == scale && m_deviceScaleFactor == deviceScaleFactor)
return;
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ m_deviceScaleFactor = deviceScaleFactor;
m_scale = scale;
[m_tileContainerLayer.get() setTransform:CATransform3DMakeScale(1 / m_scale, 1 / m_scale, 1)];
revalidateTiles();
- for (TileMap::const_iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it)
+ for (TileMap::const_iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it) {
+ [it->second.get() setContentsScale:deviceScaleFactor];
[it->second.get() setNeedsDisplay];
+ }
- PlatformCALayer* platformLayer = PlatformCALayer::platformCALayer(m_tileCacheLayer);
platformLayer->owner()->platformCALayerDidCreateTiles();
#endif
}
@@ -365,6 +375,7 @@
{
RetainPtr<WebTileLayer> layer = adoptNS([[WebTileLayer alloc] init]);
[layer.get() setAnchorPoint:CGPointZero];
+ [layer.get() setContentsScale:m_deviceScaleFactor];
[layer.get() setFrame:tileRect];
[layer.get() setTileCache:this];
[layer.get() setBorderColor:m_tileDebugBorderColor.get()];
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes