Merge pull request #19669 from timvandermeij/icc-colorspace-404
Don't get ICC color space files if required API options are missing
This commit is contained in:
commit
e738566900
@ -289,7 +289,7 @@ class ColorSpaceUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static get cmyk() {
|
static get cmyk() {
|
||||||
if (IccColorSpace.isUsable) {
|
if (CmykICCBasedCS.isUsable) {
|
||||||
try {
|
try {
|
||||||
return shadow(this, "cmyk", new CmykICCBasedCS());
|
return shadow(this, "cmyk", new CmykICCBasedCS());
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@ -130,11 +130,15 @@ class IccColorSpace extends ColorSpace {
|
|||||||
static get isUsable() {
|
static get isUsable() {
|
||||||
let isUsable = false;
|
let isUsable = false;
|
||||||
if (this.#useWasm) {
|
if (this.#useWasm) {
|
||||||
try {
|
if (this.#wasmUrl) {
|
||||||
this._module = QCMS._module = this.#load();
|
try {
|
||||||
isUsable = !!this._module;
|
this._module = QCMS._module = this.#load();
|
||||||
} catch (e) {
|
isUsable = !!this._module;
|
||||||
warn(`ICCBased color space: "${e}".`);
|
} catch (e) {
|
||||||
|
warn(`ICCBased color space: "${e}".`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
warn("No ICC color space support due to missing `wasmUrl` API option");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +173,19 @@ class CmykICCBasedCS extends IccColorSpace {
|
|||||||
static setOptions({ iccUrl }) {
|
static setOptions({ iccUrl }) {
|
||||||
this.#iccUrl = iccUrl;
|
this.#iccUrl = iccUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get isUsable() {
|
||||||
|
let isUsable = false;
|
||||||
|
if (IccColorSpace.isUsable) {
|
||||||
|
if (this.#iccUrl) {
|
||||||
|
isUsable = true;
|
||||||
|
} else {
|
||||||
|
warn("No CMYK ICC profile support due to missing `iccUrl` API option");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return shadow(this, "isUsable", isUsable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { CmykICCBasedCS, IccColorSpace };
|
export { CmykICCBasedCS, IccColorSpace };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user