5f9ec39daf
Canvas-wasm says it's a drop in replacement for the Canvas API. Unfortunately HTMLCanvas.decodeImage returns an SkImage which has functions width() and height() for getting the width and height of an image whereas HTMLImageElement has properties width and height. Lots of existing code uses width and height so wrapping this would seem to make it more closely match expectations. Bug: skia:12705 Change-Id: I62c4f655c58f6806e836700e03b946a91f3e518d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479936 Reviewed-by: Kevin Lubick <kjlubick@google.com>
11 lines
322 B
JavaScript
11 lines
322 B
JavaScript
function HTMLImage(skImage) {
|
|
this._skImage = skImage;
|
|
// These are writable but have no effect, just like HTMLImageElement
|
|
this.width = skImage.width();
|
|
this.height = skImage.height();
|
|
this.naturalWidth = this.width;
|
|
this.naturalHeight = this.height;
|
|
this.getSkImage = function() {
|
|
return skImage;
|
|
}
|
|
} |