зеркало из https://github.com/mozilla/gecko-dev.git
Bug 539062 - Less checkerboarding [r=vingtetun,froystig] [and stuart's cool with it too]
This commit is contained in:
Родитель
1377209264
Коммит
26e3aa6b87
|
@ -164,6 +164,10 @@ TileManager.prototype = {
|
||||||
if (criticalRect.isEmpty() || !criticalRect.equals(this._criticalRect)) {
|
if (criticalRect.isEmpty() || !criticalRect.equals(this._criticalRect)) {
|
||||||
this.beginCriticalMove(criticalRect);
|
this.beginCriticalMove(criticalRect);
|
||||||
this.endCriticalMove(criticalRect, !(dirtyAll || boundsSizeChanged));
|
this.endCriticalMove(criticalRect, !(dirtyAll || boundsSizeChanged));
|
||||||
|
} else {
|
||||||
|
// The critical rect hasn't changed, but there are possibly more tiles lounging about offscreen,
|
||||||
|
// waiting to be rendered. Make sure crawler knows about them.
|
||||||
|
this.recenterCrawler();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirtyAll) {
|
if (dirtyAll) {
|
||||||
|
@ -266,6 +270,7 @@ TileManager.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
dirtyRects: function dirtyRects(rects, doCriticalRender) {
|
dirtyRects: function dirtyRects(rects, doCriticalRender) {
|
||||||
|
let outsideIsDirty = false;
|
||||||
let criticalIsDirty = false;
|
let criticalIsDirty = false;
|
||||||
let criticalRect = this._criticalRect;
|
let criticalRect = this._criticalRect;
|
||||||
let tc = this._tileCache;
|
let tc = this._tileCache;
|
||||||
|
@ -276,21 +281,25 @@ TileManager.prototype = {
|
||||||
|
|
||||||
BEGIN_FOREACH_IN_RECT(rect, tc, tile)
|
BEGIN_FOREACH_IN_RECT(rect, tc, tile)
|
||||||
|
|
||||||
if (!tile.boundRect.intersects(criticalRect))
|
if (!tile.boundRect.intersects(criticalRect)) {
|
||||||
|
// Dirty tile outside of viewport. Just remove and redraw later.
|
||||||
this._removeTileSafe(tile);
|
this._removeTileSafe(tile);
|
||||||
else
|
|
||||||
criticalIsDirty = true;
|
|
||||||
|
|
||||||
tile.markDirty(rects[i]);
|
|
||||||
|
|
||||||
if (crawler)
|
if (crawler)
|
||||||
crawler.enqueue(tile.i, tile.j);
|
crawler.enqueue(tile.i, tile.j);
|
||||||
|
outsideIsDirty = true;
|
||||||
|
} else {
|
||||||
|
criticalIsDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
tile.markDirty(rects[i]);
|
||||||
|
|
||||||
END_FOREACH_IN_RECT
|
END_FOREACH_IN_RECT
|
||||||
}
|
}
|
||||||
|
|
||||||
if (criticalIsDirty && doCriticalRender)
|
if (criticalIsDirty && doCriticalRender)
|
||||||
this.criticalRectPaint();
|
this.criticalRectPaint();
|
||||||
|
if (outsideIsDirty)
|
||||||
|
this.restartPrefetchCrawl();
|
||||||
},
|
},
|
||||||
|
|
||||||
criticalRectPaint: function criticalRectPaint() {
|
criticalRectPaint: function criticalRectPaint() {
|
||||||
|
@ -304,6 +313,7 @@ TileManager.prototype = {
|
||||||
if (!this._ctr.equals(ctr)) {
|
if (!this._ctr.equals(ctr)) {
|
||||||
this._ctr.set(ctr);
|
this._ctr.set(ctr);
|
||||||
this.recenterEvictionQueue(ctr);
|
this.recenterEvictionQueue(ctr);
|
||||||
|
this.recenterCrawler();
|
||||||
}
|
}
|
||||||
|
|
||||||
//let start = Date.now();
|
//let start = Date.now();
|
||||||
|
@ -364,9 +374,6 @@ TileManager.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
setPrefetch: function setPrefetch(prefetch) {
|
setPrefetch: function setPrefetch(prefetch) {
|
||||||
if (prefetch == this._prefetch)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this._prefetch = prefetch;
|
this._prefetch = prefetch;
|
||||||
if (prefetch)
|
if (prefetch)
|
||||||
this.restartPrefetchCrawl();
|
this.restartPrefetchCrawl();
|
||||||
|
@ -374,44 +381,18 @@ TileManager.prototype = {
|
||||||
this.stopPrefetchCrawl();
|
this.stopPrefetchCrawl();
|
||||||
},
|
},
|
||||||
|
|
||||||
restartPrefetchCrawl: function restartPrefetchCrawl(startRectOrQueue) {
|
restartPrefetchCrawl: function restartPrefetchCrawl() {
|
||||||
if (startRectOrQueue instanceof Array) {
|
if (this._prefetch && !this._idleTileCrawlerTimeout && this._crawler)
|
||||||
this._crawler = new TileManager.CrawlIterator(this._tileCache);
|
|
||||||
|
|
||||||
if (startRectOrQueue) {
|
|
||||||
for (let k = 0, len = startRectOrQueue.length; k < len; ++k)
|
|
||||||
this._crawler.enqueue(startRectOrQueue[k].i, startRectOrQueue[k].j);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let cr = this._criticalRect;
|
|
||||||
this._crawler = new TileManager.CrawlIterator(this._tileCache,
|
|
||||||
startRectOrQueue || (!cr.isEmpty() ? cr.clone() : null));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this._idleTileCrawlerTimeout)
|
|
||||||
this._idleTileCrawlerTimeout = setTimeout(this._idleTileCrawler, kTileCrawlComeAgain, this);
|
this._idleTileCrawlerTimeout = setTimeout(this._idleTileCrawler, kTileCrawlComeAgain, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
stopPrefetchCrawl: function stopPrefetchCrawl(skipRecenter) {
|
stopPrefetchCrawl: function stopPrefetchCrawl() {
|
||||||
if (this._idleTileCrawlerTimeout)
|
if (this._idleTileCrawlerTimeout)
|
||||||
clearTimeout(this._idleTileCrawlerTimeout);
|
clearTimeout(this._idleTileCrawlerTimeout);
|
||||||
delete this._idleTileCrawlerTimeout;
|
delete this._idleTileCrawlerTimeout;
|
||||||
this._crawler = null;
|
|
||||||
|
|
||||||
if (!skipRecenter) {
|
|
||||||
let cr = this._criticalRect;
|
|
||||||
if (!cr.isEmpty()) {
|
|
||||||
let ctr = cr.center().map(Math.round);
|
|
||||||
this.recenterEvictionQueue(ctr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
recenterEvictionQueue: function recenterEvictionQueue(ctr) {
|
recenterEvictionQueue: function recenterEvictionQueue(ctr) {
|
||||||
if (this._crawler) {
|
|
||||||
this.restartPrefetchCrawl();
|
|
||||||
}
|
|
||||||
|
|
||||||
let ctri = ctr.x >> kTileExponentWidth;
|
let ctri = ctr.x >> kTileExponentWidth;
|
||||||
let ctrj = ctr.y >> kTileExponentHeight;
|
let ctrj = ctr.y >> kTileExponentHeight;
|
||||||
|
|
||||||
|
@ -422,6 +403,12 @@ TileManager.prototype = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Crawler will recalculate the tiles it is supposed to fetch in the background. */
|
||||||
|
recenterCrawler: function recenterCrawler() {
|
||||||
|
let cr = this._criticalRect;
|
||||||
|
this._crawler = new TileManager.CrawlIterator(this._tileCache, cr.clone());
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a rect to the canvas under the given scale. We attempt to avoid a
|
* Render a rect to the canvas under the given scale. We attempt to avoid a
|
||||||
* drawWindow() by copying the image (via drawImage()) from cached tiles, we
|
* drawWindow() by copying the image (via drawImage()) from cached tiles, we
|
||||||
|
@ -513,9 +500,7 @@ TileManager.prototype = {
|
||||||
|
|
||||||
BEGIN_FORCREATE_IN_RECT(rect, tc, tile)
|
BEGIN_FORCREATE_IN_RECT(rect, tc, tile)
|
||||||
|
|
||||||
if (tile.isDirty())
|
|
||||||
this._renderTile(tile);
|
this._renderTile(tile);
|
||||||
|
|
||||||
this._appendTileSafe(tile);
|
this._appendTileSafe(tile);
|
||||||
this._tileCache.holdTile(tile);
|
this._tileCache.holdTile(tile);
|
||||||
|
|
||||||
|
@ -534,10 +519,8 @@ TileManager.prototype = {
|
||||||
comeAgain = false;
|
comeAgain = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (tile.isDirty()) {
|
|
||||||
self._renderTile(tile);
|
|
||||||
}
|
|
||||||
self._appendTileSafe(tile);
|
self._appendTileSafe(tile);
|
||||||
|
self._renderTile(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comeAgain) {
|
if (comeAgain) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче