summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2011-02-15 14:46:14 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-02-15 14:46:14 -0800
commit2146aa96a0108d6feaa45fcfb157c3c43e9b7131 (patch)
treea19101d37adf6bfc8db05efc8d26cdc8fb50a51e /WebCore/platform
parentee4f4c91344b2610f2ac5714d5f37763e2efc3c0 (diff)
parent522c8aecb5c6a797ceb59e8eaa9ab44e3a5fda54 (diff)
downloadexternal_webkit-2146aa96a0108d6feaa45fcfb157c3c43e9b7131.zip
external_webkit-2146aa96a0108d6feaa45fcfb157c3c43e9b7131.tar.gz
external_webkit-2146aa96a0108d6feaa45fcfb157c3c43e9b7131.tar.bz2
Merge "Set correct max texture allocations."
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/graphics/android/TiledPage.cpp4
-rw-r--r--WebCore/platform/graphics/android/TilesManager.cpp10
-rw-r--r--WebCore/platform/graphics/android/TilesManager.h1
3 files changed, 10 insertions, 5 deletions
diff --git a/WebCore/platform/graphics/android/TiledPage.cpp b/WebCore/platform/graphics/android/TiledPage.cpp
index 620aa6f..36988dd 100644
--- a/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/WebCore/platform/graphics/android/TiledPage.cpp
@@ -49,8 +49,6 @@
#endif // DEBUG
-#define MAX_TILES 256
-
namespace WebCore {
using namespace android;
@@ -65,7 +63,7 @@ TiledPage::TiledPage(int id, GLWebViewState* state)
, m_latestPictureInval(0)
, m_prepare(false)
{
- m_baseTiles = new BaseTile[MAX_TILES];
+ m_baseTiles = new BaseTile[TilesManager::getMaxTextureAllocation() + 1];
#ifdef DEBUG_COUNT
ClassTracker::instance()->increment("TiledPage");
#endif
diff --git a/WebCore/platform/graphics/android/TilesManager.cpp b/WebCore/platform/graphics/android/TilesManager.cpp
index 571d9cc..0fb3b1b 100644
--- a/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/WebCore/platform/graphics/android/TilesManager.cpp
@@ -58,7 +58,7 @@
// at least 5 * 3 = 15 textures. We can also enable offscreen textures
#define EXPANDED_TILE_BOUNDS_X 1
#define EXPANDED_TILE_BOUNDS_Y 4
-#define MAX_TEXTURE_ALLOCATION (5+EXPANDED_TILE_BOUNDS_X*2)*(3+EXPANDED_TILE_BOUNDS_Y*2)*2
+#define MAX_TEXTURE_ALLOCATION (5+1+EXPANDED_TILE_BOUNDS_X*2)*(3+1+EXPANDED_TILE_BOUNDS_Y*2)*2
#define TILE_WIDTH 300
#define TILE_HEIGHT 300
@@ -78,6 +78,11 @@ GLint TilesManager::getMaxTextureSize()
return maxTextureSize;
}
+int TilesManager::getMaxTextureAllocation()
+{
+ return MAX_TEXTURE_ALLOCATION;
+}
+
TilesManager::TilesManager()
: m_layersMemoryUsage(0)
, m_maxTextureCount(0)
@@ -369,7 +374,8 @@ int TilesManager::maxTextureCount()
void TilesManager::setMaxTextureCount(int max)
{
XLOG("setMaxTextureCount: %d", max);
- if (m_maxTextureCount >= max && m_maxTextureCount)
+ if (max > MAX_TEXTURE_ALLOCATION ||
+ (m_maxTextureCount >= max && m_maxTextureCount))
return;
android::Mutex::Autolock lock(m_texturesLock);
diff --git a/WebCore/platform/graphics/android/TilesManager.h b/WebCore/platform/graphics/android/TilesManager.h
index eeb38fe..29b7fc1 100644
--- a/WebCore/platform/graphics/android/TilesManager.h
+++ b/WebCore/platform/graphics/android/TilesManager.h
@@ -45,6 +45,7 @@ class TilesManager {
public:
static TilesManager* instance();
static GLint getMaxTextureSize();
+ static int getMaxTextureAllocation();
static bool hardwareAccelerationEnabled()
{