|
|
@ -8,14 +8,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
import * as Log from './util/logging.js';
|
|
|
|
import * as Log from './util/logging.js';
|
|
|
|
import Base64 from "./base64.js";
|
|
|
|
import Base64 from "./base64.js";
|
|
|
|
|
|
|
|
import { supportsImageMetadata } from './util/browser.js';
|
|
|
|
let SUPPORTS_IMAGEDATA_CONSTRUCTOR = false;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
new ImageData(new Uint8ClampedArray(4), 1, 1);
|
|
|
|
|
|
|
|
SUPPORTS_IMAGEDATA_CONSTRUCTOR = true;
|
|
|
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
|
|
|
// ignore failure
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default class Display {
|
|
|
|
export default class Display {
|
|
|
|
constructor(target) {
|
|
|
|
constructor(target) {
|
|
|
@ -581,7 +574,7 @@ export default class Display {
|
|
|
|
_rgbxImageData(x, y, width, height, arr, offset) {
|
|
|
|
_rgbxImageData(x, y, width, height, arr, offset) {
|
|
|
|
// NB(directxman12): arr must be an Type Array view
|
|
|
|
// NB(directxman12): arr must be an Type Array view
|
|
|
|
let img;
|
|
|
|
let img;
|
|
|
|
if (SUPPORTS_IMAGEDATA_CONSTRUCTOR) {
|
|
|
|
if (supportsImageMetadata) {
|
|
|
|
img = new ImageData(new Uint8ClampedArray(arr.buffer, arr.byteOffset, width * height * 4), width, height);
|
|
|
|
img = new ImageData(new Uint8ClampedArray(arr.buffer, arr.byteOffset, width * height * 4), width, height);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
img = this._drawCtx.createImageData(width, height);
|
|
|
|
img = this._drawCtx.createImageData(width, height);
|
|
|
|