skia2/modules/canvaskit/rt_shader.js
Kevin Lubick f3d6c36de3 [canvaskit] Add npm release target to ship smaller binaries
Moves RTShader to be built behind a flag (and not shipped
to npm [yet])

Bug: skia:9733
Change-Id: Ibdf965bbf3c0191ab7d9689168b1a099488c2ca3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262142
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-06 13:13:06 +00:00

12 lines
551 B
JavaScript

CanvasKit._extraInitializations = CanvasKit._extraInitializations || [];
CanvasKit._extraInitializations.push(function() {
CanvasKit.SkRuntimeEffect.prototype.makeShader = function(floats, isOpaque, matrix) {
var fptr = copy1dArray(floats, CanvasKit.HEAPF32);
// Our array has 4 bytes per float, so be sure to account for that before
// sending it over the wire.
if (!matrix) {
return this._makeShader(fptr, floats.length * 4, !!isOpaque);
}
return this._makeShader(fptr, floats.length * 4, !!isOpaque, matrix);
}
});