mirror of
https://github.com/novnc/noVNC.git
synced 2026-08-29 08:34:26 +08:00
Remove createImageData() fallback
All our browsers should be new enough now that we can rely on the ImageData constructor.
This commit is contained in:
+1
-13
@@ -8,7 +8,6 @@
|
||||
|
||||
import * as Log from './util/logging.js';
|
||||
import Base64 from "./base64.js";
|
||||
import { supportsImageMetadata } from './util/browser.js';
|
||||
import { toSigned32bit } from './util/int.js';
|
||||
|
||||
export default class Display {
|
||||
@@ -56,11 +55,6 @@ export default class Display {
|
||||
|
||||
Log.Debug("User Agent: " + navigator.userAgent);
|
||||
|
||||
// Check canvas features
|
||||
if (!('createImageData' in this._drawCtx)) {
|
||||
throw new Error("Canvas does not support createImageData");
|
||||
}
|
||||
|
||||
Log.Debug("<< Display.constructor");
|
||||
|
||||
// ===== PROPERTIES =====
|
||||
@@ -393,13 +387,7 @@ export default class Display {
|
||||
let data = new Uint8ClampedArray(arr.buffer,
|
||||
arr.byteOffset + offset,
|
||||
width * height * 4);
|
||||
let img;
|
||||
if (supportsImageMetadata) {
|
||||
img = new ImageData(data, width, height);
|
||||
} else {
|
||||
img = this._drawCtx.createImageData(width, height);
|
||||
img.data.set(data);
|
||||
}
|
||||
let img = new ImageData(data, width, height);
|
||||
this._drawCtx.putImageData(img, x, y);
|
||||
this._damage(x, y, width, height);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user