6e927095e1
This should fix https://github.com/flutter/flutter/issues/80221 Change-Id: I25e0ad58bcaad95b43cc94476af0e241e17ac244 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397289 Reviewed-by: Kevin Lubick <kjlubick@google.com>
18 lines
594 B
JavaScript
18 lines
594 B
JavaScript
CanvasKit._extraInitializations = CanvasKit._extraInitializations || [];
|
|
CanvasKit._extraInitializations.push(function() {
|
|
// data is a TypedArray or ArrayBuffer e.g. from fetch().then(resp.arrayBuffer())
|
|
CanvasKit.MakePicture = function(data) {
|
|
data = new Uint8Array(data);
|
|
|
|
var iptr = CanvasKit._malloc(data.byteLength);
|
|
CanvasKit.HEAPU8.set(data, iptr);
|
|
// The skp takes ownership of the malloc'd data.
|
|
var pic = CanvasKit._MakePicture(iptr, data.byteLength);
|
|
if (!pic) {
|
|
Debug('Could not decode picture');
|
|
return null;
|
|
}
|
|
return pic;
|
|
};
|
|
});
|