@lightningjs/renderer
Advanced tools
Comparing version 2.9.1 to 2.9.2
@@ -55,1 +55,2 @@ export declare const PROTOCOL_REGEX: RegExp; | ||
export declare function convertUrlToAbsolute(url: string): string; | ||
export declare function isBase64Image(src: string): boolean; |
@@ -215,2 +215,5 @@ /* | ||
} | ||
export function isBase64Image(src) { | ||
return src.startsWith('data:') === true; | ||
} | ||
//# sourceMappingURL=utils.js.map |
@@ -77,5 +77,6 @@ /* | ||
assertTruthy(textureType, 'Texture type is not defined'); | ||
// The Canvas2D renderer only supports image and color textures | ||
// The Canvas2D renderer only supports image and color textures and subTexture images | ||
if (textureType !== TextureType.image && | ||
textureType !== TextureType.color) { | ||
textureType !== TextureType.color && | ||
textureType !== TextureType.subTexture) { | ||
return; | ||
@@ -131,3 +132,5 @@ } | ||
} | ||
if (textureType === TextureType.image && ctxTexture) { | ||
if ((textureType === TextureType.image || | ||
textureType === TextureType.subTexture) && | ||
ctxTexture) { | ||
const image = ctxTexture.getImage(color); | ||
@@ -134,0 +137,0 @@ ctx.globalAlpha = color.a ?? alpha; |
@@ -21,3 +21,3 @@ /* | ||
import { isCompressedTextureContainer, loadCompressedTexture, } from '../lib/textureCompression.js'; | ||
import { convertUrlToAbsolute } from '../lib/utils.js'; | ||
import { convertUrlToAbsolute, isBase64Image } from '../lib/utils.js'; | ||
import { isSvgImage, loadSvg } from '../lib/textureSvg.js'; | ||
@@ -50,3 +50,3 @@ /** | ||
const img = new Image(); | ||
if (!src.startsWith('data:')) { | ||
if (isBase64Image(src) === false) { | ||
img.crossOrigin = 'anonymous'; | ||
@@ -102,3 +102,4 @@ } | ||
if (this.txManager.hasCreateImageBitmap === true) { | ||
if (this.txManager.hasWorker === true && | ||
if (isBase64Image(src) === false && | ||
this.txManager.hasWorker === true && | ||
this.txManager.imageWorkerManager !== null) { | ||
@@ -105,0 +106,0 @@ return this.txManager.imageWorkerManager.getImage(src, premultiplyAlpha, sx, sy, sw, sh); |
{ | ||
"name": "@lightningjs/renderer", | ||
"version": "2.9.1", | ||
"version": "2.9.2", | ||
"description": "Lightning 3 Renderer", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -307,1 +307,5 @@ /* | ||
} | ||
export function isBase64Image(src: string) { | ||
return src.startsWith('data:') === true; | ||
} |
@@ -125,6 +125,7 @@ /* | ||
// The Canvas2D renderer only supports image and color textures | ||
// The Canvas2D renderer only supports image and color textures and subTexture images | ||
if ( | ||
textureType !== TextureType.image && | ||
textureType !== TextureType.color | ||
textureType !== TextureType.color && | ||
textureType !== TextureType.subTexture | ||
) { | ||
@@ -189,3 +190,7 @@ return; | ||
if (textureType === TextureType.image && ctxTexture) { | ||
if ( | ||
(textureType === TextureType.image || | ||
textureType === TextureType.subTexture) && | ||
ctxTexture | ||
) { | ||
const image = ctxTexture.getImage(color); | ||
@@ -192,0 +197,0 @@ ctx.globalAlpha = color.a ?? alpha; |
@@ -26,3 +26,3 @@ /* | ||
} from '../lib/textureCompression.js'; | ||
import { convertUrlToAbsolute } from '../lib/utils.js'; | ||
import { convertUrlToAbsolute, isBase64Image } from '../lib/utils.js'; | ||
import { isSvgImage, loadSvg } from '../lib/textureSvg.js'; | ||
@@ -139,3 +139,3 @@ | ||
if (!src.startsWith('data:')) { | ||
if (isBase64Image(src) === false) { | ||
img.crossOrigin = 'anonymous'; | ||
@@ -211,2 +211,3 @@ } | ||
if ( | ||
isBase64Image(src) === false && | ||
this.txManager.hasWorker === true && | ||
@@ -213,0 +214,0 @@ this.txManager.imageWorkerManager !== null |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1958120
43165