1CanvasKit._extraInitializations = CanvasKit._extraInitializations || []; 2CanvasKit._extraInitializations.push(function() { 3 // data is a TypedArray or ArrayBuffer e.g. from fetch().then(resp.arrayBuffer()) 4 CanvasKit.MakePicture = function(data) { 5 data = new Uint8Array(data); 6 7 var iptr = CanvasKit._malloc(data.byteLength); 8 CanvasKit.HEAPU8.set(data, iptr); 9 // The skp takes ownership of the malloc'd data. 10 var pic = CanvasKit._MakePicture(iptr, data.byteLength); 11 if (!pic) { 12 Debug('Could not decode picture'); 13 return null; 14 } 15 return pic; 16 }; 17}); 18