first commit
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Types tests / Test (lts/*) (push) Has been cancelled
				
			
		
			
				
	
				Lint / Lint (lts/*) (push) Has been cancelled
				
			
		
			
				
	
				CodeQL / Analyze (javascript) (push) Has been cancelled
				
			
		
			
				
	
				CI / Test (20) (push) Has been cancelled
				
			
		
			
				
	
				CI / Test (22) (push) Has been cancelled
				
			
		
			
				
	
				CI / Test (24) (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	Types tests / Test (lts/*) (push) Has been cancelled
				
			Lint / Lint (lts/*) (push) Has been cancelled
				
			CodeQL / Analyze (javascript) (push) Has been cancelled
				
			CI / Test (20) (push) Has been cancelled
				
			CI / Test (22) (push) Has been cancelled
				
			CI / Test (24) (push) Has been cancelled
				
			This commit is contained in:
		
							
								
								
									
										22
									
								
								external/qcms/LICENSE_PDFJS_QCMS
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								external/qcms/LICENSE_PDFJS_QCMS
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
Copyright (c) 2025, Mozilla Foundation
 | 
			
		||||
 | 
			
		||||
Redistribution and use in source and binary forms, with or without
 | 
			
		||||
modification, are permitted provided that the following conditions are met:
 | 
			
		||||
 | 
			
		||||
1. Redistributions of source code must retain the above copyright notice, this
 | 
			
		||||
   list of conditions and the following disclaimer.
 | 
			
		||||
 | 
			
		||||
2. Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
   this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
   and/or other materials provided with the distribution.
 | 
			
		||||
 | 
			
		||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 | 
			
		||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 | 
			
		||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 | 
			
		||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 | 
			
		||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 | 
			
		||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 | 
			
		||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
			
		||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
							
								
								
									
										21
									
								
								external/qcms/LICENSE_QCMS
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								external/qcms/LICENSE_QCMS
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
qcms
 | 
			
		||||
Copyright (C) 2009-2024 Mozilla Corporation
 | 
			
		||||
Copyright (C) 1998-2007 Marti Maria
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining 
 | 
			
		||||
a copy of this software and associated documentation files (the "Software"), 
 | 
			
		||||
to deal in the Software without restriction, including without limitation 
 | 
			
		||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 | 
			
		||||
and/or sell copies of the Software, and to permit persons to whom the Software 
 | 
			
		||||
is furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in 
 | 
			
		||||
all copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
 | 
			
		||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
 | 
			
		||||
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
 | 
			
		||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 
 | 
			
		||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
 | 
			
		||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
 | 
			
		||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
							
								
								
									
										12
									
								
								external/qcms/README.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								external/qcms/README.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
## Build
 | 
			
		||||
 | 
			
		||||
In order to generate the files `qcms.js` and `qcms_bg.wasm`:
 | 
			
		||||
* git clone https://github.com/mozilla/pdf.js.qcms/
 | 
			
		||||
* the build requires to have a [Docker](https://www.docker.com/) setup and then:
 | 
			
		||||
  * `node build.js -C` to build the Docker image
 | 
			
		||||
  * `node build.js -co /pdf.js/external/qcms/` to compile the decoder
 | 
			
		||||
 | 
			
		||||
## Licensing
 | 
			
		||||
 | 
			
		||||
[qcms](https://github.com/FirefoxGraphics/qcms) is under [MIT](https://github.com/FirefoxGraphics/qcms/blob/main/COPYING)
 | 
			
		||||
and [pdf.js.qcms](https://github.com/mozilla/pdf.js.qcms/) is released under [MIT](https://github.com/mozilla/pdf.js.qcms/blob/main/LICENSE) license so `qcms.js` and `qcms_bg.wasm` are released under [MIT](https://github.com/mozilla/pdf.js.qcms/blob/main/LICENSE) license too.
 | 
			
		||||
							
								
								
									
										259
									
								
								external/qcms/qcms.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										259
									
								
								external/qcms/qcms.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,259 @@
 | 
			
		||||
/* THIS FILE IS GENERATED - DO NOT EDIT */
 | 
			
		||||
import { copy_result, copy_rgb, make_cssRGB } from './qcms_utils.js';
 | 
			
		||||
 | 
			
		||||
let wasm;
 | 
			
		||||
 | 
			
		||||
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
 | 
			
		||||
 | 
			
		||||
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
 | 
			
		||||
 | 
			
		||||
let cachedUint8ArrayMemory0 = null;
 | 
			
		||||
 | 
			
		||||
function getUint8ArrayMemory0() {
 | 
			
		||||
    if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
 | 
			
		||||
        cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
 | 
			
		||||
    }
 | 
			
		||||
    return cachedUint8ArrayMemory0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getStringFromWasm0(ptr, len) {
 | 
			
		||||
    ptr = ptr >>> 0;
 | 
			
		||||
    return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
let WASM_VECTOR_LEN = 0;
 | 
			
		||||
 | 
			
		||||
function passArray8ToWasm0(arg, malloc) {
 | 
			
		||||
    const ptr = malloc(arg.length * 1, 1) >>> 0;
 | 
			
		||||
    getUint8ArrayMemory0().set(arg, ptr / 1);
 | 
			
		||||
    WASM_VECTOR_LEN = arg.length;
 | 
			
		||||
    return ptr;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * # Safety
 | 
			
		||||
 *
 | 
			
		||||
 * This function is called directly from JavaScript.
 | 
			
		||||
 * @param {number} transformer
 | 
			
		||||
 * @param {Uint8Array} src
 | 
			
		||||
 */
 | 
			
		||||
export function qcms_convert_array(transformer, src) {
 | 
			
		||||
    const ptr0 = passArray8ToWasm0(src, wasm.__wbindgen_malloc);
 | 
			
		||||
    const len0 = WASM_VECTOR_LEN;
 | 
			
		||||
    wasm.qcms_convert_array(transformer, ptr0, len0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * # Safety
 | 
			
		||||
 *
 | 
			
		||||
 * This function is called directly from JavaScript.
 | 
			
		||||
 * @param {number} transformer
 | 
			
		||||
 * @param {number} src
 | 
			
		||||
 * @param {boolean} css
 | 
			
		||||
 */
 | 
			
		||||
export function qcms_convert_one(transformer, src, css) {
 | 
			
		||||
    wasm.qcms_convert_one(transformer, src, css);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * # Safety
 | 
			
		||||
 *
 | 
			
		||||
 * This function is called directly from JavaScript.
 | 
			
		||||
 * @param {number} transformer
 | 
			
		||||
 * @param {number} src1
 | 
			
		||||
 * @param {number} src2
 | 
			
		||||
 * @param {number} src3
 | 
			
		||||
 * @param {boolean} css
 | 
			
		||||
 */
 | 
			
		||||
export function qcms_convert_three(transformer, src1, src2, src3, css) {
 | 
			
		||||
    wasm.qcms_convert_three(transformer, src1, src2, src3, css);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * # Safety
 | 
			
		||||
 *
 | 
			
		||||
 * This function is called directly from JavaScript.
 | 
			
		||||
 * @param {number} transformer
 | 
			
		||||
 * @param {number} src1
 | 
			
		||||
 * @param {number} src2
 | 
			
		||||
 * @param {number} src3
 | 
			
		||||
 * @param {number} src4
 | 
			
		||||
 * @param {boolean} css
 | 
			
		||||
 */
 | 
			
		||||
export function qcms_convert_four(transformer, src1, src2, src3, src4, css) {
 | 
			
		||||
    wasm.qcms_convert_four(transformer, src1, src2, src3, src4, css);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * # Safety
 | 
			
		||||
 *
 | 
			
		||||
 * This function is called directly from JavaScript.
 | 
			
		||||
 * @param {Uint8Array} mem
 | 
			
		||||
 * @param {DataType} in_type
 | 
			
		||||
 * @param {Intent} intent
 | 
			
		||||
 * @returns {number}
 | 
			
		||||
 */
 | 
			
		||||
export function qcms_transformer_from_memory(mem, in_type, intent) {
 | 
			
		||||
    const ptr0 = passArray8ToWasm0(mem, wasm.__wbindgen_malloc);
 | 
			
		||||
    const len0 = WASM_VECTOR_LEN;
 | 
			
		||||
    const ret = wasm.qcms_transformer_from_memory(ptr0, len0, in_type, intent);
 | 
			
		||||
    return ret >>> 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * # Safety
 | 
			
		||||
 *
 | 
			
		||||
 * This function is called directly from JavaScript.
 | 
			
		||||
 * @param {number} transformer
 | 
			
		||||
 */
 | 
			
		||||
export function qcms_drop_transformer(transformer) {
 | 
			
		||||
    wasm.qcms_drop_transformer(transformer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @enum {0 | 1 | 2 | 3 | 4 | 5}
 | 
			
		||||
 */
 | 
			
		||||
export const DataType = Object.freeze({
 | 
			
		||||
    RGB8: 0, "0": "RGB8",
 | 
			
		||||
    RGBA8: 1, "1": "RGBA8",
 | 
			
		||||
    BGRA8: 2, "2": "BGRA8",
 | 
			
		||||
    Gray8: 3, "3": "Gray8",
 | 
			
		||||
    GrayA8: 4, "4": "GrayA8",
 | 
			
		||||
    CMYK: 5, "5": "CMYK",
 | 
			
		||||
});
 | 
			
		||||
/**
 | 
			
		||||
 * @enum {0 | 1 | 2 | 3}
 | 
			
		||||
 */
 | 
			
		||||
export const Intent = Object.freeze({
 | 
			
		||||
    Perceptual: 0, "0": "Perceptual",
 | 
			
		||||
    RelativeColorimetric: 1, "1": "RelativeColorimetric",
 | 
			
		||||
    Saturation: 2, "2": "Saturation",
 | 
			
		||||
    AbsoluteColorimetric: 3, "3": "AbsoluteColorimetric",
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
async function __wbg_load(module, imports) {
 | 
			
		||||
    if (typeof Response === 'function' && module instanceof Response) {
 | 
			
		||||
        if (typeof WebAssembly.instantiateStreaming === 'function') {
 | 
			
		||||
            try {
 | 
			
		||||
                return await WebAssembly.instantiateStreaming(module, imports);
 | 
			
		||||
 | 
			
		||||
            } catch (e) {
 | 
			
		||||
                if (module.headers.get('Content-Type') != 'application/wasm') {
 | 
			
		||||
                    console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
 | 
			
		||||
 | 
			
		||||
                } else {
 | 
			
		||||
                    throw e;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const bytes = await module.arrayBuffer();
 | 
			
		||||
        return await WebAssembly.instantiate(bytes, imports);
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
        const instance = await WebAssembly.instantiate(module, imports);
 | 
			
		||||
 | 
			
		||||
        if (instance instanceof WebAssembly.Instance) {
 | 
			
		||||
            return { instance, module };
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
            return instance;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function __wbg_get_imports() {
 | 
			
		||||
    const imports = {};
 | 
			
		||||
    imports.wbg = {};
 | 
			
		||||
    imports.wbg.__wbg_copyresult_b08ee7d273f295dd = function(arg0, arg1) {
 | 
			
		||||
        copy_result(arg0 >>> 0, arg1 >>> 0);
 | 
			
		||||
    };
 | 
			
		||||
    imports.wbg.__wbg_copyrgb_d60ce17bb05d9b67 = function(arg0) {
 | 
			
		||||
        copy_rgb(arg0 >>> 0);
 | 
			
		||||
    };
 | 
			
		||||
    imports.wbg.__wbg_makecssRGB_893bf0cd9fdb302d = function(arg0) {
 | 
			
		||||
        make_cssRGB(arg0 >>> 0);
 | 
			
		||||
    };
 | 
			
		||||
    imports.wbg.__wbindgen_init_externref_table = function() {
 | 
			
		||||
        const table = wasm.__wbindgen_export_0;
 | 
			
		||||
        const offset = table.grow(4);
 | 
			
		||||
        table.set(0, undefined);
 | 
			
		||||
        table.set(offset + 0, undefined);
 | 
			
		||||
        table.set(offset + 1, null);
 | 
			
		||||
        table.set(offset + 2, true);
 | 
			
		||||
        table.set(offset + 3, false);
 | 
			
		||||
        ;
 | 
			
		||||
    };
 | 
			
		||||
    imports.wbg.__wbindgen_throw = function(arg0, arg1) {
 | 
			
		||||
        throw new Error(getStringFromWasm0(arg0, arg1));
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    return imports;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function __wbg_init_memory(imports, memory) {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function __wbg_finalize_init(instance, module) {
 | 
			
		||||
    wasm = instance.exports;
 | 
			
		||||
    __wbg_init.__wbindgen_wasm_module = module;
 | 
			
		||||
    cachedUint8ArrayMemory0 = null;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    wasm.__wbindgen_start();
 | 
			
		||||
    return wasm;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function initSync(module) {
 | 
			
		||||
    if (wasm !== undefined) return wasm;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if (typeof module !== 'undefined') {
 | 
			
		||||
        if (Object.getPrototypeOf(module) === Object.prototype) {
 | 
			
		||||
            ({module} = module)
 | 
			
		||||
        } else {
 | 
			
		||||
            console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const imports = __wbg_get_imports();
 | 
			
		||||
 | 
			
		||||
    __wbg_init_memory(imports);
 | 
			
		||||
 | 
			
		||||
    if (!(module instanceof WebAssembly.Module)) {
 | 
			
		||||
        module = new WebAssembly.Module(module);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const instance = new WebAssembly.Instance(module, imports);
 | 
			
		||||
 | 
			
		||||
    return __wbg_finalize_init(instance, module);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function __wbg_init(module_or_path) {
 | 
			
		||||
    if (wasm !== undefined) return wasm;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if (typeof module_or_path !== 'undefined') {
 | 
			
		||||
        if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
 | 
			
		||||
            ({module_or_path} = module_or_path)
 | 
			
		||||
        } else {
 | 
			
		||||
            console.warn('using deprecated parameters for the initialization function; pass a single object instead')
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    const imports = __wbg_get_imports();
 | 
			
		||||
 | 
			
		||||
    if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
 | 
			
		||||
        module_or_path = fetch(module_or_path);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    __wbg_init_memory(imports);
 | 
			
		||||
 | 
			
		||||
    const { instance, module } = await __wbg_load(await module_or_path, imports);
 | 
			
		||||
 | 
			
		||||
    return __wbg_finalize_init(instance, module);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export { initSync };
 | 
			
		||||
export default __wbg_init;
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								external/qcms/qcms_bg.wasm
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								external/qcms/qcms_bg.wasm
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										84
									
								
								external/qcms/qcms_utils.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								external/qcms/qcms_utils.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,84 @@
 | 
			
		||||
/* Copyright 2025 Mozilla Foundation
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
class QCMS {
 | 
			
		||||
  static #memoryArray = null;
 | 
			
		||||
 | 
			
		||||
  static _memory = null;
 | 
			
		||||
 | 
			
		||||
  static _mustAddAlpha = false;
 | 
			
		||||
 | 
			
		||||
  static _destBuffer = null;
 | 
			
		||||
 | 
			
		||||
  static _destOffset = 0;
 | 
			
		||||
 | 
			
		||||
  static _destLength = 0;
 | 
			
		||||
 | 
			
		||||
  static _cssColor = "";
 | 
			
		||||
 | 
			
		||||
  static _makeHexColor = null;
 | 
			
		||||
 | 
			
		||||
  static get _memoryArray() {
 | 
			
		||||
    const array = this.#memoryArray;
 | 
			
		||||
    if (array?.byteLength) {
 | 
			
		||||
      return array;
 | 
			
		||||
    }
 | 
			
		||||
    return (this.#memoryArray = new Uint8Array(this._memory.buffer));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function copy_result(ptr, len) {
 | 
			
		||||
  // This function is called from the wasm module (it's an external
 | 
			
		||||
  // "C" function). Its goal is to copy the result from the wasm memory
 | 
			
		||||
  // to the destination buffer without any intermediate copies.
 | 
			
		||||
  const { _mustAddAlpha, _destBuffer, _destOffset, _destLength, _memoryArray } =
 | 
			
		||||
    QCMS;
 | 
			
		||||
  if (len === _destLength) {
 | 
			
		||||
    _destBuffer.set(_memoryArray.subarray(ptr, ptr + len), _destOffset);
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if (_mustAddAlpha) {
 | 
			
		||||
    for (let i = ptr, ii = ptr + len, j = _destOffset; i < ii; i += 3, j += 4) {
 | 
			
		||||
      _destBuffer[j] = _memoryArray[i];
 | 
			
		||||
      _destBuffer[j + 1] = _memoryArray[i + 1];
 | 
			
		||||
      _destBuffer[j + 2] = _memoryArray[i + 2];
 | 
			
		||||
      _destBuffer[j + 3] = 255;
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    for (let i = ptr, ii = ptr + len, j = _destOffset; i < ii; i += 3, j += 4) {
 | 
			
		||||
      _destBuffer[j] = _memoryArray[i];
 | 
			
		||||
      _destBuffer[j + 1] = _memoryArray[i + 1];
 | 
			
		||||
      _destBuffer[j + 2] = _memoryArray[i + 2];
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function copy_rgb(ptr) {
 | 
			
		||||
  const { _destBuffer, _destOffset, _memoryArray } = QCMS;
 | 
			
		||||
  _destBuffer[_destOffset] = _memoryArray[ptr];
 | 
			
		||||
  _destBuffer[_destOffset + 1] = _memoryArray[ptr + 1];
 | 
			
		||||
  _destBuffer[_destOffset + 2] = _memoryArray[ptr + 2];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function make_cssRGB(ptr) {
 | 
			
		||||
  const { _memoryArray } = QCMS;
 | 
			
		||||
  QCMS._cssColor = QCMS._makeHexColor(
 | 
			
		||||
    _memoryArray[ptr],
 | 
			
		||||
    _memoryArray[ptr + 1],
 | 
			
		||||
    _memoryArray[ptr + 2]
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export { copy_result, copy_rgb, make_cssRGB, QCMS };
 | 
			
		||||
		Reference in New Issue
	
	Block a user