summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/TilesManager.cpp
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2011-06-28 09:33:24 -0400
committerDerek Sollenberger <djsollen@google.com>2011-06-28 14:11:07 -0400
commitec182c75fb35d955a9115fbaf516f648a48ed0e1 (patch)
tree6b33a549fdca439f103ec78f2536e21e09f2dbf2 /Source/WebCore/platform/graphics/android/TilesManager.cpp
parentb35ff6918673c5adf6e7cd4cbf636c9919abbaed (diff)
downloadexternal_webkit-ec182c75fb35d955a9115fbaf516f648a48ed0e1.zip
external_webkit-ec182c75fb35d955a9115fbaf516f648a48ed0e1.tar.gz
external_webkit-ec182c75fb35d955a9115fbaf516f648a48ed0e1.tar.bz2
Cleanup Skia related rendering code for raster rendering.
In the existing code we created a sharedBitmap for BaseTiles and never used it instead opting for createing bitmaps on the stack to enable partial invalidation. This CL removes the sharedBitmap concept and instead creates all bitmaps on the stack. This means that BackedDoubleBufferedTexture no longer needs to have a bitmap member, but instead simply takes the bitmap from the caller and uploads it to the appropriate texture. To make this upload clean we now pass the bitmap via const references instead of pointers. Change-Id: Ie218c4b4564e5574ca6e404d4857904ab41a3a5c
Diffstat (limited to 'Source/WebCore/platform/graphics/android/TilesManager.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp
index 0e91dc7..b4df0a1 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp
@@ -96,10 +96,6 @@ TilesManager::TilesManager()
{
XLOG("TilesManager ctor");
m_textures.reserveCapacity(MAX_TEXTURE_ALLOCATION);
- m_tilesBitmap = new SkBitmap();
- m_tilesBitmap->setConfig(SkBitmap::kARGB_8888_Config, tileWidth(), tileHeight());
- m_tilesBitmap->allocPixels();
- m_tilesBitmap->eraseColor(0);
m_pixmapsGenerationThread = new TexturesGenerator();
m_pixmapsGenerationThread->run("TexturesGenerator");
}
@@ -110,12 +106,12 @@ void TilesManager::allocateTiles()
XLOG("%d tiles to allocate (%d textures planned)", nbTexturesToAllocate, m_maxTextureCount);
int nbTexturesAllocated = 0;
for (int i = 0; i < nbTexturesToAllocate; i++) {
- BackedDoubleBufferedTexture* texture = new BackedDoubleBufferedTexture(
- tileWidth(), tileHeight(), m_tilesBitmap);
+ BaseTileTexture* texture = new BaseTileTexture(
+ tileWidth(), tileHeight());
// the atomic load ensures that the texture has been fully initialized
// before we pass a pointer for other threads to operate on
- BackedDoubleBufferedTexture* loadedTexture =
- reinterpret_cast<BackedDoubleBufferedTexture*>(
+ BaseTileTexture* loadedTexture =
+ reinterpret_cast<BaseTileTexture*>(
android_atomic_acquire_load(reinterpret_cast<int32_t*>(&texture)));
m_textures.append(loadedTexture);
nbTexturesAllocated++;
@@ -128,7 +124,7 @@ void TilesManager::printTextures()
#ifdef DEBUG
XLOG("++++++");
for (unsigned int i = 0; i < m_textures.size(); i++) {
- BackedDoubleBufferedTexture* texture = m_textures[i];
+ BaseTileTexture* texture = m_textures[i];
BaseTile* o = 0;
if (texture->owner())
o = (BaseTile*) texture->owner();
@@ -150,7 +146,7 @@ void TilesManager::resetTextureUsage(TiledPage* page)
{
android::Mutex::Autolock lock(m_texturesLock);
for (unsigned int i = 0; i < m_textures.size(); i++) {
- BackedDoubleBufferedTexture* texture = m_textures[i];
+ BaseTileTexture* texture = m_textures[i];
TextureOwner* owner = texture->owner();
if (owner) {
if (owner->page() == page)
@@ -159,7 +155,7 @@ void TilesManager::resetTextureUsage(TiledPage* page)
}
}
-BackedDoubleBufferedTexture* TilesManager::getAvailableTexture(BaseTile* owner)
+BaseTileTexture* TilesManager::getAvailableTexture(BaseTile* owner)
{
android::Mutex::Autolock lock(m_texturesLock);
@@ -177,11 +173,11 @@ BackedDoubleBufferedTexture* TilesManager::getAvailableTexture(BaseTile* owner)
// 3. return any texture not used by the tile's page or the page's sibiling
//
// The texture level indicates a tiles closeness to the current viewport
- BackedDoubleBufferedTexture* farthestTexture = 0;
+ BaseTileTexture* farthestTexture = 0;
int farthestTextureLevel = 0;
const unsigned int max = m_textures.size();
for (unsigned int i = 0; i < max; i++) {
- BackedDoubleBufferedTexture* texture = m_textures[i];
+ BaseTileTexture* texture = m_textures[i];
if (texture->usedLevel() == -1) { // found an unused texture, grab it
farthestTexture = texture;
break;
@@ -204,7 +200,7 @@ BackedDoubleBufferedTexture* TilesManager::getAvailableTexture(BaseTile* owner)
TiledPage* currentPage = owner->page();
TiledPage* nextPage = currentPage->sibling();
for (unsigned int i = 0; i < max; i++) {
- BackedDoubleBufferedTexture* texture = m_textures[i];
+ BaseTileTexture* texture = m_textures[i];
if (texture->tryAcquire(owner, currentPage, nextPage)) {
XLOG("grab a texture that wasn't ours, (%x != %x) at %d => texture %x",
owner->page(), texture->owner()->page(), i, texture);