diff options
author | Chris Craik <ccraik@google.com> | 2012-03-30 15:11:32 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-03-30 15:11:32 -0700 |
commit | de5a3eeb42d8930d4fd09d86953de929c450f7a6 (patch) | |
tree | 4111a61e66da22a5122501f6ce3655f775b0ac13 /Source/WebCore/platform | |
parent | 8c5a835fb0ffdb3042373684bfab54fed5c7d211 (diff) | |
parent | c51715092b8d3be1b51cce8bae61750cbcf342c4 (diff) | |
download | external_webkit-de5a3eeb42d8930d4fd09d86953de929c450f7a6.zip external_webkit-de5a3eeb42d8930d4fd09d86953de929c450f7a6.tar.gz external_webkit-de5a3eeb42d8930d4fd09d86953de929c450f7a6.tar.bz2 |
Merge "Add back low res base layer rendering, and expanded bounds prefetching"
Diffstat (limited to 'Source/WebCore/platform')
13 files changed, 146 insertions, 118 deletions
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp index 7243031..61b5f84 100644 --- a/Source/WebCore/platform/graphics/android/BaseTile.cpp +++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp @@ -82,7 +82,7 @@ BaseTile::~BaseTile() // All the following functions must be called from the main GL thread. -void BaseTile::setContents(int x, int y, float scale) +void BaseTile::setContents(int x, int y, float scale, bool isExpandedPrefetchTile) { // TODO: investigate whether below check/discard is necessary if ((m_x != x) @@ -97,6 +97,8 @@ void BaseTile::setContents(int x, int y, float scale) m_y = y; m_scale = scale; m_drawCount = TilesManager::instance()->getDrawGLCount(); + if (isExpandedPrefetchTile) + m_drawCount--; // deprioritize expanded painting region } void BaseTile::reserveTexture() @@ -154,17 +156,11 @@ void BaseTile::markAsDirty(const SkRegion& dirtyArea) // Check if we actually intersect with the area bool intersect = false; SkRegion::Iterator cliperator(dirtyArea); - int tileWidth = TilesManager::instance()->tileWidth(); - int tileHeight = TilesManager::instance()->tileHeight(); - if (m_isLayerTile) { - tileWidth = TilesManager::instance()->layerTileWidth(); - tileHeight = TilesManager::instance()->layerTileHeight(); - } SkRect realTileRect; SkRect dirtyRect; while (!cliperator.done()) { dirtyRect.set(cliperator.rect()); - if (intersectWithRect(m_x, m_y, tileWidth, tileHeight, + if (intersectWithRect(m_x, m_y, TilesManager::tileWidth(), TilesManager::tileHeight(), m_scale, dirtyRect, realTileRect)) { intersect = true; break; diff --git a/Source/WebCore/platform/graphics/android/BaseTile.h b/Source/WebCore/platform/graphics/android/BaseTile.h index afb1db2..8bf681e 100644 --- a/Source/WebCore/platform/graphics/android/BaseTile.h +++ b/Source/WebCore/platform/graphics/android/BaseTile.h @@ -93,7 +93,7 @@ public: bool isLayerTile() { return m_isLayerTile; } - void setContents(int x, int y, float scale); + void setContents(int x, int y, float scale, bool isExpandedPrefetchTile); void reserveTexture(); diff --git a/Source/WebCore/platform/graphics/android/CanvasLayer.cpp b/Source/WebCore/platform/graphics/android/CanvasLayer.cpp index fea429f..5409fef 100644 --- a/Source/WebCore/platform/graphics/android/CanvasLayer.cpp +++ b/Source/WebCore/platform/graphics/android/CanvasLayer.cpp @@ -132,8 +132,8 @@ void CanvasLayer::canvasResized(HTMLCanvasElement*) const IntSize& size = m_canvas->size(); m_dirtyCanvas.setRect(0, 0, size.width(), size.height()); // If we are smaller than one tile, don't bother using a surface texture - if (size.width() <= TilesManager::layerTileWidth() - && size.height() <= TilesManager::layerTileHeight()) + if (size.width() <= TilesManager::tileWidth() + && size.height() <= TilesManager::tileHeight()) m_texture->setSize(IntSize()); else m_texture->setSize(size); diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h index 85c90fd..e4b3b3b 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.h +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h @@ -49,9 +49,6 @@ // HW limit or save further in the GPU memory consumption. #define TILE_PREFETCH_DISTANCE 1 -// ratio of content to view required for prefetching to enable -#define TILE_PREFETCH_RATIO 1.2 - namespace WebCore { class BaseLayerAndroid; diff --git a/Source/WebCore/platform/graphics/android/ImageTexture.cpp b/Source/WebCore/platform/graphics/android/ImageTexture.cpp index 11a449a..7d3f2b8 100644 --- a/Source/WebCore/platform/graphics/android/ImageTexture.cpp +++ b/Source/WebCore/platform/graphics/android/ImageTexture.cpp @@ -183,8 +183,8 @@ bool ImageTexture::prepareGL(GLWebViewState* state) if (!m_texture) return false; - IntRect visibleArea(0, 0, m_image->width(), m_image->height()); - m_texture->prepareGL(state, 1.0, visibleArea, this); + IntRect unclippedArea(0, 0, m_image->width(), m_image->height()); + m_texture->prepareGL(state, 1.0, unclippedArea, unclippedArea, this); if (m_texture->isReady()) { m_texture->swapTiles(); return false; diff --git a/Source/WebCore/platform/graphics/android/LayerGroup.cpp b/Source/WebCore/platform/graphics/android/LayerGroup.cpp index 5d8b726..2d6c1c4 100644 --- a/Source/WebCore/platform/graphics/android/LayerGroup.cpp +++ b/Source/WebCore/platform/graphics/android/LayerGroup.cpp @@ -156,6 +156,13 @@ IntRect LayerGroup::visibleArea() return rect; } +IntRect LayerGroup::unclippedArea() +{ + if (singleLayer()) + return getFirstLayer()->unclippedArea(); + return m_unclippedArea; +} + void LayerGroup::prepareGL(bool layerTilesDisabled) { bool tilesDisabled = layerTilesDisabled && !isBase(); @@ -174,11 +181,14 @@ void LayerGroup::prepareGL(bool layerTilesDisabled) } else { bool allowZoom = hasText(); // only allow for scale > 1 if painting vectors IntRect prepareArea = computePrepareArea(); + IntRect fullArea = unclippedArea(); ALOGV("prepareGL on LG %p with DTT %p, %d layers", this, m_dualTiledTexture, m_layers.size()); + m_dualTiledTexture->prepareGL(getFirstLayer()->state(), allowZoom, - prepareArea, this); + prepareArea, fullArea, + this, useAggressiveRendering()); } } @@ -200,7 +210,8 @@ bool LayerGroup::drawGL(bool layerTilesDisabled) ALOGV("drawGL on LG %p with DTT %p", this, m_dualTiledTexture); IntRect drawArea = visibleArea(); - askRedraw |= m_dualTiledTexture->drawGL(drawArea, opacity(), drawTransform()); + askRedraw |= m_dualTiledTexture->drawGL(drawArea, opacity(), + drawTransform(), useAggressiveRendering()); } // draw member layers (draws image textures, glextras) @@ -233,7 +244,7 @@ IntRect LayerGroup::computePrepareArea() { && !isBase() && getFirstLayer()->state()->layersRenderingMode() == GLWebViewState::kAllTextures) { - area = singleLayer() ? getFirstLayer()->unclippedArea() : m_unclippedArea; + area = unclippedArea(); double total = ((double) area.width()) * ((double) area.height()); if (total > MAX_UNCLIPPED_AREA) diff --git a/Source/WebCore/platform/graphics/android/LayerGroup.h b/Source/WebCore/platform/graphics/android/LayerGroup.h index edfb30d..22986e4 100644 --- a/Source/WebCore/platform/graphics/android/LayerGroup.h +++ b/Source/WebCore/platform/graphics/android/LayerGroup.h @@ -48,17 +48,14 @@ public: bool tryUpdateLayerGroup(LayerGroup* oldLayerGroup); void addLayer(LayerAndroid* layer, const TransformationMatrix& transform); - IntRect visibleArea(); void prepareGL(bool layerTilesDisabled); bool drawGL(bool layerTilesDisabled); void swapTiles(); bool isReady(); - IntRect computePrepareArea(); void computeTexturesAmount(TexturesResult* result); LayerAndroid* getFirstLayer() { return m_layers[0]; } - bool singleLayer() { return m_layers.size() == 1; } bool needsTexture() { return m_needsTexture; } bool hasText() { return m_hasText; } bool isBase(); @@ -67,6 +64,13 @@ public: virtual bool paint(BaseTile* tile, SkCanvas* canvas); virtual float opacity(); private: + IntRect computePrepareArea(); + IntRect visibleArea(); + IntRect unclippedArea(); + bool singleLayer() { return m_layers.size() == 1; } + bool useAggressiveRendering() { return isBase(); } + + const TransformationMatrix* drawTransform(); IntRect m_unclippedArea; TransformationMatrix m_drawTransform; diff --git a/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp b/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp index 910ba21..4ae1f31 100644 --- a/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp +++ b/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp @@ -37,10 +37,12 @@ namespace WebCore { -PaintTileOperation::PaintTileOperation(BaseTile* tile, TilePainter* painter, GLWebViewState* state) +PaintTileOperation::PaintTileOperation(BaseTile* tile, TilePainter* painter, + GLWebViewState* state, bool isLowResPrefetch) : m_tile(tile) , m_painter(painter) , m_state(state) + , m_isLowResPrefetch(isLowResPrefetch) { if (m_tile) m_tile->setRepaintPending(true); @@ -84,6 +86,10 @@ int PaintTileOperation::priority() int priority = 200000; + // prioritize low res while scrolling + if (m_isLowResPrefetch) + priority = m_state->isScrolling() ? 0 : 400000; + // prioritize higher draw count unsigned long long currentDraw = TilesManager::instance()->getDrawGLCount(); unsigned long long drawDelta = currentDraw - m_tile->drawCount(); diff --git a/Source/WebCore/platform/graphics/android/PaintTileOperation.h b/Source/WebCore/platform/graphics/android/PaintTileOperation.h index 468f6d2..afd2fc1 100644 --- a/Source/WebCore/platform/graphics/android/PaintTileOperation.h +++ b/Source/WebCore/platform/graphics/android/PaintTileOperation.h @@ -38,7 +38,8 @@ class ImageTexture; class PaintTileOperation : public QueuedOperation { public: - PaintTileOperation(BaseTile* tile, TilePainter* painter, GLWebViewState* state); + PaintTileOperation(BaseTile* tile, TilePainter* painter, + GLWebViewState* state, bool isLowResPrefetch); virtual ~PaintTileOperation(); virtual bool operator==(const QueuedOperation* operation); virtual void run(); @@ -51,6 +52,7 @@ private: BaseTile* m_tile; TilePainter* m_painter; GLWebViewState* m_state; + bool m_isLowResPrefetch; }; class ScaleFilter : public OperationFilter { diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.cpp b/Source/WebCore/platform/graphics/android/TiledTexture.cpp index 51e9b35..b993501 100644 --- a/Source/WebCore/platform/graphics/android/TiledTexture.cpp +++ b/Source/WebCore/platform/graphics/android/TiledTexture.cpp @@ -37,6 +37,10 @@ #include <wtf/CurrentTime.h> +#define LOW_RES_PREFETCH_SCALE_MODIFIER 0.3f +#define EXPANDED_BOUNDS_INFLATE 1 +#define EXPANDED_PREFETCH_BOUNDS_Y_INFLATE 1 + namespace WebCore { TiledTexture::~TiledTexture() @@ -73,6 +77,14 @@ bool TiledTexture::isReady() || !tilesVisible || tilesAllReady; } +bool TiledTexture::isMissingContent() +{ + for (unsigned int i = 0; i < m_tiles.size(); i++) + if (m_tiles[i]->isTileVisible(m_area) && !m_tiles[i]->frontTexture()) + return true; + return false; +} + void TiledTexture::swapTiles() { int swaps = 0; @@ -98,8 +110,8 @@ IntRect TiledTexture::computeTilesArea(const IntRect& contentArea, float scale) return computedArea; } - int tileWidth = TilesManager::instance()->layerTileWidth(); - int tileHeight = TilesManager::instance()->layerTileHeight(); + int tileWidth = TilesManager::tileWidth(); + int tileHeight = TilesManager::tileHeight(); computedArea.setX(area.x() / tileWidth); computedArea.setY(area.y() / tileHeight); @@ -111,7 +123,8 @@ IntRect TiledTexture::computeTilesArea(const IntRect& contentArea, float scale) } void TiledTexture::prepareGL(GLWebViewState* state, float scale, - const IntRect& prepareArea, TilePainter* painter) + const IntRect& prepareArea, const IntRect& unclippedArea, + TilePainter* painter, bool isLowResPrefetch, bool useExpandPrefetch) { // first, how many tiles do we need m_area = computeTilesArea(prepareArea, scale); @@ -151,15 +164,36 @@ void TiledTexture::prepareGL(GLWebViewState* state, float scale, m_dirtyRegion.setEmpty(); } + // prepare standard bounds (clearing ExpandPrefetch flag) for (int i = 0; i < m_area.width(); i++) { if (goingDown) { for (int j = 0; j < m_area.height(); j++) - prepareTile(m_area.x() + i, m_area.y() + j, painter, state); + prepareTile(m_area.x() + i, m_area.y() + j, + painter, state, isLowResPrefetch, false); } else { for (int j = m_area.height() - 1; j >= 0; j--) - prepareTile(m_area.x() + i, m_area.y() + j, painter, state); + prepareTile(m_area.x() + i, m_area.y() + j, + painter, state, isLowResPrefetch, false); } } + + // prepare expanded bounds + if (useExpandPrefetch) { + IntRect fullArea = computeTilesArea(unclippedArea, scale); + IntRect expandedArea = m_area; + expandedArea.inflate(EXPANDED_BOUNDS_INFLATE); + + if (isLowResPrefetch) + expandedArea.inflate(EXPANDED_PREFETCH_BOUNDS_Y_INFLATE); + + // clip painting area to content + expandedArea.intersect(fullArea); + + for (int i = expandedArea.x(); i < expandedArea.maxX(); i++) + for (int j = expandedArea.y(); j < expandedArea.maxY(); j++) + if (!m_area.contains(i, j)) + prepareTile(i, j, painter, state, isLowResPrefetch, true); + } } void TiledTexture::markAsDirty(const SkRegion& invalRegion) @@ -169,7 +203,8 @@ void TiledTexture::markAsDirty(const SkRegion& invalRegion) m_dirtyRegion.op(invalRegion, SkRegion::kUnion_Op); } -void TiledTexture::prepareTile(int x, int y, TilePainter* painter, GLWebViewState* state) +void TiledTexture::prepareTile(int x, int y, TilePainter* painter, + GLWebViewState* state, bool isLowResPrefetch, bool isExpandPrefetch) { BaseTile* tile = getTile(x, y); if (!tile) { @@ -179,7 +214,8 @@ void TiledTexture::prepareTile(int x, int y, TilePainter* painter, GLWebViewStat } ALOGV("preparing tile %p at %d, %d, painter is %p", tile, x, y, painter); - tile->setContents(x, y, m_scale); + + tile->setContents(x, y, m_scale, isExpandPrefetch); // TODO: move below (which is largely the same for layers / tiled page) into // prepareGL() function @@ -189,7 +225,8 @@ void TiledTexture::prepareTile(int x, int y, TilePainter* painter, GLWebViewStat if (tile->backTexture() && tile->isDirty() && !tile->isRepaintPending()) { ALOGV("painting TT %p's tile %d %d for LG %p", this, x, y, painter); - PaintTileOperation *operation = new PaintTileOperation(tile, painter, state); + PaintTileOperation *operation = new PaintTileOperation(tile, painter, + state, isLowResPrefetch); TilesManager::instance()->scheduleOperation(operation); } } @@ -229,8 +266,8 @@ bool TiledTexture::drawGL(const IntRect& visibleArea, float opacity, return false; float m_invScale = 1 / m_scale; - const float tileWidth = TilesManager::layerTileWidth() * m_invScale; - const float tileHeight = TilesManager::layerTileHeight() * m_invScale; + const float tileWidth = TilesManager::tileWidth() * m_invScale; + const float tileHeight = TilesManager::tileHeight() * m_invScale; int drawn = 0; bool askRedraw = false; @@ -278,24 +315,10 @@ void TiledTexture::discardTextures() m_tiles[i]->discardTextures(); } -bool TiledTexture::owns(BaseTileTexture* texture) -{ - for (unsigned int i = 0; i < m_tiles.size(); i++) { - BaseTile* tile = m_tiles[i]; - if (tile->frontTexture() == texture) - return true; - if (tile->backTexture() == texture) - return true; - } - return false; -} - DualTiledTexture::DualTiledTexture(bool isBaseSurface) { - m_textureA = new TiledTexture(isBaseSurface); - m_textureB = new TiledTexture(isBaseSurface); - m_frontTexture = m_textureA; - m_backTexture = m_textureB; + m_frontTexture = new TiledTexture(isBaseSurface); + m_backTexture = new TiledTexture(isBaseSurface); m_scale = -1; m_futureScale = -1; m_zooming = false; @@ -303,18 +326,14 @@ DualTiledTexture::DualTiledTexture(bool isBaseSurface) DualTiledTexture::~DualTiledTexture() { - delete m_textureA; - delete m_textureB; + delete m_frontTexture; + delete m_backTexture; } void DualTiledTexture::prepareGL(GLWebViewState* state, bool allowZoom, - const IntRect& prepareArea, TilePainter* painter) + const IntRect& prepareArea, const IntRect& unclippedArea, + TilePainter* painter, bool aggressiveRendering) { - // If we are zooming, we will use the previously used area, to prevent the - // frontTexture to try to allocate more tiles than what it has already - if (!m_zooming) - m_preZoomPrepareArea = prepareArea; - float scale = state->scale(); if (scale > 1 && !allowZoom) scale = 1; @@ -330,35 +349,45 @@ void DualTiledTexture::prepareGL(GLWebViewState* state, bool allowZoom, m_zooming = true; } + bool useExpandPrefetch = aggressiveRendering; ALOGV("Prepare DTT %p with scale %.2f, m_scale %.2f, futureScale: %.2f, zooming: %d, f %p, b %p", this, scale, m_scale, m_futureScale, m_zooming, m_frontTexture, m_backTexture); - if (m_scale > 0 && !m_zooming) - m_frontTexture->prepareGL(state, m_scale, m_preZoomPrepareArea, painter); - - // If we had a scheduled update - if (m_zooming && m_zoomUpdateTime < WTF::currentTime()) { - m_backTexture->prepareGL(state, m_futureScale, prepareArea, painter); - if (m_backTexture->isReady()) { + if (!m_zooming) { + m_frontTexture->prepareGL(state, m_scale, + prepareArea, unclippedArea, painter, false, useExpandPrefetch); + if (aggressiveRendering) { + // prepare the back tiled texture to render content in low res + float lowResPrefetchScale = m_scale * LOW_RES_PREFETCH_SCALE_MODIFIER; + m_backTexture->prepareGL(state, lowResPrefetchScale, + prepareArea, unclippedArea, painter, true, useExpandPrefetch); m_backTexture->swapTiles(); - swap(); + } + } else if (m_zoomUpdateTime < WTF::currentTime()) { + m_backTexture->prepareGL(state, m_futureScale, + prepareArea, unclippedArea, painter, false, useExpandPrefetch); + if (m_backTexture->isReady()) { + // zooming completed, swap the textures and new front tiles + swapTiledTextures(); + + m_frontTexture->swapTiles(); + m_backTexture->discardTextures(); + + m_scale = m_futureScale; m_zooming = false; } } } -void DualTiledTexture::swap() -{ - m_frontTexture = m_frontTexture == m_textureA ? m_textureB : m_textureA; - m_backTexture = m_backTexture == m_textureA ? m_textureB : m_textureA; - m_scale = m_futureScale; - m_backTexture->discardTextures(); -} - bool DualTiledTexture::drawGL(const IntRect& visibleArea, float opacity, - const TransformationMatrix* transform) + const TransformationMatrix* transform, + bool aggressiveRendering) { + // draw low res prefetch page, if needed + if (aggressiveRendering && !m_zooming && m_frontTexture->isMissingContent()) + m_backTexture->drawGL(visibleArea, opacity, transform); + bool needsRepaint = m_frontTexture->drawGL(visibleArea, opacity, transform); needsRepaint |= m_zooming; needsRepaint |= (m_scale <= 0); @@ -377,13 +406,6 @@ void DualTiledTexture::swapTiles() m_frontTexture->swapTiles(); } -bool DualTiledTexture::owns(BaseTileTexture* texture) -{ - bool owns = m_textureA->owns(texture); - owns |= m_textureB->owns(texture); - return owns; -} - void DualTiledTexture::computeTexturesAmount(TexturesResult* result, LayerAndroid* layer) { // TODO: shouldn't use layer, as this DTT may paint multiple layers @@ -419,4 +441,11 @@ void DualTiledTexture::computeTexturesAmount(TexturesResult* result, LayerAndroi result->full += nbTexturesUnclipped; } +void DualTiledTexture::swapTiledTextures() +{ + TiledTexture* temp = m_frontTexture; + m_frontTexture = m_backTexture; + m_backTexture = temp; +} + } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.h b/Source/WebCore/platform/graphics/android/TiledTexture.h index b879d54..d1b0818 100644 --- a/Source/WebCore/platform/graphics/android/TiledTexture.h +++ b/Source/WebCore/platform/graphics/android/TiledTexture.h @@ -43,8 +43,7 @@ namespace WebCore { class TiledTexture { public: TiledTexture(bool isBaseSurface) - : m_prevTileX(0) - , m_prevTileY(0) + : m_prevTileY(0) , m_scale(1) , m_isBaseSurface(isBaseSurface) { @@ -56,38 +55,36 @@ public: virtual ~TiledTexture(); - IntRect computeTilesArea(const IntRect& contentArea, float scale); + static IntRect computeTilesArea(const IntRect& contentArea, float scale); void prepareGL(GLWebViewState* state, float scale, - const IntRect& prepareArea, TilePainter* painter); + const IntRect& prepareArea, const IntRect& unclippedArea, + TilePainter* painter, bool isLowResPrefetch = false, + bool useExpandPrefetch = false); void swapTiles(); bool drawGL(const IntRect& visibleArea, float opacity, const TransformationMatrix* transform); - void prepareTile(int x, int y, TilePainter* painter, GLWebViewState* state); + void prepareTile(int x, int y, TilePainter* painter, + GLWebViewState* state, bool isLowResPrefetch, bool isExpandPrefetch); void markAsDirty(const SkRegion& dirtyArea); BaseTile* getTile(int x, int y); void removeTiles(); void discardTextures(); - bool owns(BaseTileTexture* texture); - float scale() { return m_scale; } bool isReady(); + bool isMissingContent(); int nbTextures(IntRect& area, float scale); private: - bool tileIsVisible(BaseTile* tile); - Vector<BaseTile*> m_tiles; - // tile coordinates in viewport, set in prepareGL() IntRect m_area; SkRegion m_dirtyRegion; - int m_prevTileX; int m_prevTileY; float m_scale; @@ -97,20 +94,21 @@ private: class DualTiledTexture : public SkRefCnt { // TODO: investigate webkit threadsafe ref counting public: + DualTiledTexture(bool isBaseSurface); ~DualTiledTexture(); void prepareGL(GLWebViewState* state, bool allowZoom, - const IntRect& prepareArea, TilePainter* painter); + const IntRect& prepareArea, const IntRect& unclippedArea, + TilePainter* painter, bool aggressiveRendering); void swapTiles(); - void swap(); - bool drawGL(const IntRect& visibleArea, float opacity, const TransformationMatrix* transform); + bool drawGL(const IntRect& visibleArea, float opacity, + const TransformationMatrix* transform, bool aggressiveRendering); void markAsDirty(const SkRegion& dirtyArea); - bool owns(BaseTileTexture* texture); void computeTexturesAmount(TexturesResult* result, LayerAndroid* layer); void discardTextures() { - m_textureA->discardTextures(); - m_textureB->discardTextures(); + m_frontTexture->discardTextures(); + m_backTexture->discardTextures(); } bool isReady() { @@ -126,18 +124,17 @@ public: } private: + void swapTiledTextures(); + // Delay before we schedule a new tile at the new scale factor static const double s_zoomUpdateDelay = 0.2; // 200 ms TiledTexture* m_frontTexture; TiledTexture* m_backTexture; - TiledTexture* m_textureA; - TiledTexture* m_textureB; float m_scale; float m_futureScale; double m_zoomUpdateTime; bool m_zooming; - IntRect m_preZoomPrepareArea; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp index 1e9aee4..eeedc07 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp @@ -56,8 +56,6 @@ #define MAX_TEXTURE_ALLOCATION ((6+TILE_PREFETCH_DISTANCE*2)*(5+TILE_PREFETCH_DISTANCE*2)*4) #define TILE_WIDTH 256 #define TILE_HEIGHT 256 -#define LAYER_TILE_WIDTH 256 -#define LAYER_TILE_HEIGHT 256 #define BYTES_PER_PIXEL 4 // 8888 config @@ -127,7 +125,7 @@ void TilesManager::allocateTiles() int nbLayersTexturesAllocated = 0; for (int i = 0; i < nbLayersTexturesToAllocate; i++) { BaseTileTexture* texture = new BaseTileTexture( - layerTileWidth(), layerTileHeight()); + tileWidth(), tileHeight()); // the atomic load ensures that the texture has been fully initialized // before we pass a pointer for other threads to operate on BaseTileTexture* loadedTexture = @@ -140,7 +138,7 @@ void TilesManager::allocateTiles() nbTexturesAllocated, m_textures.size(), m_textures.size() * TILE_WIDTH * TILE_HEIGHT * 4 / 1024 / 1024, nbLayersTexturesAllocated, m_tilesTextures.size(), - m_tilesTextures.size() * LAYER_TILE_WIDTH * LAYER_TILE_HEIGHT * 4 / 1024 / 1024); + m_tilesTextures.size() * tileWidth() * tileHeight() * 4 / 1024 / 1024); } void TilesManager::discardTextures(bool allTextures, bool glTextures) @@ -432,16 +430,6 @@ float TilesManager::tileHeight() return TILE_HEIGHT; } -float TilesManager::layerTileWidth() -{ - return LAYER_TILE_WIDTH; -} - -float TilesManager::layerTileHeight() -{ - return LAYER_TILE_HEIGHT; -} - TilesManager* TilesManager::instance() { if (!gInstance) { diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h index eed99c2..05fc1af 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.h +++ b/Source/WebCore/platform/graphics/android/TilesManager.h @@ -88,8 +88,6 @@ public: void setMaxLayerTextureCount(int max); static float tileWidth(); static float tileHeight(); - static float layerTileWidth(); - static float layerTileHeight(); void allocateTiles(); |