diff --git a/src/drawerbase.js b/src/drawerbase.js index d7511668..01646c90 100644 --- a/src/drawerbase.js +++ b/src/drawerbase.js @@ -39,12 +39,12 @@ * @memberOf OpenSeadragon * @property {boolean} [usePrivateCache=false] specify whether the drawer should use * detached (=internal) cache object in case it has to perform custom type conversion atop - * what cache performs. In that case, drawer must implement dataCreate() which gets data in one + * what cache performs. In that case, drawer must implement internalCacheCreate() which gets data in one * of formats the drawer declares as supported. This method must return object to be used during drawing. - * You should probably implement also dataFree() to provide cleanup logics. + * You should probably implement also internalCacheFree() to provide cleanup logics. * * @property {boolean} [preloadCache=true] - * When dataCreate is used, it can be applied offline (asynchronously) during data processing = preloading, + * When internalCacheCreate is used, it can be applied offline (asynchronously) during data processing = preloading, * or just in time before rendering (if necessary). Preloading supports */ @@ -93,7 +93,7 @@ OpenSeadragon.DrawerBase = class DrawerBase{ this.container.appendChild( this.canvas ); this._checkInterfaceImplementation(); - this.setDataNeedsRefresh(); // initializes stamp + this.setInternalCacheNeedsRefresh(); // initializes stamp } /** @@ -219,7 +219,7 @@ OpenSeadragon.DrawerBase = class DrawerBase{ /** * Destroy internal cache. Should be called within destroy() when * usePrivateCache is set to true. Ensures cleanup of anything created - * by dataCreate(...). + * by internalCacheCreate(...). */ destroyInternalCache() { this.viewer.tileCache.clearDrawerInternalCache(this); @@ -264,14 +264,14 @@ OpenSeadragon.DrawerBase = class DrawerBase{ * @param {OpenSeadragon.Tile} tile * @return any */ - dataCreate(cache, tile) {} + internalCacheCreate(cache, tile) {} /** * It is possible to perform any necessary cleanup on internal cache, necessary if you * need to clean up some memory (e.g. destroy canvas by setting with & height to 0). - * @param {*} data object returned by dataCreate(...) + * @param {*} data object returned by internalCacheCreate(...) */ - dataFree(data) {} + internalCacheFree(data) {} /** * Call to invalidate internal cache. It will be rebuilt. With synchronous converions, @@ -279,7 +279,7 @@ OpenSeadragon.DrawerBase = class DrawerBase{ * routine happens, e.g. you should call also requestInvalidate() if you need to happen * it as soon as possible. */ - setDataNeedsRefresh() { + setInternalCacheNeedsRefresh() { this._dataNeedsRefresh = $.now(); } diff --git a/src/tilecache.js b/src/tilecache.js index 00410a35..2f8b9335 100644 --- a/src/tilecache.js +++ b/src/tilecache.js @@ -279,11 +279,11 @@ } $.console.assert(this._tRef, "Data Create called from invalidation routine needs tile reference!"); - const transformedData = drawer.dataCreate(this, this._tRef); - $.console.assert(transformedData !== undefined, "[DrawerBase.dataCreate] must return a value if usePrivateCache is enabled!"); + const transformedData = drawer.internalCacheCreate(this, this._tRef); + $.console.assert(transformedData !== undefined, "[DrawerBase.internalCacheCreate] must return a value if usePrivateCache is enabled!"); const drawerID = drawer.getId(); internalCache = this[DRAWER_INTERNAL_CACHE][drawerID] = new $.InternalCacheRecord(transformedData, - drawerID, (data) => drawer.dataFree(data)); + drawerID, (data) => drawer.internalCacheFree(data)); return internalCache.await(); } @@ -307,12 +307,12 @@ } $.console.assert(this._tRef, "Data Create called from drawing loop needs tile reference!"); - const transformedData = drawer.dataCreate(this, this._tRef); - $.console.assert(transformedData !== undefined, "[DrawerBase.dataCreate] must return a value if usePrivateCache is enabled!"); + const transformedData = drawer.internalCacheCreate(this, this._tRef); + $.console.assert(transformedData !== undefined, "[DrawerBase.internalCacheCreate] must return a value if usePrivateCache is enabled!"); const drawerID = drawer.getId(); internalCache = this[DRAWER_INTERNAL_CACHE][drawerID] = new $.InternalCacheRecord(transformedData, - drawerID, (data) => drawer.dataFree(data)); + drawerID, (data) => drawer.internalCacheFree(data)); return internalCache; } diff --git a/src/webgldrawer.js b/src/webgldrawer.js index 3dfff944..98769180 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -479,7 +479,7 @@ setImageSmoothingEnabled(enabled){ if( this._imageSmoothingEnabled !== enabled ){ this._imageSmoothingEnabled = enabled; - this.setDataNeedsRefresh(); + this.setInternalCacheNeedsRefresh(); this.viewer.forceRedraw(); } } @@ -863,7 +863,7 @@ this.viewer.addHandler("resize", this._resizeHandler); } - dataCreate(cache, tile) { + internalCacheCreate(cache, tile) { let tiledImage = tile.tiledImage; let gl = this._gl; let texture; @@ -876,7 +876,7 @@ tiledImage.setTainted(true); $.console.warn('WebGL cannot be used to draw this TiledImage because it has tainted data. Does crossOriginPolicy need to be set?'); this._raiseDrawerErrorEvent(tiledImage, 'Tainted data cannot be used by the WebGLDrawer. Falling back to CanvasDrawer for this TiledImage.'); - this.setDataNeedsRefresh(); + this.setInternalCacheNeedsRefresh(); } else { let sourceWidthFraction, sourceHeightFraction; if (tile.sourceBounds) { @@ -929,7 +929,7 @@ tiledImage.setTainted(true); $.console.error('Error uploading image data to WebGL. Falling back to canvas renderer.', e); this._raiseDrawerErrorEvent(tiledImage, 'Unknown error when uploading texture. Falling back to CanvasDrawer for this TiledImage.'); - this.setDataNeedsRefresh(); + this.setInternalCacheNeedsRefresh(); } } } @@ -948,7 +948,7 @@ return {}; } - dataFree(data) { + internalCacheFree(data) { if (data && data.texture) { this._gl.deleteTexture(data.texture); data.texture = null;