mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-07 10:29:23 +03:00
fix: reference to the cpuData on webgldrawer
This commit is contained in:
parent
c06e719198
commit
a5c569ab5d
@ -161,7 +161,7 @@ OpenSeadragon.DrawerBase = class DrawerBase{
|
||||
$.console.warn("Attempt to draw tile %s when not cached!", tile);
|
||||
return undefined;
|
||||
}
|
||||
const dataCache = cache.getDataForRendering(this, tile);
|
||||
const dataCache = cache.getCacheForRendering(this, tile);
|
||||
return dataCache && dataCache.data;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@
|
||||
* Returns undefined if the data is not ready for rendering.
|
||||
* @private
|
||||
*/
|
||||
getDataForRendering(drawer, tileToDraw) {
|
||||
getCacheForRendering(drawer, tileToDraw) {
|
||||
const supportedTypes = drawer.getSupportedDataFormats(),
|
||||
keepInternalCopy = drawer.options.usePrivateCache;
|
||||
if (this.loaded && supportedTypes.includes(this.type)) {
|
||||
@ -264,7 +264,7 @@
|
||||
|
||||
const conversionPath = $.convertor.getConversionPath(this.type, supportedTypes);
|
||||
if (!conversionPath) {
|
||||
$.console.error(`[getDataForRendering] Conversion ${this.type} ---> ${supportedTypes} cannot be done!`);
|
||||
$.console.error(`[getCacheForRendering] Conversion ${this.type} ---> ${supportedTypes} cannot be done!`);
|
||||
return $.Promise.resolve(this);
|
||||
}
|
||||
const newInternalCache = new $.SimpleCacheRecord();
|
||||
|
@ -100,9 +100,9 @@
|
||||
this._setupCanvases();
|
||||
this._setupRenderer();
|
||||
|
||||
this._setupCallCount = 1;
|
||||
this._supportedFormats = this._setupTextureHandlers();
|
||||
this._requiredFormats = this._supportedFormats;
|
||||
this._setupCallCount = 1;
|
||||
|
||||
this.context = this._outputContext; // API required by tests
|
||||
}
|
||||
@ -249,7 +249,7 @@
|
||||
}
|
||||
const dataCache = cache.getDataForRendering(this, tile);
|
||||
// Use CPU Data for the drawer instead
|
||||
return dataCache && dataCache.cpuData;
|
||||
return dataCache && dataCache.data.cpuData.getContext("2d");
|
||||
};
|
||||
}
|
||||
|
||||
@ -950,7 +950,7 @@
|
||||
return {
|
||||
texture: texture,
|
||||
position: position,
|
||||
cpuData: data // Reference to the outer cache data, used to draw if webgl canont be used
|
||||
cpuData: data
|
||||
};
|
||||
};
|
||||
const tex2DCompatibleDestructor = textureInfo => {
|
||||
@ -967,10 +967,12 @@
|
||||
// We should be OK uploading any of these types. The complexity is selected to be O(3n), should be
|
||||
// more than linear pass over pixels
|
||||
$.convertor.learn("context2d", c2dTexType, (t, d) => tex2DCompatibleLoader(t, d.canvas), 1, 3);
|
||||
$.convertor.learn("image", imageTexType, tex2DCompatibleLoader, 1, 3);
|
||||
// TODO: lost support for image
|
||||
// $.convertor.learn("image", imageTexType, tex2DCompatibleLoader, 1, 3);
|
||||
|
||||
$.convertor.learnDestroy(c2dTexType, tex2DCompatibleDestructor);
|
||||
$.convertor.learnDestroy(imageTexType, tex2DCompatibleDestructor);
|
||||
// TODO
|
||||
// $.convertor.learnDestroy(imageTexType, tex2DCompatibleDestructor);
|
||||
return [c2dTexType, imageTexType];
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@
|
||||
const cache = tile.getCache();
|
||||
test.equal(cache.type, T_A, "Cache data was not affected, the drawer uses internal cache.");
|
||||
|
||||
const internalCache = cache.getDataForRendering(drawer, tile);
|
||||
const internalCache = cache.getCacheForRendering(drawer, tile);
|
||||
test.equal(internalCache.type, T_C, "Conversion A->C ready, since there is no way to get to T_E.");
|
||||
test.ok(internalCache.loaded, "Internal cache ready.");
|
||||
}
|
||||
@ -424,7 +424,7 @@
|
||||
test.equal(cache.type, T_C, "Main Cache Updated (suite 1)");
|
||||
test.equal(cache.data, previousTestValue, "Main Cache Updated (suite 1)");
|
||||
|
||||
const internalCache = cache.getDataForRendering(drawer, tile);
|
||||
const internalCache = cache.getCacheForRendering(drawer, tile);
|
||||
test.equal(T_C, internalCache.type, "Conversion A->C ready, since there is no way to get to T_E.");
|
||||
test.ok(internalCache.loaded, "Internal cache ready.");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user