1*c8dee2aaSAndroid Build Coastguard Worker/* 2*c8dee2aaSAndroid Build Coastguard Worker * This externs file prevents the Closure JS compiler from minifying away 3*c8dee2aaSAndroid Build Coastguard Worker * names of objects created by Emscripten. 4*c8dee2aaSAndroid Build Coastguard Worker * Basically, by defining empty objects and functions here, Closure will 5*c8dee2aaSAndroid Build Coastguard Worker * know not to rename them. This is needed because of our pre-js files, 6*c8dee2aaSAndroid Build Coastguard Worker * that is, the JS we hand-write to bundle into PathKit. 7*c8dee2aaSAndroid Build Coastguard Worker * 8*c8dee2aaSAndroid Build Coastguard Worker * Emscripten does not support automatically generating an externs file, so we 9*c8dee2aaSAndroid Build Coastguard Worker * do it by hand. The general process is to write some JS code, and then put any 10*c8dee2aaSAndroid Build Coastguard Worker * calls to PathKit or related things in here. Running ./compile.sh and then 11*c8dee2aaSAndroid Build Coastguard Worker * looking at the minified results or running the Release-PathKit trybot should 12*c8dee2aaSAndroid Build Coastguard Worker * verify nothing was missed. Optionally, looking directly at the minified 13*c8dee2aaSAndroid Build Coastguard Worker * pathkit.js can be useful when developing locally. 14*c8dee2aaSAndroid Build Coastguard Worker * 15*c8dee2aaSAndroid Build Coastguard Worker * Docs: 16*c8dee2aaSAndroid Build Coastguard Worker * https://github.com/cljsjs/packages/wiki/Creating-Externs 17*c8dee2aaSAndroid Build Coastguard Worker * https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System 18*c8dee2aaSAndroid Build Coastguard Worker * 19*c8dee2aaSAndroid Build Coastguard Worker * Example externs: 20*c8dee2aaSAndroid Build Coastguard Worker * https://github.com/google/closure-compiler/tree/master/externs 21*c8dee2aaSAndroid Build Coastguard Worker */ 22*c8dee2aaSAndroid Build Coastguard Worker 23*c8dee2aaSAndroid Build Coastguard Workervar PathKit = { 24*c8dee2aaSAndroid Build Coastguard Worker SkBits2FloatUnsigned: function(num) {}, 25*c8dee2aaSAndroid Build Coastguard Worker _malloc: function(size) {}, 26*c8dee2aaSAndroid Build Coastguard Worker _free: function(ptr) {}, 27*c8dee2aaSAndroid Build Coastguard Worker onRuntimeInitialized: function() {}, 28*c8dee2aaSAndroid Build Coastguard Worker _FromCmds: function(ptr, size) {}, 29*c8dee2aaSAndroid Build Coastguard Worker loadCmdsTypedArray: function(arr) {}, 30*c8dee2aaSAndroid Build Coastguard Worker FromCmds: function(arr) {}, 31*c8dee2aaSAndroid Build Coastguard Worker _SkCubicMap: function(cp1, cp2) {}, 32*c8dee2aaSAndroid Build Coastguard Worker cubicYFromX: function(cpx1, cpy1, cpx2, cpy2, X) {}, 33*c8dee2aaSAndroid Build Coastguard Worker cubicPtFromT: function(cpx1, cpy1, cpx2, cpy2, T) {}, 34*c8dee2aaSAndroid Build Coastguard Worker 35*c8dee2aaSAndroid Build Coastguard Worker /** 36*c8dee2aaSAndroid Build Coastguard Worker * @type {Float32Array} 37*c8dee2aaSAndroid Build Coastguard Worker */ 38*c8dee2aaSAndroid Build Coastguard Worker HEAPF32: {}, 39*c8dee2aaSAndroid Build Coastguard Worker 40*c8dee2aaSAndroid Build Coastguard Worker SkPath: { 41*c8dee2aaSAndroid Build Coastguard Worker _addPath: function(path, scaleX, skewX, transX, skewY, scaleY, transY, pers0, pers1, pers2) {}, 42*c8dee2aaSAndroid Build Coastguard Worker _arc: function(x, y, radius, startAngle, endAngle, ccw) {}, 43*c8dee2aaSAndroid Build Coastguard Worker _arcTo: function(x1, y1, x2, y2, radius) {}, 44*c8dee2aaSAndroid Build Coastguard Worker _asWinding: function() {}, 45*c8dee2aaSAndroid Build Coastguard Worker _dash: function(on, off, phase) {}, 46*c8dee2aaSAndroid Build Coastguard Worker _close: function() {}, 47*c8dee2aaSAndroid Build Coastguard Worker _conicTo: function(x1, y1, x2, y2, w) {}, 48*c8dee2aaSAndroid Build Coastguard Worker copy: function() {}, 49*c8dee2aaSAndroid Build Coastguard Worker _cubicTo: function(cp1x, cp1y, cp2x, cp2y, x, y) {}, 50*c8dee2aaSAndroid Build Coastguard Worker _ellipse: function(x, y, radiusX, radiusY, rotation, startAngle, endAngle, ccw) {}, 51*c8dee2aaSAndroid Build Coastguard Worker _isEmpty: function() {}, 52*c8dee2aaSAndroid Build Coastguard Worker _lineTo: function(x1, y1) {}, 53*c8dee2aaSAndroid Build Coastguard Worker _moveTo: function(x1, y1) {}, 54*c8dee2aaSAndroid Build Coastguard Worker _op: function(otherPath, op) {}, 55*c8dee2aaSAndroid Build Coastguard Worker _quadTo: function(cpx, cpy, x, y) {}, 56*c8dee2aaSAndroid Build Coastguard Worker _rect: function(x, y, w, h) {}, 57*c8dee2aaSAndroid Build Coastguard Worker _reverseAddPath: function(path) {}, 58*c8dee2aaSAndroid Build Coastguard Worker _simplify: function() {}, 59*c8dee2aaSAndroid Build Coastguard Worker _stroke: function(opts) {}, 60*c8dee2aaSAndroid Build Coastguard Worker _trim: function(startT, stopT, isComplement) {}, 61*c8dee2aaSAndroid Build Coastguard Worker _transform: function() {}, // takes 1 or 9 params 62*c8dee2aaSAndroid Build Coastguard Worker }, 63*c8dee2aaSAndroid Build Coastguard Worker 64*c8dee2aaSAndroid Build Coastguard Worker StrokeCap: { 65*c8dee2aaSAndroid Build Coastguard Worker BUTT: {}, 66*c8dee2aaSAndroid Build Coastguard Worker ROUND: {}, 67*c8dee2aaSAndroid Build Coastguard Worker SQUARE: {}, 68*c8dee2aaSAndroid Build Coastguard Worker }, 69*c8dee2aaSAndroid Build Coastguard Worker StrokeJoin: { 70*c8dee2aaSAndroid Build Coastguard Worker MITER: {}, 71*c8dee2aaSAndroid Build Coastguard Worker ROUND: {}, 72*c8dee2aaSAndroid Build Coastguard Worker BEVEL: {}, 73*c8dee2aaSAndroid Build Coastguard Worker } 74*c8dee2aaSAndroid Build Coastguard Worker}; 75*c8dee2aaSAndroid Build Coastguard Worker 76*c8dee2aaSAndroid Build Coastguard Worker// Define StrokeOpts object 77*c8dee2aaSAndroid Build Coastguard Workervar StrokeOpts = {}; 78*c8dee2aaSAndroid Build Coastguard WorkerStrokeOpts.prototype.width; 79*c8dee2aaSAndroid Build Coastguard WorkerStrokeOpts.prototype.miter_limit; 80*c8dee2aaSAndroid Build Coastguard WorkerStrokeOpts.prototype.cap; 81*c8dee2aaSAndroid Build Coastguard WorkerStrokeOpts.prototype.join; 82*c8dee2aaSAndroid Build Coastguard Worker 83*c8dee2aaSAndroid Build Coastguard Worker// Define CubicMap object 84*c8dee2aaSAndroid Build Coastguard Workervar CubicMap = {}; 85*c8dee2aaSAndroid Build Coastguard WorkerCubicMap.prototype.computeYFromX = function(x) {}; 86*c8dee2aaSAndroid Build Coastguard WorkerCubicMap.prototype.computePtFromT = function(t) {}; 87*c8dee2aaSAndroid Build Coastguard Worker 88*c8dee2aaSAndroid Build Coastguard Worker 89*c8dee2aaSAndroid Build Coastguard Worker// For whatever reason, the closure compiler thinks it can rename some of our 90*c8dee2aaSAndroid Build Coastguard Worker// prototype methods. Not entirely sure why. 91*c8dee2aaSAndroid Build Coastguard Worker// Listing them here prevents that. 92*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.addPath = function() {}; 93*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.arc = function(x, y, radius, startAngle, endAngle, ccw) {}; 94*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.arcTo = function(x1, y1, x2, y2, radius) {}; 95*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.asWinding = function() {}; 96*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.bezierCurveTo = function(cp1x, cp1y, cp2x, cp2y, x, y) {}; 97*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.close = function() {}; 98*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.closePath = function() {}; 99*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.conicTo = function(x1, y1, x2, y2, w) {}; 100*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.cubicTo = function(cp1x, cp1y, cp2x, cp2y, x, y) {}; 101*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.dash = function(on, off, phase) {}; 102*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.ellipse = function(x, y, radiusX, radiusY, rotation, startAngle, endAngle, ccw) {}; 103*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.isEmpty = function() {}; 104*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.lineTo = function(x, y) {}; 105*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.moveTo = function(x, y) {}; 106*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.op = function(otherPath, op) {}; 107*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.quadTo = function(x1, y1, x2, y2) {}; 108*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.quadraticCurveTo = function(x1, y1, x2, y2) {}; 109*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.rect = function(x, y, w, h) {}; 110*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.reverseAddPath = function() {}; 111*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.simplify = function() {}; 112*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.stroke = function(opts) {}; 113*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.transform = function() {}; 114*c8dee2aaSAndroid Build Coastguard WorkerPathKit.SkPath.prototype.trim = function(startT, stopT, isComplement) {}; 115