Skip to content

Commit

Permalink
Make SkM44 public
Browse files Browse the repository at this point in the history
Need to migrate clients from private/ to core/ include
Unexperimentalize concat44() methods on SkCanvas

Change-Id: I64b8816722a9d93316cb8b8691d2d9a3e36f167f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272464
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
  • Loading branch information
reed-at-google committed Feb 21, 2020
1 parent f8f9cd8 commit 46f5c5f
Show file tree
Hide file tree
Showing 56 changed files with 492 additions and 463 deletions.
4 changes: 2 additions & 2 deletions bench/GameBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "bench/Benchmark.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkMatrix44.h"
#include "include/core/SkM44.h"
#include "include/core/SkPaint.h"
#include "include/core/SkShader.h"
#include "include/core/SkString.h"
Expand Down Expand Up @@ -368,7 +368,7 @@ class CanvasMatrixBench : public Benchmark {
case kScale_Type: canvas->scale(1.0001f, 0.9999f); break;
case k2x3_Type: canvas->concat(m); break;
case k3x3_Type: canvas->concat(m); break;
case k4x4_Type: canvas->experimental_concat44(m4); break;
case k4x4_Type: canvas->concat44(m4); break;
}
}
canvas->restore();
Expand Down
2 changes: 1 addition & 1 deletion bench/Matrix44Bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "bench/Benchmark.h"
#include "include/core/SkMatrix44.h"
#include "include/core/SkString.h"
#include "include/private/SkM44.h"
#include "include/core/SkM44.h"
#include "include/utils/SkRandom.h"

class Matrix44Bench : public Benchmark {
Expand Down
2 changes: 1 addition & 1 deletion gm/3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void do_draw(SkCanvas* canvas, SkColor color) {

SkM44 m = SkM44::Rotate({0, 1, 0}, SK_ScalarPI/6);

canvas->experimental_concat44(make_ctm(info, m, {300, 300}));
canvas->concat44(make_ctm(info, m, {300, 300}));

canvas->translate(150, 150);
SkPaint paint;
Expand Down
4 changes: 2 additions & 2 deletions gm/crbug_224618.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "include/core/SkMatrix44.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkGradientShader.h"
#include "include/private/SkM44.h"
#include "include/core/SkM44.h"
#include "tools/timer/TimeUtils.h"

static SkM44 rotate_axis_angle(SkScalar x, SkScalar y, SkScalar z, SkScalar radians) {
Expand Down Expand Up @@ -101,7 +101,7 @@ class CrBug224618GM : public skiagm::GM {
SkM44::Translate(-radius, -radius); // center content

canvas->save();
canvas->experimental_concat44(model);
canvas->concat44(model);

SkPaint fillPaint;
fillPaint.setAntiAlias(true);
Expand Down
28 changes: 22 additions & 6 deletions include/core/SkCanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "include/core/SkColor.h"
#include "include/core/SkFontTypes.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkM44.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPoint.h"
Expand All @@ -26,7 +27,6 @@
#include "include/core/SkTypes.h"
#include "include/core/SkVertices.h"
#include "include/private/SkDeque.h"
#include "include/private/SkM44.h"
#include "include/private/SkMacros.h"

#include <cstring>
Expand All @@ -44,7 +44,6 @@ class SkFont;
class SkGlyphRunBuilder;
class SkImage;
class SkImageFilter;
class SkM44;
class SkPaintFilterCanvas;
class SkPath;
class SkPicture;
Expand Down Expand Up @@ -880,9 +879,17 @@ class SK_API SkCanvas {
example: https://fiddle.skia.org/c/@Canvas_concat
*/
void concat(const SkMatrix& matrix);
void concat44(const SkM44&);
void concat44(const SkScalar[]); // column-major

void experimental_concat44(const SkM44&);
void experimental_concat44(const SkScalar[]); // column-major
#ifdef SK_SUPPORT_EXPERIMENTAL_CANVAS44
void experimental_concat44(const SkM44& m) {
this->concat44(m);
}
void experimental_concat44(const SkScalar colMajor[]) {
this->concat44(colMajor);
}
#endif

/** Replaces SkMatrix with matrix.
Unlike concat(), any prior matrix state is overwritten.
Expand Down Expand Up @@ -2508,12 +2515,21 @@ class SK_API SkCanvas {
example: https://fiddle.skia.org/c/@Clip
*/
SkMatrix getTotalMatrix() const;
SkM44 getLocalToDevice() const; // entire matrix stack
void getLocalToDevice(SkScalar colMajor[16]) const;

#ifdef SK_SUPPORT_EXPERIMENTAL_CANVAS44
SkM44 experimental_getLocalToDevice() const {
return this->getLocalToDevice();
}
void experimental_getLocalToDevice(SkScalar colMajor[16]) const {
this->getLocalToDevice(colMajor);
}
#endif

SkM44 experimental_getLocalToDevice() const; // entire matrix stack
SkM44 experimental_getLocalToWorld() const; // up to but not including top-most camera
SkM44 experimental_getLocalToCamera() const; // up to and including top-most camera

void experimental_getLocalToDevice(SkScalar colMajor[16]) const;
void experimental_getLocalToWorld(SkScalar colMajor[16]) const;
void experimental_getLocalToCamera(SkScalar colMajor[16]) const;

Expand Down
Loading

0 comments on commit 46f5c5f

Please sign in to comment.