summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/mac
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-05-26 10:11:43 +0100
committerSteve Block <steveblock@google.com>2010-05-27 11:14:42 +0100
commite78cbe89e6f337f2f1fe40315be88f742b547151 (patch)
treed778000b84a04f24bbad50c7fa66244365e960e9 /WebCore/platform/graphics/mac
parent7b582e96e4e909ed7dba1e07153d20fbddaec3f7 (diff)
downloadexternal_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.zip
external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.tar.gz
external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.tar.bz2
Merge WebKit at r60074: Initial merge by git
Change-Id: I18a2dc5439e36c928351ea829d8fb4e39b062fc7
Diffstat (limited to 'WebCore/platform/graphics/mac')
-rw-r--r--WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp15
-rw-r--r--WebCore/platform/graphics/mac/GraphicsLayerCA.h2
-rw-r--r--WebCore/platform/graphics/mac/GraphicsLayerCA.mm30
3 files changed, 45 insertions, 2 deletions
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
index 3b3158f..80c0d03 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
@@ -840,10 +840,21 @@ void GraphicsContext3D::releaseShaderCompiler()
void GraphicsContext3D::renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height)
{
ensureContext(m_contextObj);
- if (internalformat == DEPTH_STENCIL)
+ switch (internalformat) {
+ case DEPTH_STENCIL:
internalformat = GL_DEPTH24_STENCIL8_EXT;
- else if (internalformat == DEPTH_COMPONENT16)
+ break;
+ case DEPTH_COMPONENT16:
internalformat = GL_DEPTH_COMPONENT;
+ break;
+ case RGBA4:
+ case RGB5_A1:
+ internalformat = GL_RGBA;
+ break;
+ case RGB565:
+ internalformat = GL_RGB;
+ break;
+ }
::glRenderbufferStorageEXT(target, internalformat, width, height);
}
diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.h b/WebCore/platform/graphics/mac/GraphicsLayerCA.h
index 49aebba..26a5de6 100644
--- a/WebCore/platform/graphics/mac/GraphicsLayerCA.h
+++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.h
@@ -165,6 +165,8 @@ private:
void commitLayerChangesBeforeSublayers();
void commitLayerChangesAfterSublayers();
+ FloatSize constrainedSize() const;
+
bool requiresTiledLayer(const FloatSize&) const;
void swapFromOrToTiledLayer(bool useTiledLayer);
diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
index 294c82f..bd01353 100644
--- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
+++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
@@ -1050,6 +1050,8 @@ void GraphicsLayerCA::updateSublayerList()
void GraphicsLayerCA::updateLayerPosition()
{
+ // FIXME: if constrained the size, the position will be wrong. Fixing this is not trivial.
+
// Position is offset on the layer by the layer anchor point.
CGPoint posPoint = CGPointMake(m_position.x() + m_anchorPoint.x() * m_size.width(),
m_position.y() + m_anchorPoint.y() * m_size.height());
@@ -1098,6 +1100,11 @@ void GraphicsLayerCA::updateLayerSize()
if (needTiledLayer != m_usingTiledLayer)
swapFromOrToTiledLayer(needTiledLayer);
+ if (m_usingTiledLayer) {
+ FloatSize sizeToUse = constrainedSize();
+ rect = CGRectMake(0, 0, sizeToUse.width(), sizeToUse.height());
+ }
+
[m_layer.get() setBounds:rect];
if (LayerMap* layerCloneMap = m_layerClones.get()) {
LayerMap::const_iterator end = layerCloneMap->end();
@@ -2144,6 +2151,29 @@ void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth)
END_BLOCK_OBJC_EXCEPTIONS
}
+FloatSize GraphicsLayerCA::constrainedSize() const
+{
+ float tileColumns = ceilf(m_size.width() / cTiledLayerTileSize);
+ float tileRows = ceilf(m_size.height() / cTiledLayerTileSize);
+ double numTiles = tileColumns * tileRows;
+
+ FloatSize constrainedSize = m_size;
+ const unsigned cMaxTileCount = 512;
+ while (numTiles > cMaxTileCount) {
+ // Constrain the wider dimension.
+ if (constrainedSize.width() >= constrainedSize.height()) {
+ tileColumns = max(floorf(cMaxTileCount / tileRows), 1.0f);
+ constrainedSize.setWidth(tileColumns * cTiledLayerTileSize);
+ } else {
+ tileRows = max(floorf(cMaxTileCount / tileColumns), 1.0f);
+ constrainedSize.setHeight(tileRows * cTiledLayerTileSize);
+ }
+ numTiles = tileColumns * tileRows;
+ }
+
+ return constrainedSize;
+}
+
bool GraphicsLayerCA::requiresTiledLayer(const FloatSize& size) const
{
if (!m_drawsContent)