Fixed issued that caused flicker when using the new LegacyTileSource! Also improves performance for dzi's and other tiled images since the issue was actually in the Drawer and a result of a mistake during the refactor. This is awesome imho! Please check out the new example page to see it in action.

This commit is contained in:
thatcher 2012-02-23 07:18:28 -05:00
parent 3619ff7930
commit 1a7c96732f
3 changed files with 100 additions and 84 deletions

View File

@ -6,7 +6,7 @@
PROJECT: openseadragon
BUILD_MAJOR: 0
BUILD_MINOR: 9
BUILD_ID: 11
BUILD_ID: 12
BUILD: ${PROJECT}.${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}

View File

@ -1,5 +1,5 @@
/**
* @version OpenSeadragon 0.9.11
* @version OpenSeadragon 0.9.12
*
* @fileOverview
* <h2>
@ -5261,7 +5261,7 @@ $.Drawer.prototype = {
image,
jobid,
complete;
if ( !this.config.imageLoaderLimit ||
this.downloading < this.config.imageLoaderLimit ) {
@ -5314,6 +5314,7 @@ $.Drawer.prototype = {
* why there are so many TODO's inside this function.
*/
function updateViewport( drawer ) {
drawer.updateAgain = false;
var tile,
@ -5342,7 +5343,13 @@ function updateViewport( drawer ) {
Math.log( zeroRatioC / MIN_PIXEL_RATIO ) /
Math.log( 2 )
)
);
),
renderPixelRatioC,
renderPixelRatioT,
zeroRatioT,
optimalRatio,
levelOpacity,
levelVisibility;
//TODO
while ( drawer.lastDrawn.length > 0 ) {
@ -5384,11 +5391,47 @@ function updateViewport( drawer ) {
//TODO
for ( level = highestLevel; level >= lowestLevel; level-- ) {
//Avoid calculations for draw if we have already drawn this
renderPixelRatioC = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( level ),
true
).x;
if ( ( !haveDrawn && renderPixelRatioC >= MIN_PIXEL_RATIO ) ||
( level == lowestLevel ) ) {
drawLevel = true;
haveDrawn = true;
} else if ( !haveDrawn ) {
continue;
}
renderPixelRatioT = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( level ),
false
).x;
zeroRatioT = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( 0 ),
false
).x;
optimalRatio = drawer.config.immediateRender ?
1 :
zeroRatioT;
levelOpacity = Math.min( 1, ( renderPixelRatioC - 0.5 ) / 0.5 );
levelVisibility = optimalRatio / Math.abs(
optimalRatio - renderPixelRatioT
);
//TODO
best = updateLevel(
drawer,
haveDrawn,
level,
lowestLevel,
levelOpacity,
levelVisibility,
viewportTL,
viewportBR,
currentTime,
@ -5414,55 +5457,20 @@ function updateViewport( drawer ) {
};
function updateLevel( drawer, level, lowestLevel, viewportTL, viewportBR, currentTime, best ){
function updateLevel( drawer, haveDrawn, level, levelOpacity, levelVisibility, viewportTL, viewportBR, currentTime, best ){
var x, y,
tileTL,
tileBR,
numberOfTiles,
levelOpacity,
levelVisibility,
renderPixelRatioC,
renderPixelRatioT,
haveDrawn = false,
drawLevel = false,
viewportCenter = drawer.viewport.pixelFromPoint( drawer.viewport.getCenter() ),
zeroRatioT = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( 0 ),
false
).x,
optimalRatio = drawer.config.immediateRender ?
1 :
zeroRatioT;
viewportCenter = drawer.viewport.pixelFromPoint( drawer.viewport.getCenter() );
//Avoid calculations for draw if we have already drawn this
renderPixelRatioC = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( level ),
true
).x;
if ( ( !haveDrawn && renderPixelRatioC >= MIN_PIXEL_RATIO ) ||
( level == lowestLevel ) ) {
drawLevel = true;
haveDrawn = true;
} else if ( !haveDrawn ) {
return best;
}
//OK, a new drawing so do your calculations
tileTL = drawer.source.getTileAtPoint( level, viewportTL );
tileBR = drawer.source.getTileAtPoint( level, viewportBR );
numberOfTiles = drawer.source.getNumTiles( level );
renderPixelRatioT = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( level ),
false
).x;
levelOpacity = Math.min( 1, ( renderPixelRatioC - 0.5 ) / 0.5 );
levelVisibility = optimalRatio / Math.abs(
optimalRatio - renderPixelRatioT
);
resetCoverage( drawer.coverage, level );
if ( !drawer.config.wrapHorizontal ) {

View File

@ -225,7 +225,7 @@ $.Drawer.prototype = {
image,
jobid,
complete;
if ( !this.config.imageLoaderLimit ||
this.downloading < this.config.imageLoaderLimit ) {
@ -278,6 +278,7 @@ $.Drawer.prototype = {
* why there are so many TODO's inside this function.
*/
function updateViewport( drawer ) {
drawer.updateAgain = false;
var tile,
@ -306,7 +307,13 @@ function updateViewport( drawer ) {
Math.log( zeroRatioC / MIN_PIXEL_RATIO ) /
Math.log( 2 )
)
);
),
renderPixelRatioC,
renderPixelRatioT,
zeroRatioT,
optimalRatio,
levelOpacity,
levelVisibility;
//TODO
while ( drawer.lastDrawn.length > 0 ) {
@ -348,11 +355,47 @@ function updateViewport( drawer ) {
//TODO
for ( level = highestLevel; level >= lowestLevel; level-- ) {
//Avoid calculations for draw if we have already drawn this
renderPixelRatioC = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( level ),
true
).x;
if ( ( !haveDrawn && renderPixelRatioC >= MIN_PIXEL_RATIO ) ||
( level == lowestLevel ) ) {
drawLevel = true;
haveDrawn = true;
} else if ( !haveDrawn ) {
continue;
}
renderPixelRatioT = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( level ),
false
).x;
zeroRatioT = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( 0 ),
false
).x;
optimalRatio = drawer.config.immediateRender ?
1 :
zeroRatioT;
levelOpacity = Math.min( 1, ( renderPixelRatioC - 0.5 ) / 0.5 );
levelVisibility = optimalRatio / Math.abs(
optimalRatio - renderPixelRatioT
);
//TODO
best = updateLevel(
drawer,
haveDrawn,
level,
lowestLevel,
levelOpacity,
levelVisibility,
viewportTL,
viewportBR,
currentTime,
@ -378,55 +421,20 @@ function updateViewport( drawer ) {
};
function updateLevel( drawer, level, lowestLevel, viewportTL, viewportBR, currentTime, best ){
function updateLevel( drawer, haveDrawn, level, levelOpacity, levelVisibility, viewportTL, viewportBR, currentTime, best ){
var x, y,
tileTL,
tileBR,
numberOfTiles,
levelOpacity,
levelVisibility,
renderPixelRatioC,
renderPixelRatioT,
haveDrawn = false,
drawLevel = false,
viewportCenter = drawer.viewport.pixelFromPoint( drawer.viewport.getCenter() ),
zeroRatioT = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( 0 ),
false
).x,
optimalRatio = drawer.config.immediateRender ?
1 :
zeroRatioT;
viewportCenter = drawer.viewport.pixelFromPoint( drawer.viewport.getCenter() );
//Avoid calculations for draw if we have already drawn this
renderPixelRatioC = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( level ),
true
).x;
if ( ( !haveDrawn && renderPixelRatioC >= MIN_PIXEL_RATIO ) ||
( level == lowestLevel ) ) {
drawLevel = true;
haveDrawn = true;
} else if ( !haveDrawn ) {
return best;
}
//OK, a new drawing so do your calculations
tileTL = drawer.source.getTileAtPoint( level, viewportTL );
tileBR = drawer.source.getTileAtPoint( level, viewportBR );
numberOfTiles = drawer.source.getNumTiles( level );
renderPixelRatioT = drawer.viewport.deltaPixelsFromPoints(
drawer.source.getPixelRatio( level ),
false
).x;
levelOpacity = Math.min( 1, ( renderPixelRatioC - 0.5 ) / 0.5 );
levelVisibility = optimalRatio / Math.abs(
optimalRatio - renderPixelRatioT
);
resetCoverage( drawer.coverage, level );
if ( !drawer.config.wrapHorizontal ) {