For now, we just limit the expansion on x and y direction.
In the future, we need to dynamically allocate and deallocate the memory.
browser change is : c/148242
bug:
5522175
Change-Id: I8562c39c55913ab89848afe8a36e8a2784c12727
// allocate max possible number of tiles visible with this viewport
int viewMaxTileX = static_cast<int>(ceilf((viewport.width()-1) * invTileContentWidth)) + 1;
int viewMaxTileY = static_cast<int>(ceilf((viewport.height()-1) * invTileContentHeight)) + 1;
- int maxTextureCount = (viewMaxTileX + TILE_PREFETCH_DISTANCE * 2) *
- (viewMaxTileY + TILE_PREFETCH_DISTANCE * 2) * 2;
+
+ int maxTextureCount = (viewMaxTileX + m_expandedTileBoundsX * 2) *
+ (viewMaxTileY + m_expandedTileBoundsY * 2) * 2;
+
TilesManager::instance()->setMaxTextureCount(maxTextureCount);
m_tiledPageA->updateBaseTileSize();
m_tiledPageB->updateBaseTileSize();
float viewWidth = (viewport.fRight - viewport.fLeft) * TILE_PREFETCH_RATIO;
float viewHeight = (viewport.fBottom - viewport.fTop) * TILE_PREFETCH_RATIO;
- bool useHorzPrefetch = viewWidth < baseContentWidth();
- bool useVertPrefetch = viewHeight < baseContentHeight();
+ bool useMinimalMemory = TilesManager::instance()->useMinimalMemory();
+ bool useHorzPrefetch = useMinimalMemory ? 0 : viewWidth < baseContentWidth();
+ bool useVertPrefetch = useMinimalMemory ? 0 : viewHeight < baseContentHeight();
m_expandedTileBoundsX = (useHorzPrefetch) ? TILE_PREFETCH_DISTANCE : 0;
m_expandedTileBoundsY = (useVertPrefetch) ? TILE_PREFETCH_DISTANCE : 0;
, m_showVisualIndicator(false)
, m_invertedScreen(false)
, m_invertedScreenSwitch(false)
+ , m_useMinimalMemory(true)
, m_drawGLCount(1)
{
XLOG("TilesManager ctor");
m_shader.setContrast(contrast);
}
+ void setUseMinimalMemory(bool useMinimalMemory)
+ {
+ m_useMinimalMemory = useMinimalMemory;
+ }
+
+ bool useMinimalMemory()
+ {
+ return m_useMinimalMemory;
+ }
+
void incDrawGLCount()
{
m_drawGLCount++;
bool m_invertedScreen;
bool m_invertedScreenSwitch;
+ bool m_useMinimalMemory;
+
sp<TexturesGenerator> m_pixmapsGenerationThread;
android::Mutex m_texturesLock;
TilesManager::instance()->setInvertedScreen(false);
return true;
}
- if (key == "inverted_contrast") {
+ else if (key == "inverted_contrast") {
float contrast = value.toFloat();
TilesManager::instance()->setInvertedScreenContrast(contrast);
return true;
}
- if (key == "enable_cpu_upload_path") {
+ else if (key == "enable_cpu_upload_path") {
TilesManager::instance()->transferQueue()->setTextureUploadType(
value == "true" ? CpuUpload : GpuUpload);
return true;
}
+ else if (key == "use_minimal_memory") {
+ TilesManager::instance()->setUseMinimalMemory(value == "true");
+ return true;
+ }
return false;
}