diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 93c3406..0d223a8 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -683,6 +683,10 @@ { image.crossOrigin = determineCrossOrigin(imageUrl); } + else if (crossorigin) + { + image.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; + } baseTexture = new BaseTexture(image, scaleMode); baseTexture.imageUrl = imageUrl; diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index 93c3406..0d223a8 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -683,6 +683,10 @@ { image.crossOrigin = determineCrossOrigin(imageUrl); } + else if (crossorigin) + { + image.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; + } baseTexture = new BaseTexture(image, scaleMode); baseTexture.imageUrl = imageUrl; diff --git a/test/core/BaseTexture.js b/test/core/BaseTexture.js index e99de40..703175d 100644 --- a/test/core/BaseTexture.js +++ b/test/core/BaseTexture.js @@ -102,11 +102,20 @@ expect(PIXI.utils.BaseTextureCache[NAME2]).to.equal(baseTexture); }); - it('destroying a destroyed BaseTexture should not throw an error', function () + it('should not throw an error destroying a destroyed BaseTexture', function () { const baseTexture = new PIXI.BaseTexture(); baseTexture.destroy(); baseTexture.destroy(); }); + + it('should set source.crossOrigin to anonymous if explicitly set', function () + { + cleanCache(); + + const baseTexture = PIXI.BaseTexture.fromImage(URL, true); + + expect(baseTexture.source.crossOrigin).to.equal('anonymous'); + }); });