summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android/TilesManager.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-02-01 20:54:50 +0000
committerBen Murdoch <benm@google.com>2011-02-02 02:17:09 +0000
commit4da96b9950ba2e86203aa50be39adcc8431a95a4 (patch)
tree53e777d3e5ea61389f5fd0f931ce9a61b7e95f98 /WebCore/platform/graphics/android/TilesManager.cpp
parente829439d86a8ce36f5c585ea0344ed9b9b6d067a (diff)
downloadexternal_webkit-4da96b9950ba2e86203aa50be39adcc8431a95a4.zip
external_webkit-4da96b9950ba2e86203aa50be39adcc8431a95a4.tar.gz
external_webkit-4da96b9950ba2e86203aa50be39adcc8431a95a4.tar.bz2
Get layers showing again
Lazily get the maximum texture size from GL when we first need it. This avoids calling GL functions before GL has been set up and ensures it is done on the correct (ie. UI) thread. Also move the tiles expansion setting from WC thread to UI thread as TilesManager is not thread safe when creating the singleton instance. This makes change 4596782e unnecessary so we remove it. Bug: 3412928 Change-Id: I740974d8cc0ef4f66956cd6a07b058bfa7ca767f
Diffstat (limited to 'WebCore/platform/graphics/android/TilesManager.cpp')
-rw-r--r--WebCore/platform/graphics/android/TilesManager.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/WebCore/platform/graphics/android/TilesManager.cpp b/WebCore/platform/graphics/android/TilesManager.cpp
index 5f15fd6..571d9cc 100644
--- a/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/WebCore/platform/graphics/android/TilesManager.cpp
@@ -70,9 +70,16 @@
namespace WebCore {
+GLint TilesManager::getMaxTextureSize()
+{
+ static GLint maxTextureSize = 0;
+ if (!maxTextureSize)
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
+ return maxTextureSize;
+}
+
TilesManager::TilesManager()
: m_layersMemoryUsage(0)
- , m_maxTextureSize(0)
, m_maxTextureCount(0)
, m_expandedTileBounds(false)
, m_generatorReady(false)
@@ -85,16 +92,6 @@ TilesManager::TilesManager()
m_tilesBitmap->eraseColor(0);
m_pixmapsGenerationThread = new TexturesGenerator();
m_pixmapsGenerationThread->run("TexturesGenerator");
- checkMaxTextureSize();
-}
-
-void TilesManager::checkMaxTextureSize()
-{
- if (m_maxTextureSize > 0)
- return;
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize);
- m_totalMaxTextureSize = m_maxTextureSize * m_maxTextureSize * BYTES_PER_PIXEL;
- XLOG("Max texture size %d", m_maxTextureSize);
}
void TilesManager::allocateTiles()
@@ -113,7 +110,6 @@ void TilesManager::allocateTiles()
m_textures.append(loadedTexture);
nbTexturesAllocated++;
}
- checkMaxTextureSize();
XLOG("allocated %d textures", nbTexturesAllocated);
}
@@ -322,11 +318,13 @@ LayerTexture* TilesManager::createTextureForLayer(LayerAndroid* layer, const Int
unsigned int size = w * h * BYTES_PER_PIXEL;
// We will not allocate textures that:
- // 1) cannot be handled by the graphic card (m_maxTextureSize &
- // m_totalMaxTextureSize)
+ // 1) cannot be handled by the graphic card (maxTextureSize &
+ // totalMaxTextureSize)
// 2) will make us go past our texture limit (MAX_LAYERS_ALLOCATION)
- bool large = w > m_maxTextureSize || h > m_maxTextureSize || size > m_totalMaxTextureSize;
+ GLint maxTextureSize = getMaxTextureSize();
+ unsigned totalMaxTextureSize = maxTextureSize * maxTextureSize * BYTES_PER_PIXEL;
+ bool large = w > maxTextureSize || h > maxTextureSize || size > totalMaxTextureSize;
XLOG("createTextureForLayer(%d) @scale %.2f => %d, %d (too large? %x)", layer->uniqueId(),
layer->getScale(), w, h, large);