Compare commits

..

No commits in common. "6243afa85e4639da6435c075913512f6bfbdd291" and "92d7b6d09f13172bba0bffb452d52be89b7ed365" have entirely different histories.

4 changed files with 20 additions and 35 deletions

View File

@ -480,6 +480,7 @@ pdfjs-editor-new-alt-text-error-close-button = Close
# Variables: # Variables:
# $totalSize (Number) - the total size (in MB) of the AI model. # $totalSize (Number) - the total size (in MB) of the AI model.
# $downloadedSize (Number) - the downloaded size (in MB) of the AI model. # $downloadedSize (Number) - the downloaded size (in MB) of the AI model.
# $percent (Number) - the percentage of the downloaded size.
pdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB) pdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)
.aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB) .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)

View File

@ -28,17 +28,6 @@ import { shadow, warn } from "../shared/util.js";
import { ColorSpace } from "./colorspace.js"; import { ColorSpace } from "./colorspace.js";
import { QCMS } from "../../external/qcms/qcms_utils.js"; import { QCMS } from "../../external/qcms/qcms_utils.js";
function fetchSync(url) {
// Parsing and using color spaces is still synchronous,
// so we must load the wasm module synchronously.
// TODO: Make the color space stuff asynchronous and use fetch.
const xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
xhr.responseType = "arraybuffer";
xhr.send(null);
return xhr.response;
}
class IccColorSpace extends ColorSpace { class IccColorSpace extends ColorSpace {
#transformer; #transformer;
@ -143,9 +132,7 @@ class IccColorSpace extends ColorSpace {
if (this.#useWasm) { if (this.#useWasm) {
if (this.#wasmUrl) { if (this.#wasmUrl) {
try { try {
this._module = QCMS._module = initSync({ this._module = QCMS._module = this.#load();
module: fetchSync(`${this.#wasmUrl}qcms_bg.wasm`),
});
isUsable = !!this._module; isUsable = !!this._module;
} catch (e) { } catch (e) {
warn(`ICCBased color space: "${e}".`); warn(`ICCBased color space: "${e}".`);
@ -157,16 +144,30 @@ class IccColorSpace extends ColorSpace {
return shadow(this, "isUsable", isUsable); return shadow(this, "isUsable", isUsable);
} }
static #load() {
// Parsing and using color spaces is still synchronous,
// so we must load the wasm module synchronously.
// TODO: Make the color space stuff asynchronous and use fetch.
const filename = "qcms_bg.wasm";
const xhr = new XMLHttpRequest();
xhr.open("GET", `${this.#wasmUrl}${filename}`, false);
xhr.responseType = "arraybuffer";
xhr.send(null);
return initSync({ module: xhr.response });
}
} }
class CmykICCBasedCS extends IccColorSpace { class CmykICCBasedCS extends IccColorSpace {
static #iccUrl; static #iccUrl;
constructor() { constructor() {
const iccProfile = new Uint8Array( const filename = "CGATS001Compat-v2-micro.icc";
fetchSync(`${CmykICCBasedCS.#iccUrl}CGATS001Compat-v2-micro.icc`) const xhr = new XMLHttpRequest();
); xhr.open("GET", `${CmykICCBasedCS.#iccUrl}${filename}`, false);
super(iccProfile, "DeviceCMYK", 4); xhr.responseType = "arraybuffer";
xhr.send(null);
super(new Uint8Array(xhr.response), "DeviceCMYK", 4);
} }
static setOptions({ iccUrl }) { static setOptions({ iccUrl }) {

View File

@ -15,7 +15,6 @@
import { assert, BaseException, warn } from "../shared/util.js"; import { assert, BaseException, warn } from "../shared/util.js";
import { ColorSpaceUtils } from "./colorspace_utils.js"; import { ColorSpaceUtils } from "./colorspace_utils.js";
import { DeviceCmykCS } from "./colorspace.js";
import { grayToRGBA } from "../shared/image_utils.js"; import { grayToRGBA } from "../shared/image_utils.js";
import { readUint16 } from "./core_utils.js"; import { readUint16 } from "./core_utils.js";
@ -1350,13 +1349,6 @@ class JpegImage {
_convertCmykToRgba(data) { _convertCmykToRgba(data) {
ColorSpaceUtils.cmyk.getRgbBuffer(data, 0, data.length / 4, data, 0, 8, 1); ColorSpaceUtils.cmyk.getRgbBuffer(data, 0, data.length / 4, data, 0, 8, 1);
if (ColorSpaceUtils.cmyk instanceof DeviceCmykCS) {
// The alpha-component isn't updated by `DeviceCmykCS`, doing it manually.
for (let i = 3, ii = data.length; i < ii; i += 4) {
data[i] = 255;
}
}
return data; return data;
} }

View File

@ -2960,15 +2960,6 @@
"rounds": 1, "rounds": 1,
"type": "eq" "type": "eq"
}, },
{
"id": "cmykjpeg_nowasm",
"file": "pdfs/cmykjpeg.pdf",
"md5": "85d162b48ce98503a382d96f574f70a2",
"link": false,
"rounds": 1,
"type": "eq",
"useWasm": false
},
{ {
"id": "issue4402_reduced", "id": "issue4402_reduced",
"file": "pdfs/issue4402_reduced.pdf", "file": "pdfs/issue4402_reduced.pdf",