From 628f3e70ee01278634fc9f765d26b31c0702a298 Mon Sep 17 00:00:00 2001 From: Nathaniel Nifong Date: Wed, 4 Mar 2020 15:50:42 -0500 Subject: [PATCH] Remove experimental from name of skm44 canvas methods Change-Id: If275ede5049b74c0c4c36eb5ac5697ec63737228 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275047 Commit-Queue: Nathaniel Nifong Reviewed-by: Kevin Lubick --- modules/canvaskit/canvaskit/extra.html | 14 ++++++-------- modules/canvaskit/canvaskit_bindings.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/modules/canvaskit/canvaskit/extra.html b/modules/canvaskit/canvaskit/extra.html index 27333a7d99..d984b60cb8 100644 --- a/modules/canvaskit/canvaskit/extra.html +++ b/modules/canvaskit/canvaskit/extra.html @@ -717,25 +717,25 @@ const curves = { // want "world" to be in our big coordinates (e.g. area), so apply this inverse // as part of our "camera". - canvas.experimental_saveCamera( + canvas.saveCamera( CanvasKit.SkM44.multiply(viewport, perspective), CanvasKit.SkM44.multiply(camera, mustInvert(viewport))); } function setClickToWorld(canvas, matrix) { - const l2d = canvas.experimental_getLocalToDevice(); + const l2d = canvas.getLocalToDevice(); worldToClick = CanvasKit.SkM44.multiply(mustInvert(matrix), l2d); clickToWorld = mustInvert(worldToClick); } function drawCubeFace(canvas, m, color) { const trans = new CanvasKit.SkM44.translated([vSphereRadius/2, vSphereRadius/2, 0]); - canvas.experimental_concat44(CanvasKit.SkM44.multiply(trans, m, mustInvert(trans))); - const znormal = front(canvas.experimental_getLocalToDevice()); + canvas.concat44(CanvasKit.SkM44.multiply(trans, m, mustInvert(trans))); + const znormal = front(canvas.getLocalToDevice()); if (znormal < 0) { return; // skip faces facing backwards } - const ltw = canvas.experimental_getLocalToWorld(); + const ltw = canvas.getLocalToWorld(); // shader expects the 4x4 matrices in column major order. const uniforms = [...CanvasKit.SkM44.transpose(ltw), ...mustInvert(ltw), ...lightWorldPos]; const paint = new CanvasKit.SkPaint(); @@ -747,9 +747,7 @@ const curves = { } function drawFrame(canvas) { - // TODO if not GPU backend, print an error to the console and return. - // this demo only works in GL. - const clickM = canvas.experimental_getLocalToDevice(); + const clickM = canvas.getLocalToDevice(); canvas.save(); canvas.translate(vSphereCenter[0] - vSphereRadius/2, vSphereCenter[1] - vSphereRadius/2); // pass surface dimensions as viewport size. diff --git a/modules/canvaskit/canvaskit_bindings.cpp b/modules/canvaskit/canvaskit_bindings.cpp index 3c143f15fc..f2a4fec645 100644 --- a/modules/canvaskit/canvaskit_bindings.cpp +++ b/modules/canvaskit/canvaskit_bindings.cpp @@ -1053,23 +1053,23 @@ EMSCRIPTEN_BINDINGS(Skia) { return self.writePixels(dstInfo, pixels, srcRowBytes, dstX, dstY); })) - // Experimental 4x4 matrix functions - .function("experimental_saveCamera", optional_override([](SkCanvas& self, + // 4x4 matrix functions + .function("saveCamera", optional_override([](SkCanvas& self, const SimpleM44& projection, const SimpleM44& camera) { self.experimental_saveCamera(toSkM44(projection), toSkM44(camera)); })) - .function("experimental_concat44", optional_override([](SkCanvas& self, const SimpleM44& m) { + .function("concat44", optional_override([](SkCanvas& self, const SimpleM44& m) { self.concat44(toSkM44(m)); })) - .function("experimental_getLocalToDevice", optional_override([](const SkCanvas& self)->SimpleM44 { + .function("getLocalToDevice", optional_override([](const SkCanvas& self)->SimpleM44 { SkM44 m = self.getLocalToDevice(); return toSimpleM44(m); })) - .function("experimental_getLocalToWorld", optional_override([](const SkCanvas& self)->SimpleM44 { + .function("getLocalToWorld", optional_override([](const SkCanvas& self)->SimpleM44 { SkM44 m = self.experimental_getLocalToWorld(); return toSimpleM44(m); })) - .function("experimental_getLocalToCamera", optional_override([](const SkCanvas& self)->SimpleM44 { + .function("getLocalToCamera", optional_override([](const SkCanvas& self)->SimpleM44 { SkM44 m = self.experimental_getLocalToCamera(); return toSimpleM44(m); }));