diff --git a/bench/DashBench.cpp b/bench/DashBench.cpp index 99ca57635e..df014a846a 100644 --- a/bench/DashBench.cpp +++ b/bench/DashBench.cpp @@ -151,7 +151,7 @@ static void make_unit_star(SkPath* path, int n) { static void make_poly(SkPath* path) { make_unit_star(path, 9); - const SkMatrix matrix = SkMatrix::MakeScale(SkIntToScalar(100), SkIntToScalar(100)); + const SkMatrix matrix = SkMatrix::Scale(100, 100); path->transform(matrix); } diff --git a/bench/DrawBitmapAABench.cpp b/bench/DrawBitmapAABench.cpp index 52a92f7a52..e57ecd9c66 100644 --- a/bench/DrawBitmapAABench.cpp +++ b/bench/DrawBitmapAABench.cpp @@ -54,11 +54,11 @@ private: typedef Benchmark INHERITED; }; -DEF_BENCH( return new DrawBitmapAABench(false, SkMatrix::MakeScale(1), "ident"); ) +DEF_BENCH( return new DrawBitmapAABench(false, SkMatrix::I(), "ident"); ) -DEF_BENCH( return new DrawBitmapAABench(false, SkMatrix::MakeScale(1.17f), "scale"); ) +DEF_BENCH( return new DrawBitmapAABench(false, SkMatrix::Scale(1.17f, 1.17f), "scale"); ) -DEF_BENCH( return new DrawBitmapAABench(false, SkMatrix::MakeTrans(17.5f, 17.5f), "translate"); ) +DEF_BENCH( return new DrawBitmapAABench(false, SkMatrix::Translate(17.5f, 17.5f), "translate"); ) DEF_BENCH( SkMatrix m; @@ -67,11 +67,11 @@ DEF_BENCH( return new DrawBitmapAABench(false, m, "rotate"); ) -DEF_BENCH( return new DrawBitmapAABench(true, SkMatrix::MakeScale(1), "ident"); ) +DEF_BENCH( return new DrawBitmapAABench(true, SkMatrix::I(), "ident"); ) -DEF_BENCH( return new DrawBitmapAABench(true, SkMatrix::MakeScale(1.17f), "scale"); ) +DEF_BENCH( return new DrawBitmapAABench(true, SkMatrix::Scale(1.17f, 1.17f), "scale"); ) -DEF_BENCH( return new DrawBitmapAABench(true, SkMatrix::MakeTrans(17.5f, 17.5f), "translate"); ) +DEF_BENCH( return new DrawBitmapAABench(true, SkMatrix::Translate(17.5f, 17.5f), "translate"); ) DEF_BENCH( SkMatrix m; diff --git a/bench/HairlinePathBench.cpp b/bench/HairlinePathBench.cpp index d57f616706..5e29a136dc 100644 --- a/bench/HairlinePathBench.cpp +++ b/bench/HairlinePathBench.cpp @@ -60,7 +60,7 @@ protected: SkPath path; this->makePath(&path); if (fFlags & kBig_Flag) { - const SkMatrix m = SkMatrix::MakeScale(SkIntToScalar(3), SkIntToScalar(3)); + const SkMatrix m = SkMatrix::Scale(3, 3); path.transform(m); } diff --git a/bench/MatrixBench.cpp b/bench/MatrixBench.cpp index 7248d01f24..c2f5ea0a51 100644 --- a/bench/MatrixBench.cpp +++ b/bench/MatrixBench.cpp @@ -266,7 +266,7 @@ DEF_BENCH( return new InvertMapRectMatrixBench( /////////////////////////////////////////////////////////////////////////////// -static SkMatrix make_trans() { return SkMatrix::MakeTrans(2, 3); } +static SkMatrix make_trans() { return SkMatrix::Translate(2, 3); } static SkMatrix make_scale() { SkMatrix m(make_trans()); m.postScale(1.5f, 0.5f); return m; } static SkMatrix make_afine() { SkMatrix m(make_trans()); m.postRotate(15); return m; } diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp index e78080b37b..93824bc345 100644 --- a/bench/PathBench.cpp +++ b/bench/PathBench.cpp @@ -58,7 +58,7 @@ protected: SkPath path; this->makePath(&path); if (fFlags & kBig_Flag) { - const SkMatrix m = SkMatrix::MakeScale(SkIntToScalar(10), SkIntToScalar(10)); + const SkMatrix m = SkMatrix::Scale(10, 10); path.transform(m); } diff --git a/bench/QuickRejectBench.cpp b/bench/QuickRejectBench.cpp index daad4d4a41..86f97c5e0b 100644 --- a/bench/QuickRejectBench.cpp +++ b/bench/QuickRejectBench.cpp @@ -53,7 +53,7 @@ class ConcatBench : public Benchmark { void onDraw(int loops, SkCanvas* canvas) override { while (loops --> 0) { - canvas->setMatrix(SkMatrix::MakeScale(3.0f)); + canvas->setMatrix(SkMatrix::Scale(3, 3)); canvas->concat(fMatrix); } } diff --git a/bench/SKPAnimationBench.cpp b/bench/SKPAnimationBench.cpp index 8cb9d8d945..2bd3efb286 100644 --- a/bench/SKPAnimationBench.cpp +++ b/bench/SKPAnimationBench.cpp @@ -28,7 +28,7 @@ void SKPAnimationBench::onPerCanvasPreDraw(SkCanvas* canvas) { void SKPAnimationBench::drawPicture() { for (int j = 0; j < this->tileRects().count(); ++j) { - SkMatrix trans = SkMatrix::MakeTrans(-1.f * this->tileRects()[j].fLeft, + SkMatrix trans = SkMatrix::Translate(-1.f * this->tileRects()[j].fLeft, -1.f * this->tileRects()[j].fTop); fAnimation->preConcatFrameMatrix(fAnimationTime.nextRangeF(0, 1000), fDevBounds, &trans); this->surfaces()[j]->getCanvas()->drawPicture(this->picture(), &trans, nullptr); diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp index 802b20bc77..f8a480e987 100644 --- a/bench/SKPBench.cpp +++ b/bench/SKPBench.cpp @@ -129,7 +129,7 @@ void SKPBench::drawMPDPicture() { void SKPBench::drawPicture() { for (int j = 0; j < fTileRects.count(); ++j) { - const SkMatrix trans = SkMatrix::MakeTrans(-fTileRects[j].fLeft / fScale, + const SkMatrix trans = SkMatrix::Translate(-fTileRects[j].fLeft / fScale, -fTileRects[j].fTop / fScale); fSurfaces[j]->getCanvas()->drawPicture(fPic.get(), &trans, nullptr); } diff --git a/bench/TessellatePathBench.cpp b/bench/TessellatePathBench.cpp index dc0daf7d09..610eadcfd6 100644 --- a/bench/TessellatePathBench.cpp +++ b/bench/TessellatePathBench.cpp @@ -194,7 +194,7 @@ DEF_BENCH( ); DEF_BENCH( return new GrTessellatePathOp::TestingOnly_Benchmark::WangsFormulaBench( - "_scale", SkMatrix::MakeScale(1.1f, 0.9f)); + "_scale", SkMatrix::Scale(1.1f, 0.9f)); ); DEF_BENCH( return new GrTessellatePathOp::TestingOnly_Benchmark::WangsFormulaBench( diff --git a/docs/examples/ChromeMDRefreshTab.cpp b/docs/examples/ChromeMDRefreshTab.cpp index 5b31a00d1a..71e6d51ce1 100644 --- a/docs/examples/ChromeMDRefreshTab.cpp +++ b/docs/examples/ChromeMDRefreshTab.cpp @@ -62,7 +62,8 @@ SkPath GetBorderPath(float scale, SkPathDirection::kCCW, right, bottom - 1); path.close(); - if (unscale_at_end && (scale != 1)) path.transform(SkMatrix::MakeScale(1.f / scale)); + if (unscale_at_end && (scale != 1)) path.transform(SkMatrix::Scale(1.f / scale, + 1.f / scale)); return path; } @@ -142,12 +143,12 @@ void draw(SkCanvas* canvas) { p.setStyle(SkPaint::kStroke_Style); p.setStrokeWidth(1); SkPath path = GetInteriorPath(1.f, SkISize::Make(250, 36), 16); - path.transform(SkMatrix::MakeTrans(0, 30)); + path.transform(SkMatrix::Translate(0, 30)); canvas->drawPath(path, p); p.setColor(SK_ColorBLUE); SkPath border_path = GetBorderPath(1.f, false, false, 16, SkISize::Make(250, 36)); - border_path.transform(SkMatrix::MakeTrans(0, 30)); + border_path.transform(SkMatrix::Translate(0, 30)); canvas->drawPath(border_path, p); // canvas->drawLine(20, 20, 100, 100, p); diff --git a/docs/examples/Matrix_MakeScale.cpp b/docs/examples/Matrix_MakeScale.cpp index 0699ce3d94..166b8de49b 100644 --- a/docs/examples/Matrix_MakeScale.cpp +++ b/docs/examples/Matrix_MakeScale.cpp @@ -4,7 +4,7 @@ // HASH=7ff17718111df6d6f95381d8a8f1b389 REG_FIDDLE(Matrix_MakeScale, 256, 256, false, 4) { void draw(SkCanvas* canvas) { - canvas->concat(SkMatrix::MakeScale(4, 3)); + canvas->concat(SkMatrix::Scale(4, 3)); canvas->drawBitmap(source, 0, 0); } } // END FIDDLE diff --git a/docs/examples/Matrix_MakeScale_2.cpp b/docs/examples/Matrix_MakeScale_2.cpp index 5c03f0cfb8..8fbdcd1dc8 100644 --- a/docs/examples/Matrix_MakeScale_2.cpp +++ b/docs/examples/Matrix_MakeScale_2.cpp @@ -4,7 +4,7 @@ // HASH=2956aeb50fa862cdb13995e1e56a4bc8 REG_FIDDLE(Matrix_MakeScale_2, 256, 256, false, 4) { void draw(SkCanvas* canvas) { - canvas->concat(SkMatrix::MakeScale(4)); + canvas->concat(SkMatrix::Scale(4, 4)); canvas->drawBitmap(source, 0, 0); } } // END FIDDLE diff --git a/docs/examples/Matrix_MakeTrans.cpp b/docs/examples/Matrix_MakeTrans.cpp index 90f845f5f6..93896dad35 100644 --- a/docs/examples/Matrix_MakeTrans.cpp +++ b/docs/examples/Matrix_MakeTrans.cpp @@ -4,7 +4,7 @@ // HASH=b2479df0d9cf296ff64ac31e36684557 REG_FIDDLE(Matrix_MakeTrans, 256, 256, false, 4) { void draw(SkCanvas* canvas) { - SkMatrix matrix = SkMatrix::MakeTrans(64, 48); + SkMatrix matrix = SkMatrix::Translate(64, 48); for (int i = 0; i < 4; ++i) { canvas->drawBitmap(source, 0, 0); canvas->concat(matrix); diff --git a/docs/examples/Matrix_decomposeScale.cpp b/docs/examples/Matrix_decomposeScale.cpp index 430985043d..077fc25333 100644 --- a/docs/examples/Matrix_decomposeScale.cpp +++ b/docs/examples/Matrix_decomposeScale.cpp @@ -15,7 +15,7 @@ void draw(SkCanvas* canvas) { SkDebugf("success: %s ", success ? "true" : "false"); SkDebugf("scale: %g, %g\n", scale.width(), scale.height()); remaining.dump(); - SkMatrix scaleMatrix = SkMatrix::MakeScale(scale.width(), scale.height()); + SkMatrix scaleMatrix = SkMatrix::Scale(scale.width(), scale.height()); SkMatrix combined = SkMatrix::Concat(scaleMatrix, remaining); combined.dump(); } diff --git a/docs/examples/Matrix_isFinite.cpp b/docs/examples/Matrix_isFinite.cpp index 5759ac2dfa..763c7f624d 100644 --- a/docs/examples/Matrix_isFinite.cpp +++ b/docs/examples/Matrix_isFinite.cpp @@ -4,7 +4,7 @@ // HASH=bc6c6f6a5df770287120d87f81b922eb REG_FIDDLE(Matrix_isFinite, 256, 256, true, 0) { void draw(SkCanvas* canvas) { - SkMatrix matrix = SkMatrix::MakeTrans(SK_ScalarNaN, 0); + SkMatrix matrix = SkMatrix::Translate(SK_ScalarNaN, 0); matrix.dump(); SkDebugf("matrix is finite: %s\n", matrix.isFinite() ? "true" : "false"); SkDebugf("matrix %c= matrix\n", matrix == matrix ? '=' : '!'); diff --git a/docs/examples/Paint_getFillPath.cpp b/docs/examples/Paint_getFillPath.cpp index a52e3f2443..64b630e4fd 100644 --- a/docs/examples/Paint_getFillPath.cpp +++ b/docs/examples/Paint_getFillPath.cpp @@ -14,7 +14,7 @@ void draw(SkCanvas* canvas) { SkPath fillPath; SkPaint outlinePaint(strokePaint); outlinePaint.setStrokeWidth(2); - SkMatrix scale = SkMatrix::MakeScale(300, 300); + SkMatrix scale = SkMatrix::Scale(300, 300); for (SkScalar precision : { 0.01f, .1f, 1.f, 10.f, 100.f } ) { strokePaint.getFillPath(strokePath, &fillPath, nullptr, precision); fillPath.transform(scale); diff --git a/docs/examples/blur_alpha_img.cpp b/docs/examples/blur_alpha_img.cpp index 880f018dd9..2d00ace0fc 100644 --- a/docs/examples/blur_alpha_img.cpp +++ b/docs/examples/blur_alpha_img.cpp @@ -13,7 +13,7 @@ sk_sp foo() { path.lineTo(pts[i] * scale, pts[i + 1] * scale); } path.close(); - SkMatrix matrix = SkMatrix::MakeScale(4 * scale); + SkMatrix matrix = SkMatrix::Scale(4 * scale, 4 * scale); SkPaint paint; paint.setPathEffect(SkPath2DPathEffect::Make(matrix, path)); paint.setAntiAlias(true); diff --git a/docs/examples/checker_board.cpp b/docs/examples/checker_board.cpp index 424ce4f922..95dafc4b47 100644 --- a/docs/examples/checker_board.cpp +++ b/docs/examples/checker_board.cpp @@ -8,7 +8,7 @@ void checkerboard(SkCanvas* canvas) { SkScalar scale = 10.0f; SkPath path; path.addRect(0, 0, scale, scale); - SkMatrix matrix = SkMatrix::MakeScale(2 * scale, scale); + SkMatrix matrix = SkMatrix::Scale(2 * scale, scale); matrix.preSkew(0.5f, 0); SkPaint paint; paint.setPathEffect(SkPath2DPathEffect::Make(matrix, path)); diff --git a/docs/examples/flag_us_1792.cpp b/docs/examples/flag_us_1792.cpp index bb258ee7e6..a99a661d0c 100644 --- a/docs/examples/flag_us_1792.cpp +++ b/docs/examples/flag_us_1792.cpp @@ -17,7 +17,7 @@ void draw(SkCanvas* canvas) { SkPath star; SkParsePath::FromSVGString("M 0 -150 L 88 121 L -143 -46 L 143 -46 L -88 121 Z", &star); for (int i = 0; i < 13; ++i) { - SkMatrix matrix = SkMatrix::MakeTrans(1482, 1050); + SkMatrix matrix = SkMatrix::Translate(1482, 1050); matrix.preRotate((360.0 / 13) * i); matrix.preTranslate(0, -785); SkAutoCanvasRestore autoCanvasRestore(canvas, true); diff --git a/docs/examples/skpaint_path_2d_path_effect.cpp b/docs/examples/skpaint_path_2d_path_effect.cpp index de2bb9aa01..48adaba657 100644 --- a/docs/examples/skpaint_path_2d_path_effect.cpp +++ b/docs/examples/skpaint_path_2d_path_effect.cpp @@ -12,7 +12,7 @@ void draw(SkCanvas* canvas) { path.lineTo(pts[i] * scale, pts[i + 1] * scale); } path.close(); - SkMatrix matrix = SkMatrix::MakeScale(4 * scale); + SkMatrix matrix = SkMatrix::Scale(4 * scale, 4 * scale); SkPaint paint; paint.setPathEffect(SkPath2DPathEffect::Make(matrix, path)); paint.setAntiAlias(true); diff --git a/experimental/svg/model/SkSVGSVG.cpp b/experimental/svg/model/SkSVGSVG.cpp index a1cc8f75f0..053f794a42 100644 --- a/experimental/svg/model/SkSVGSVG.cpp +++ b/experimental/svg/model/SkSVGSVG.cpp @@ -14,7 +14,7 @@ SkSVGSVG::SkSVGSVG() : INHERITED(SkSVGTag::kSvg) { } bool SkSVGSVG::onPrepareToRender(SkSVGRenderContext* ctx) const { auto viewPortRect = ctx->lengthContext().resolveRect(fX, fY, fWidth, fHeight); - auto contentMatrix = SkMatrix::MakeTrans(viewPortRect.x(), viewPortRect.y()); + auto contentMatrix = SkMatrix::Translate(viewPortRect.x(), viewPortRect.y()); auto viewPort = SkSize::Make(viewPortRect.width(), viewPortRect.height()); if (fViewBox.isValid()) { diff --git a/fuzz/FuzzCommon.cpp b/fuzz/FuzzCommon.cpp index 5478cc0887..b125c45a8d 100644 --- a/fuzz/FuzzCommon.cpp +++ b/fuzz/FuzzCommon.cpp @@ -297,14 +297,14 @@ void FuzzNiceMatrix(Fuzz* fuzz, SkMatrix* m) { case 1: // translate fuzz->nextRange(&buffer[0], -4000.0f, 4000.0f); fuzz->nextRange(&buffer[1], -4000.0f, 4000.0f); - *m = SkMatrix::MakeTrans(buffer[0], buffer[1]); + *m = SkMatrix::Translate(buffer[0], buffer[1]); return; case 2: // translate + scale fuzz->nextRange(&buffer[0], -400.0f, 400.0f); fuzz->nextRange(&buffer[1], -400.0f, 400.0f); fuzz->nextRange(&buffer[2], -4000.0f, 4000.0f); fuzz->nextRange(&buffer[3], -4000.0f, 4000.0f); - *m = SkMatrix::MakeScale(buffer[0], buffer[1]); + *m = SkMatrix::Scale(buffer[0], buffer[1]); m->postTranslate(buffer[2], buffer[3]); return; case 3: // affine diff --git a/gm/aarectmodes.cpp b/gm/aarectmodes.cpp index 9d593638e6..cd14096d13 100644 --- a/gm/aarectmodes.cpp +++ b/gm/aarectmodes.cpp @@ -121,7 +121,7 @@ static sk_sp make_bg_shader() { *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCE, 0xCF, 0xCE); - const SkMatrix m = SkMatrix::MakeScale(SkIntToScalar(6), SkIntToScalar(6)); + const SkMatrix m = SkMatrix::Scale(SkIntToScalar(6), SkIntToScalar(6)); return bm.makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat, &m); } diff --git a/gm/bug6783.cpp b/gm/bug6783.cpp index 05e4cf19ea..4f52e0914a 100644 --- a/gm/bug6783.cpp +++ b/gm/bug6783.cpp @@ -44,8 +44,7 @@ DEF_SIMPLE_GM(bug6783, canvas, 500, 500) { sk_sp img = surface->makeImageSnapshot(); - SkMatrix m = SkMatrix::Concat(SkMatrix::MakeTrans(25, 214), - SkMatrix::MakeScale(2, 2)); + SkMatrix m = SkMatrix::Translate(25, 214) * SkMatrix::Scale(2, 2); m.preSkew(0.5f, 0.5f); // The bug was present at all filter levels, but you might not notice it at kNone. diff --git a/gm/complexclip.cpp b/gm/complexclip.cpp index 6e22dc0b20..264564d227 100644 --- a/gm/complexclip.cpp +++ b/gm/complexclip.cpp @@ -239,7 +239,7 @@ DEF_SIMPLE_GM(clip_shader, canvas, 840, 650) { canvas->translate(img->width() + 10, img->height() + 10); canvas->clipShader(sh, SkClipOp::kIntersect); canvas->save(); - SkMatrix lm = SkMatrix::MakeScale(1.0f / 5); + SkMatrix lm = SkMatrix::Scale(1.0f/5, 1.0f/5); canvas->clipShader(img->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat, &lm)); canvas->drawImage(img, 0, 0, nullptr); diff --git a/gm/composeshader.cpp b/gm/composeshader.cpp index 8ef08247be..b4fdfd2f0f 100644 --- a/gm/composeshader.cpp +++ b/gm/composeshader.cpp @@ -192,7 +192,7 @@ protected: void onDraw(SkCanvas* canvas) override { SkBlendMode mode = SkBlendMode::kDstOver; - SkMatrix lm = SkMatrix::MakeTrans(0, squareLength * 0.5f); + SkMatrix lm = SkMatrix::Translate(0, squareLength * 0.5f); sk_sp shaders[] = { // gradient should appear over color bitmap diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp index d72d91c1e8..ec54bae6c4 100644 --- a/gm/constcolorprocessor.cpp +++ b/gm/constcolorprocessor.cpp @@ -101,7 +101,7 @@ protected: // translate by x,y for the canvas draws and the test target draws. canvas->save(); canvas->translate(x, y); - const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y); + const SkMatrix viewMatrix = SkMatrix::Translate(x, y); SkSimpleMatrixProvider matrixProvider(viewMatrix); // rect to draw diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index 68d328926c..786879a2a3 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -121,7 +121,7 @@ protected: SkScalar x = 0; for (int et = 0; et < kGrClipEdgeTypeCnt; ++et) { - const SkMatrix m = SkMatrix::MakeTrans(x, y); + const SkMatrix m = SkMatrix::Translate(x, y); SkPath p; path->transform(m, &p); diff --git a/gm/dashcircle.cpp b/gm/dashcircle.cpp index bbfddebb49..7942b34bb1 100644 --- a/gm/dashcircle.cpp +++ b/gm/dashcircle.cpp @@ -175,10 +175,10 @@ protected: rotate.setRotate(25.f); static const SkMatrix kMatrices[]{ SkMatrix::I(), - SkMatrix::MakeScale(1.2f), + SkMatrix::Scale(1.2f, 1.2f), SkMatrix::MakeAll(1, 0, 0, 0, -1, 0, 0, 0, 1), // y flipper SkMatrix::MakeAll(-1, 0, 0, 0, 1, 0, 0, 0, 1), // x flipper - SkMatrix::MakeScale(0.7f), + SkMatrix::Scale(0.7f, 0.7f), rotate, SkMatrix::Concat( SkMatrix::Concat(SkMatrix::MakeAll(-1, 0, 0, 0, 1, 0, 0, 0, 1), rotate), diff --git a/gm/dftext_blob_persp.cpp b/gm/dftext_blob_persp.cpp index 9c38221a19..0e7c666c48 100644 --- a/gm/dftext_blob_persp.cpp +++ b/gm/dftext_blob_persp.cpp @@ -131,8 +131,8 @@ private: persp.setPerspY(-0.0015f); break; } - persp = SkMatrix::Concat(persp, SkMatrix::MakeTrans(-x, -y)); - persp = SkMatrix::Concat(SkMatrix::MakeTrans(x, y), persp); + persp = SkMatrix::Concat(persp, SkMatrix::Translate(-x, -y)); + persp = SkMatrix::Concat(SkMatrix::Translate(x, y), persp); canvas->concat(persp); if (TranslateWithMatrix::kYes == translateWithMatrix) { canvas->translate(x, y); diff --git a/gm/draw_bitmap_rect_skbug4374.cpp b/gm/draw_bitmap_rect_skbug4374.cpp index 52d17e331d..03770d3ff5 100644 --- a/gm/draw_bitmap_rect_skbug4374.cpp +++ b/gm/draw_bitmap_rect_skbug4374.cpp @@ -19,7 +19,7 @@ DEF_SIMPLE_GM(draw_bitmap_rect_skbug4734, canvas, 64, 64) { SkRect rect = SkRect::Make(source.bounds()); rect.inset(0.5, 1.5); SkRect dst; - SkMatrix::MakeScale(8.0f).mapRect(&dst, rect); + SkMatrix::Scale(8, 8).mapRect(&dst, rect); canvas->drawBitmapRect(source, rect, dst, nullptr); } } diff --git a/gm/drawable.cpp b/gm/drawable.cpp index 77800491f7..857467224e 100644 --- a/gm/drawable.cpp +++ b/gm/drawable.cpp @@ -43,7 +43,7 @@ DEF_SIMPLE_GM(drawable, canvas, 180, 275) { canvas->drawDrawable(drawable.get()); canvas->drawDrawable(drawable.get(), 0, 150); - SkMatrix m = SkMatrix::MakeScale(1.5f, 0.8f); + SkMatrix m = SkMatrix::Scale(1.5f, 0.8f); m.postTranslate(70, 0); canvas->drawDrawable(drawable.get(), &m); diff --git a/gm/gpu_blur_utils.cpp b/gm/gpu_blur_utils.cpp index 0704ebaa24..cbf818b999 100644 --- a/gm/gpu_blur_utils.cpp +++ b/gm/gpu_blur_utils.cpp @@ -143,7 +143,7 @@ static void run(GrContext* ctx, GrRenderTargetContext* rtc, bool subsetSrc, bool for (int t = 0; t < kSkTileModeCount; ++t) { auto mode = static_cast(t); GrSamplerState sampler(SkTileModeToWrapMode(mode), GrSamplerState::Filter::kNearest); - SkMatrix m = SkMatrix::MakeTrans(trans.x() - testArea.x(), trans.y() - testArea.y()); + SkMatrix m = SkMatrix::Translate(trans.x() - testArea.x(), trans.y() - testArea.y()); // Draw the src subset in the tile mode faded as a reference before drawing the blur // on top. { @@ -169,7 +169,7 @@ static void run(GrContext* ctx, GrRenderTargetContext* rtc, bool subsetSrc, bool refSrc->clear(SK_PMColor4fWHITE); // Setup an effect to put the original src rect at the correct logical place // in the temp where the temp's origin is at the top left of refRect. - SkMatrix tm = SkMatrix::MakeTrans(refRect.left(), refRect.top()); + SkMatrix tm = SkMatrix::Translate(refRect.left(), refRect.top()); auto fp = GrTextureEffect::MakeSubset(src, kPremul_SkAlphaType, tm, sampler, SkRect::Make(srcRect), caps); GrPaint paint; diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp index 37ecefc853..b9a9060d13 100644 --- a/gm/image_pict.cpp +++ b/gm/image_pict.cpp @@ -94,7 +94,7 @@ protected: } void drawSet(SkCanvas* canvas) const { - SkMatrix matrix = SkMatrix::MakeTrans(-100, -100); + SkMatrix matrix = SkMatrix::Translate(-100, -100); canvas->drawPicture(fPicture, &matrix, nullptr); canvas->drawImage(fImage0.get(), 150, 0); canvas->drawImage(fImage1.get(), 300, 0); @@ -294,7 +294,7 @@ protected: } void drawSet(SkCanvas* canvas) const { - SkMatrix matrix = SkMatrix::MakeTrans(-100, -100); + SkMatrix matrix = SkMatrix::Translate(-100, -100); canvas->drawPicture(fPicture, &matrix, nullptr); // Draw the tex first, so it doesn't hit a lucky cache from the raster version. This diff --git a/gm/image_shader.cpp b/gm/image_shader.cpp index cfce7a7ba0..318dbafb29 100644 --- a/gm/image_shader.cpp +++ b/gm/image_shader.cpp @@ -122,7 +122,7 @@ protected: canvas->translate(0, 120); const SkTileMode tile = SkTileMode::kRepeat; - const SkMatrix localM = SkMatrix::MakeTrans(-50, -50); + const SkMatrix localM = SkMatrix::Translate(-50, -50); SkPaint paint; paint.setShader(image->makeShader(tile, tile, &localM)); paint.setAntiAlias(true); diff --git a/gm/localmatriximagefilter.cpp b/gm/localmatriximagefilter.cpp index 9a9902d461..30186c9575 100644 --- a/gm/localmatriximagefilter.cpp +++ b/gm/localmatriximagefilter.cpp @@ -59,9 +59,9 @@ DEF_SIMPLE_GM(localmatriximagefilter, canvas, 640, 640) { }; const SkMatrix matrices[] = { - SkMatrix::MakeScale(SK_ScalarHalf, SK_ScalarHalf), - SkMatrix::MakeScale(2, 2), - SkMatrix::MakeTrans(10, 10) + SkMatrix::Scale(SK_ScalarHalf, SK_ScalarHalf), + SkMatrix::Scale(2, 2), + SkMatrix::Translate(10, 10) }; const SkScalar spacer = image0->width() * 3.0f / 2; diff --git a/gm/localmatriximageshader.cpp b/gm/localmatriximageshader.cpp index d08748dce3..da838e263e 100644 --- a/gm/localmatriximageshader.cpp +++ b/gm/localmatriximageshader.cpp @@ -34,7 +34,7 @@ static sk_sp make_image(SkCanvas* rootCanvas, SkColor color) { DEF_SIMPLE_GM(localmatriximageshader, canvas, 250, 250) { sk_sp redImage = make_image(canvas, SK_ColorRED); - SkMatrix translate = SkMatrix::MakeTrans(100.0f, 0.0f); + SkMatrix translate = SkMatrix::Translate(100.0f, 0.0f); SkMatrix rotate; rotate.setRotate(45.0f); sk_sp redImageShader = redImage->makeShader(&translate); @@ -72,7 +72,7 @@ DEF_SIMPLE_GM(localmatriximageshader_filtering, canvas, 256, 256) { auto image = GetResourceAsImage("images/mandrill_256.png"); SkPaint p; p.setFilterQuality(kHigh_SkFilterQuality); - SkMatrix m = SkMatrix::MakeScale(2.0f); + SkMatrix m = SkMatrix::Scale(2, 2); p.setShader(image->makeShader()->makeWithLocalMatrix(m)); canvas->drawRect(SkRect::MakeXYWH(0, 0, 256, 256), p); diff --git a/gm/localmatrixshader.cpp b/gm/localmatrixshader.cpp index 08e27e9802..5c58101b9d 100644 --- a/gm/localmatrixshader.cpp +++ b/gm/localmatrixshader.cpp @@ -74,8 +74,8 @@ DEF_SIMPLE_GM(localmatrixshader_nested, canvas, 450, 1200) { }, }; - static const auto inner = SkMatrix::MakeScale(2, 2), - outer = SkMatrix::MakeTrans(20, 20); + static const auto inner = SkMatrix::Scale(2, 2), + outer = SkMatrix::Translate(20, 20); SkPaint border; border.setAntiAlias(true); diff --git a/gm/offsetimagefilter.cpp b/gm/offsetimagefilter.cpp index 7a006cc8c6..47ed99c99e 100644 --- a/gm/offsetimagefilter.cpp +++ b/gm/offsetimagefilter.cpp @@ -86,7 +86,7 @@ private: // Draw a boundary rect around the intersection of the clip rect and crop rect. SkRect cropRectFloat; - SkMatrix::MakeScale(scale, scale).mapRect(&cropRectFloat, SkRect::Make(cropRect)); + SkMatrix::Scale(scale, scale).mapRect(&cropRectFloat, SkRect::Make(cropRect)); if (clipRect.intersect(cropRectFloat)) { SkPaint strokePaint; strokePaint.setStyle(SkPaint::kStroke_Style); diff --git a/gm/perspshaders.cpp b/gm/perspshaders.cpp index bcccb4b327..3092cdf515 100644 --- a/gm/perspshaders.cpp +++ b/gm/perspshaders.cpp @@ -209,7 +209,7 @@ static SkPath make_path() { DEF_SIMPLE_GM(perspective_clip, canvas, 800, 800) { SkPath path = make_path(); auto shader = GetResourceAsImage("images/mandrill_128.png") - ->makeShader(SkMatrix::MakeScale(3, 3)); + ->makeShader(SkMatrix::Scale(3, 3)); SkPaint paint; paint.setColor({0.75, 0.75, 0.75, 1}); diff --git a/gm/pictureimagegenerator.cpp b/gm/pictureimagegenerator.cpp index 758b5f51aa..b453420745 100644 --- a/gm/pictureimagegenerator.cpp +++ b/gm/pictureimagegenerator.cpp @@ -170,7 +170,7 @@ protected: SkPaint p; p.setAlphaf(configs[i].opacity); - SkMatrix m = SkMatrix::MakeScale(configs[i].scaleX, configs[i].scaleY); + SkMatrix m = SkMatrix::Scale(configs[i].scaleX, configs[i].scaleY); if (configs[i].scaleX < 0) { m.postTranslate(SkIntToScalar(configs[i].size.width()), 0); } diff --git a/gm/preservefillrule.cpp b/gm/preservefillrule.cpp index 26ff7f67d2..33cfe61d2d 100644 --- a/gm/preservefillrule.cpp +++ b/gm/preservefillrule.cpp @@ -85,15 +85,15 @@ private: star7_winding.setFillType(SkPathFillType::kWinding); SkPath star7_evenOdd = star7_winding; - star7_evenOdd.transform(SkMatrix::MakeTrans(0, fStarSize)); + star7_evenOdd.transform(SkMatrix::Translate(0, fStarSize)); star7_evenOdd.setFillType(SkPathFillType::kEvenOdd); SkPath star5_winding = ToolUtils::make_star(starRect, 5); - star5_winding.transform(SkMatrix::MakeTrans(fStarSize, 0)); + star5_winding.transform(SkMatrix::Translate(fStarSize, 0)); star5_winding.setFillType(SkPathFillType::kWinding); SkPath star5_evenOdd = star5_winding; - star5_evenOdd.transform(SkMatrix::MakeTrans(0, fStarSize)); + star5_evenOdd.transform(SkMatrix::Translate(0, fStarSize)); star5_evenOdd.setFillType(SkPathFillType::kEvenOdd); SkPaint paint; diff --git a/gm/runtimeshader.cpp b/gm/runtimeshader.cpp index 913bf627d4..749e040e62 100644 --- a/gm/runtimeshader.cpp +++ b/gm/runtimeshader.cpp @@ -48,8 +48,8 @@ class RuntimeShader : public skiagm::GM { DEF_GM(return new RuntimeShader;) static sk_sp make_shader(sk_sp img, SkISize size) { - SkMatrix scale = SkMatrix::MakeScale(size.width() / (float)img->width(), - size.height() / (float)img->height()); + SkMatrix scale = SkMatrix::Scale(size.width() / (float)img->width(), + size.height() / (float)img->height()); return img->makeShader(SkTileMode::kClamp, SkTileMode::kClamp, &scale); } diff --git a/gm/sharedcorners.cpp b/gm/sharedcorners.cpp index e9f871620d..5c9b270bcd 100644 --- a/gm/sharedcorners.cpp +++ b/gm/sharedcorners.cpp @@ -121,7 +121,7 @@ protected: path.close(); } SkScalar scale = kBoxSize / std::max(path.getBounds().height(), path.getBounds().width()); - path.transform(SkMatrix::MakeScale(scale, scale)); + path.transform(SkMatrix::Scale(scale, scale)); this->drawRow(canvas, path); canvas->translate(0, kBoxSize + kPadSize); diff --git a/gm/texelsubset.cpp b/gm/texelsubset.cpp index d957403c8a..75d335b469 100644 --- a/gm/texelsubset.cpp +++ b/gm/texelsubset.cpp @@ -154,7 +154,7 @@ protected: std::move(fp1), drawRect, localRect.makeOffset(kT), - SkMatrix::MakeTrans(-kT))) { + SkMatrix::Translate(-kT))) { renderTargetContext->priv().testingOnly_addDrawOp(std::move(op)); } @@ -164,7 +164,7 @@ protected: // rather than a texture subset as a comparison. drawRect = localRect.makeOffset(x, y); SkMatrix subsetTextureMatrix = SkMatrix::Concat( - SkMatrix::MakeTrans(-texelSubset.topLeft()), textureMatrices[tm]); + SkMatrix::Translate(-texelSubset.topLeft()), textureMatrices[tm]); auto fp2 = GrTextureEffect::Make(subsetView, fBitmap.alphaType(), subsetTextureMatrix, diff --git a/gm/tilemodes_alpha.cpp b/gm/tilemodes_alpha.cpp index 83a6d2f09c..08a63d035c 100644 --- a/gm/tilemodes_alpha.cpp +++ b/gm/tilemodes_alpha.cpp @@ -27,7 +27,7 @@ DEF_SIMPLE_GM(tilemodes_alpha, canvas, 512, 512) { for (int y = 0; y < 4; ++y) { for (int x = 0; x < 4; ++x) { SkRect rect = SkRect::MakeXYWH(128 * x + 1, 128 * y + 1, 126, 126); - SkMatrix matrix = SkMatrix::MakeTrans(rect.x(), rect.y()); + SkMatrix matrix = SkMatrix::Translate(rect.x(), rect.y()); SkPaint paint(SkColor4f{0, 0, 0, 0.5f}); paint.setShader(image->makeShader(kModes[x], kModes[y], &matrix)); canvas->drawRect(rect, paint); diff --git a/gm/vertices.cpp b/gm/vertices.cpp index 21a5750252..83546e5ec2 100644 --- a/gm/vertices.cpp +++ b/gm/vertices.cpp @@ -41,7 +41,7 @@ static sk_sp make_shader1(SkScalar shaderScale) { SK_ColorMAGENTA, SK_ColorBLUE, SK_ColorYELLOW, }; const SkPoint pts[] = {{kShaderSize / 4, 0}, {3 * kShaderSize / 4, kShaderSize}}; - const SkMatrix localMatrix = SkMatrix::MakeScale(shaderScale, shaderScale); + const SkMatrix localMatrix = SkMatrix::Scale(shaderScale, shaderScale); sk_sp grad = SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), @@ -51,8 +51,8 @@ static sk_sp make_shader1(SkScalar shaderScale) { return shaderScale == 1 ? grad : sk_make_sp( - sk_make_sp(std::move(grad), SkMatrix::MakeTrans(-10, 0)), - SkMatrix::MakeTrans(10, 0)); + sk_make_sp(std::move(grad), SkMatrix::Translate(-10, 0)), + SkMatrix::Translate(10, 0)); } static sk_sp make_shader2() { @@ -384,7 +384,7 @@ DEF_SIMPLE_GM(vertices_data_lerp, canvas, 256, 256) { } )"; auto [effect, errorText] = SkRuntimeEffect::Make(SkString(gProg)); - SkMatrix scale = SkMatrix::MakeScale(2); + SkMatrix scale = SkMatrix::Scale(2, 2); sk_sp children[] = { GetResourceAsImage("images/mandrill_256.png")->makeShader(), GetResourceAsImage("images/color_wheel.png")->makeShader(scale), diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp index d7714ff0e3..95140e9dd0 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -176,7 +176,7 @@ private: SkRect* bounds) const override { GrSamplerState samplerState(GrSamplerState::WrapMode::kClampToBorder, GrSamplerState::Filter::kNearest); - auto m = SkMatrix::MakeTrans(-fX, -fY); + auto m = SkMatrix::Translate(-fX, -fY); auto subset = SkRect::Make(fMask.dimensions()); auto domain = bounds->makeOffset(-fX, -fY).makeInset(0.5, 0.5); auto fp = GrTextureEffect::MakeSubset(fMask, kPremul_SkAlphaType, m, samplerState, subset, diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index 25f8c4c5f5..75b01ac6b4 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -342,7 +342,7 @@ protected: SkScalar x = kTestPad; // Columns are non-subsetted followed by subsetted with each WrapMode in a row for (uint32_t j = 0; j < GrSamplerState::kWrapModeCount + 1; ++j) { - SkMatrix ctm = SkMatrix::MakeTrans(x, y); + SkMatrix ctm = SkMatrix::Translate(x, y); ctm.postScale(10.f, 10.f); const SkRect* subset = j > 0 ? &kColorRect : nullptr; diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h index 0eca52e480..76f998bbb2 100644 --- a/include/core/SkMatrix.h +++ b/include/core/SkMatrix.h @@ -87,6 +87,7 @@ public: static SkMatrix SK_WARN_UNUSED_RESULT Translate(SkVector t) { return Translate(t.x(), t.y()); } static SkMatrix SK_WARN_UNUSED_RESULT Translate(SkIVector t) { return Translate(t.x(), t.y()); } +#ifdef SK_SUPPORT_LEGACY_MATRIX_FACTORIES // DEPRECATED static SkMatrix SK_WARN_UNUSED_RESULT MakeTrans(SkScalar dx, SkScalar dy) { return Translate(dx, dy); @@ -100,6 +101,7 @@ public: static SkMatrix SK_WARN_UNUSED_RESULT MakeTrans(SkVector t) { return MakeTrans(t.x(), t.y()); } static SkMatrix SK_WARN_UNUSED_RESULT MakeTrans(SkIVector t) { return MakeTrans(t.x(), t.y()); } // end DEPRECATED +#endif /** Sets SkMatrix to: @@ -1666,6 +1668,10 @@ public: return result; } + friend SkMatrix operator*(const SkMatrix& a, const SkMatrix& b) { + return Concat(a, b); + } + /** Sets internal cache to unknown state. Use to force update after repeated modifications to SkMatrix element reference returned by operator[](int index). */ diff --git a/modules/skottie/src/Transform.cpp b/modules/skottie/src/Transform.cpp index ff8b45c618..c8b3bad635 100644 --- a/modules/skottie/src/Transform.cpp +++ b/modules/skottie/src/Transform.cpp @@ -38,7 +38,7 @@ void TransformAdapter2D::onSync() { } SkMatrix TransformAdapter2D::totalMatrix() const { - SkMatrix t = SkMatrix::MakeTrans(-fAnchorPoint.x, -fAnchorPoint.y); + SkMatrix t = SkMatrix::Translate(-fAnchorPoint.x, -fAnchorPoint.y); t.postScale(fScale.x / 100, fScale.y / 100); // 100% based t.postRotate(fRotation); diff --git a/modules/skottie/src/effects/MotionTileEffect.cpp b/modules/skottie/src/effects/MotionTileEffect.cpp index bc2c31f7f8..71be1636be 100644 --- a/modules/skottie/src/effects/MotionTileEffect.cpp +++ b/modules/skottie/src/effects/MotionTileEffect.cpp @@ -95,7 +95,7 @@ protected: const auto phase_shift = SkVector::Make(phase_vec.fX / layerShaderMatrix.getScaleX(), phase_vec.fY / layerShaderMatrix.getScaleY()) * std::fmod(fPhase * (1/360.0f), 1); - const auto phase_shader_matrix = SkMatrix::MakeTrans(phase_shift.x(), phase_shift.y()); + const auto phase_shader_matrix = SkMatrix::Translate(phase_shift.x(), phase_shift.y()); // The mask is generated using a step gradient shader, spanning 2 x tile width/height, // and perpendicular to the phase vector. diff --git a/modules/skottie/src/layers/TextLayer.cpp b/modules/skottie/src/layers/TextLayer.cpp index 054b1ef6ae..633b0c8254 100644 --- a/modules/skottie/src/layers/TextLayer.cpp +++ b/modules/skottie/src/layers/TextLayer.cpp @@ -366,7 +366,7 @@ bool AnimationBuilder::resolveEmbeddedTypefaces(const skjson::ArrayValue& jchars static constexpr float kPtScale = 0.01f; // Normalize the path and advance for 1pt. - path.transform(SkMatrix::MakeScale(kPtScale, kPtScale)); + path.transform(SkMatrix::Scale(kPtScale, kPtScale)); current_font->fCustomBuilder.setGlyph(glyph_id, advance * kPtScale, path); } diff --git a/modules/skottie/src/layers/shapelayer/Repeater.cpp b/modules/skottie/src/layers/shapelayer/Repeater.cpp index 3a80af0582..1d26b08f32 100644 --- a/modules/skottie/src/layers/shapelayer/Repeater.cpp +++ b/modules/skottie/src/layers/shapelayer/Repeater.cpp @@ -49,7 +49,7 @@ private: const auto t = fOffset + index; // Position, scale & rotation are "scaled" by index/offset. - SkMatrix m = SkMatrix::MakeTrans(-fAnchorPoint.x, + SkMatrix m = SkMatrix::Translate(-fAnchorPoint.x, -fAnchorPoint.y); m.postScale(std::pow(fScale.x * .01f, fOffset), std::pow(fScale.y * .01f, fOffset)); diff --git a/modules/skparagraph/src/ParagraphImpl.cpp b/modules/skparagraph/src/ParagraphImpl.cpp index 285ceaadcc..dd69b3ad8f 100644 --- a/modules/skparagraph/src/ParagraphImpl.cpp +++ b/modules/skparagraph/src/ParagraphImpl.cpp @@ -234,7 +234,7 @@ void ParagraphImpl::paint(SkCanvas* canvas, SkScalar x, SkScalar y) { fState = kDrawn; } - SkMatrix matrix = SkMatrix::MakeTrans(x + fOrigin.fLeft, y + fOrigin.fTop); + SkMatrix matrix = SkMatrix::Translate(x + fOrigin.fLeft, y + fOrigin.fTop); canvas->drawPicture(fPicture, &matrix, nullptr); } diff --git a/modules/sksg/include/SkSGTransform.h b/modules/sksg/include/SkSGTransform.h index 1c7c17ca8e..3c1c013086 100644 --- a/modules/sksg/include/SkSGTransform.h +++ b/modules/sksg/include/SkSGTransform.h @@ -49,7 +49,7 @@ private: * * auto m33 = Matrix::Make(SkMatrix::I()); * ... - * m33->setMatrix(SkMatrix::MakeTrans(10, 10)); + * m33->setMatrix(SkMatrix::Translate(10, 10)); * */ template diff --git a/modules/sksg/tests/SGTest.cpp b/modules/sksg/tests/SGTest.cpp index 61e4609333..dbfedc58de 100644 --- a/modules/sksg/tests/SGTest.cpp +++ b/modules/sksg/tests/SGTest.cpp @@ -167,7 +167,7 @@ static void inval_test1(skiatest::Reporter* reporter) { { // Update transform. - matrix->setMatrix(SkMatrix::MakeScale(2, 2)); + matrix->setMatrix(SkMatrix::Scale(2, 2)); std::vector damage = { {0, 0, 300, 200}, { 0, 0, 600, 400} }; check_inval(reporter, root, SkRect::MakeWH(600, 400), @@ -250,7 +250,7 @@ static void inval_test2(skiatest::Reporter* reporter) { { // Update m2. - m2->setMatrix(SkMatrix::MakeScale(2, 2)); + m2->setMatrix(SkMatrix::Scale(2, 2)); std::vector damage = { {0, 0, 100, 100}, { 0, 0, 200, 200} }; check_inval(reporter, root, SkRect::MakeWH(200, 200), @@ -260,7 +260,7 @@ static void inval_test2(skiatest::Reporter* reporter) { { // Update shared m1. - m1->setMatrix(SkMatrix::MakeTrans(100, 100)); + m1->setMatrix(SkMatrix::Translate(100, 100)); std::vector damage = { { 0, 0, 200, 200}, // draw1 prev bounds { 100, 100, 300, 300}, // draw1 new bounds { 0, 0, 100, 100}, // draw2 prev bounds diff --git a/samplecode/Sample3D.cpp b/samplecode/Sample3D.cpp index 1b86f33822..e54fc9fb54 100644 --- a/samplecode/Sample3D.cpp +++ b/samplecode/Sample3D.cpp @@ -363,9 +363,9 @@ public: void onOnceBeforeDraw() override { fRR = SkRRect::MakeRectXY({20, 20, 380, 380}, 50, 50); auto img = GetResourceAsImage("images/brickwork-texture.jpg"); - fImgShader = img->makeShader(SkMatrix::MakeScale(2, 2)); + fImgShader = img->makeShader(SkMatrix::Scale(2, 2)); img = GetResourceAsImage("images/brickwork_normal-map.jpg"); - fBmpShader = img->makeShader(SkMatrix::MakeScale(2, 2)); + fBmpShader = img->makeShader(SkMatrix::Scale(2, 2)); const char code[] = R"( in shader color_map; diff --git a/samplecode/SampleBackdropBounds.cpp b/samplecode/SampleBackdropBounds.cpp index d16d0b9911..67ac714fc7 100644 --- a/samplecode/SampleBackdropBounds.cpp +++ b/samplecode/SampleBackdropBounds.cpp @@ -76,7 +76,7 @@ public: toGlobal = SkMatrix::I(); layerMatrix = ctm; } else if (ctm.decomposeScale(&scale, &toGlobal)) { - layerMatrix = SkMatrix::MakeScale(scale.fWidth, scale.fHeight); + layerMatrix = SkMatrix::Scale(scale.fWidth, scale.fHeight); } else { toGlobal = ctm; layerMatrix = SkMatrix::I(); diff --git a/samplecode/SampleClip.cpp b/samplecode/SampleClip.cpp index 74af4ae49d..014d03453c 100644 --- a/samplecode/SampleClip.cpp +++ b/samplecode/SampleClip.cpp @@ -505,7 +505,7 @@ class HalfPlaneView3 : public SampleCameraView { void onOnceBeforeDraw() override { fPath = make_path(); fShader = GetResourceAsImage("images/mandrill_128.png") - ->makeShader(SkMatrix::MakeScale(3, 3)); + ->makeShader(SkMatrix::Scale(3, 3)); } bool onChar(SkUnichar uni) override { diff --git a/samplecode/SampleCowboy.cpp b/samplecode/SampleCowboy.cpp index 6ba3177f8c..492550891a 100644 --- a/samplecode/SampleCowboy.cpp +++ b/samplecode/SampleCowboy.cpp @@ -61,12 +61,12 @@ private: void onDrawContent(SkCanvas* canvas) override { if (fDom) { - canvas->setMatrix(SkMatrix::MakeScale(3)); + canvas->setMatrix(SkMatrix::Scale(3, 3)); canvas->clipRect(SkRect::MakeLTRB(0, 0, 400, 400)); switch (fState) { case kZoomIn: fDelta += 0.2f; - canvas->concat(SkMatrix::MakeScale(fDelta)); + canvas->scale(fDelta, fDelta); break; case kScroll: if (fAnimationLoop > kAnimationIterations/2) { @@ -74,12 +74,12 @@ private: } else { fDelta -= 80.f; } - canvas->concat(SkMatrix::MakeScale(fDelta)); + canvas->scale(fDelta, fDelta); canvas->translate(fDelta, 0); break; case kZoomOut: fDelta += 0.2f; - canvas->concat(SkMatrix::MakeScale(fDelta)); + canvas->scale(fDelta, fDelta); break; } diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp index f1dcd295b4..7f1ef61322 100644 --- a/samplecode/SampleFatBits.cpp +++ b/samplecode/SampleFatBits.cpp @@ -382,7 +382,7 @@ public: fPts[0].set(1, 1); fPts[1].set(5, 4); fPts[2].set(2, 6); - SkMatrix::MakeScale(SkIntToScalar(fZoom)).mapPoints(fPts, 3); + SkMatrix::Scale(fZoom, fZoom).mapPoints(fPts, 3); fIsRect = false; } diff --git a/samplecode/SamplePathText.cpp b/samplecode/SamplePathText.cpp index a8b65e34da..d9fb7c0bf8 100644 --- a/samplecode/SamplePathText.cpp +++ b/samplecode/SamplePathText.cpp @@ -67,7 +67,7 @@ public: void onDrawContent(SkCanvas* canvas) override { if (fDoClip) { SkPath deviceSpaceClipPath = fClipPath; - deviceSpaceClipPath.transform(SkMatrix::MakeScale(this->width(), this->height())); + deviceSpaceClipPath.transform(SkMatrix::Scale(this->width(), this->height())); canvas->save(); canvas->clipPath(deviceSpaceClipPath, SkClipOp::kDifference, true); canvas->clear(SK_ColorBLACK); diff --git a/samplecode/SampleTessellatedWedge.cpp b/samplecode/SampleTessellatedWedge.cpp index 66b73ba37c..a46adce910 100644 --- a/samplecode/SampleTessellatedWedge.cpp +++ b/samplecode/SampleTessellatedWedge.cpp @@ -32,8 +32,8 @@ public: float theta = 2*3.1415926535897932384626433832785 * i / numSides; fPath.lineTo(std::cos(theta), std::sin(theta)); } - fPath.transform(SkMatrix::MakeScale(200, 200)); - fPath.transform(SkMatrix::MakeTrans(300, 300)); + fPath.transform(SkMatrix::Scale(200, 200)); + fPath.transform(SkMatrix::Translate(300, 300)); #else fPath.moveTo(100, 200); fPath.cubicTo(100, 100, 400, 100, 400, 200); @@ -120,7 +120,7 @@ public: SkPathPriv::UpdatePathPoint(path, fPtIdx, pt + fCurr - fPrev); } else { path->transform( - SkMatrix::MakeTrans(fCurr.x() - fPrev.x(), fCurr.y() - fPrev.y()), path); + SkMatrix::Translate(fCurr.x() - fPrev.x(), fCurr.y() - fPrev.y()), path); } } diff --git a/src/android/SkAnimatedImage.cpp b/src/android/SkAnimatedImage.cpp index 3ae8a843ba..966f150aa8 100644 --- a/src/android/SkAnimatedImage.cpp +++ b/src/android/SkAnimatedImage.cpp @@ -92,10 +92,10 @@ SkAnimatedImage::SkAnimatedImage(std::unique_ptr codec, SkISize } if (!fSimple) { - fMatrix = SkMatrix::MakeTrans(-fCropRect.fLeft, -fCropRect.fTop); + fMatrix = SkMatrix::Translate(-fCropRect.fLeft, -fCropRect.fTop); float scaleX = (float) fScaledSize.width() / fDecodeInfo.width(); float scaleY = (float) fScaledSize.height() / fDecodeInfo.height(); - fMatrix.preConcat(SkMatrix::MakeScale(scaleX, scaleY)); + fMatrix.preConcat(SkMatrix::Scale(scaleX, scaleY)); } this->decodeNextFrame(); } diff --git a/src/codec/SkWuffsCodec.cpp b/src/codec/SkWuffsCodec.cpp index 88394b3c80..4da7162c8c 100644 --- a/src/codec/SkWuffsCodec.cpp +++ b/src/codec/SkWuffsCodec.cpp @@ -755,7 +755,7 @@ SkCodec::Result SkWuffsCodec::onIncrementalDecodeTwoPass() { SkRasterClip rc(SkIRect::MakeSize(this->dstInfo().dimensions())); draw.fRC = &rc; - SkMatrix translate = SkMatrix::MakeTrans(dirty_rect.min_incl_x, dirty_rect.min_incl_y); + SkMatrix translate = SkMatrix::Translate(dirty_rect.min_incl_x, dirty_rect.min_incl_y); draw.drawBitmap(src, translate, nullptr, paint); } diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index 069f0a16f4..aeb56aa3b7 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -574,7 +574,7 @@ void SkBitmapDevice::drawDevice(SkBaseDevice* device, int x, int y, const SkPain draw.fRC = &fRCStack.rc(); paint.writable()->setShader(src->fBitmap.makeShader()); draw.drawBitmap(*src->fCoverage.get(), - SkMatrix::MakeTrans(SkIntToScalar(x),SkIntToScalar(y)), nullptr, *paint); + SkMatrix::Translate(SkIntToScalar(x),SkIntToScalar(y)), nullptr, *paint); } else { BDDraw(this).drawSprite(src->fBitmap, x, y, *paint); } @@ -628,7 +628,7 @@ void SkBitmapDevice::drawSpecial(SkSpecialImage* src, int x, int y, const SkPain if (SkImageFilter* filter = paint->getImageFilter()) { SkIPoint offset = SkIPoint::Make(0, 0); const SkMatrix matrix = SkMatrix::Concat( - SkMatrix::MakeTrans(SkIntToScalar(-x), SkIntToScalar(-y)), this->localToDevice()); + SkMatrix::Translate(SkIntToScalar(-x), SkIntToScalar(-y)), this->localToDevice()); const SkIRect clipBounds = fRCStack.rc().getBounds().makeOffset(-x, -y); sk_sp cache(this->getImageFilterCache()); SkImageFilter_Base::Context ctx(matrix, clipBounds, cache.get(), fBitmap.colorType(), @@ -679,7 +679,7 @@ void SkBitmapDevice::drawSpecial(SkSpecialImage* src, int x, int y, const SkPain // (while compensating in the shader matrix). mask = sk_ref_sp(clipImage); maskMatrix = totalMatrix; - shaderMatrix = SkMatrix::Concat(totalInverse, SkMatrix::MakeTrans(x, y)); + shaderMatrix = totalInverse * SkMatrix::Translate(x, y); // If the mask is not fully contained within the src layer, we must clip. if (!srcBounds.contains(clipBounds)) { @@ -698,7 +698,7 @@ void SkBitmapDevice::drawSpecial(SkSpecialImage* src, int x, int y, const SkPain mask = surf->makeImageSnapshot(); maskMatrix = SkMatrix::I(); - shaderMatrix = SkMatrix::MakeTrans(x - maskBounds.x(), y - maskBounds.y()); + shaderMatrix = SkMatrix::Translate(x - maskBounds.x(), y - maskBounds.y()); } SkAutoDeviceTransformRestore adr(this, maskMatrix); diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index bf2ee61286..af6b269e71 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -931,7 +931,7 @@ void SkCanvas::DrawDeviceWithFilter(SkBaseDevice* src, const SkImageFilter* filt toRoot = SkMatrix::I(); layerMatrix = ctm; } else if (ctm.decomposeScale(&scale, &toRoot)) { - layerMatrix = SkMatrix::MakeScale(scale.fWidth, scale.fHeight); + layerMatrix = SkMatrix::Scale(scale.fWidth, scale.fHeight); } else { // Perspective, for now, do no scaling of the layer itself. // TODO (michaelludwig) - perhaps it'd be better to explore a heuristic scale pulled from @@ -2681,7 +2681,7 @@ void SkCanvas::drawDrawable(SkDrawable* dr, SkScalar x, SkScalar y) { #endif RETURN_ON_NULL(dr); if (x || y) { - SkMatrix matrix = SkMatrix::MakeTrans(x, y); + SkMatrix matrix = SkMatrix::Translate(x, y); this->onDrawDrawable(dr, &matrix); } else { this->onDrawDrawable(dr, nullptr); diff --git a/src/core/SkClipStackDevice.cpp b/src/core/SkClipStackDevice.cpp index ab2fcd85ac..bbcec4fe11 100644 --- a/src/core/SkClipStackDevice.cpp +++ b/src/core/SkClipStackDevice.cpp @@ -44,7 +44,7 @@ void SkClipStackDevice::onClipRegion(const SkRegion& rgn, SkClipOp op) { SkRegion tmp; SkPath path; rgn.getBoundaryPath(&path); - path.transform(SkMatrix::MakeTrans(-origin)); + path.transform(SkMatrix::Translate(-origin)); fClipStack.clipPath(path, SkMatrix::I(), op, false); } diff --git a/src/core/SkDrawable.cpp b/src/core/SkDrawable.cpp index 62b0272972..5e12fa5913 100644 --- a/src/core/SkDrawable.cpp +++ b/src/core/SkDrawable.cpp @@ -43,7 +43,7 @@ void SkDrawable::draw(SkCanvas* canvas, const SkMatrix* matrix) { } void SkDrawable::draw(SkCanvas* canvas, SkScalar x, SkScalar y) { - SkMatrix matrix = SkMatrix::MakeTrans(x, y); + SkMatrix matrix = SkMatrix::Translate(x, y); this->draw(canvas, &matrix); } diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp index 9a4767520c..6e066dd415 100644 --- a/src/core/SkFont.cpp +++ b/src/core/SkFont.cpp @@ -270,7 +270,7 @@ void SkFont::getWidthsBounds(const SkGlyphID glyphIDs[], SkScalar scale = strikeSpec.strikeToSourceRatio(); if (bounds) { - SkMatrix scaleMat = SkMatrix::MakeScale(scale); + SkMatrix scaleMat = SkMatrix::Scale(scale, scale); SkRect* cursor = bounds; for (auto glyph : glyphs) { scaleMat.mapRectScaleTranslate(cursor++, glyph->rect()); @@ -316,7 +316,7 @@ void SkFont::getPaths(const SkGlyphID glyphIDs[], int count, void (*proc)(const SkPath*, const SkMatrix&, void*), void* ctx) const { SkFont font(*this); SkScalar scale = font.setupForAsPaths(nullptr); - const SkMatrix mx = SkMatrix::MakeScale(scale); + const SkMatrix mx = SkMatrix::Scale(scale, scale); SkStrikeSpec strikeSpec = SkStrikeSpec::MakeWithNoDevice(font); SkBulkGlyphMetricsAndPaths paths{strikeSpec}; diff --git a/src/core/SkFontPriv.h b/src/core/SkFontPriv.h index 6b7bd862b8..5d07909440 100644 --- a/src/core/SkFontPriv.h +++ b/src/core/SkFontPriv.h @@ -37,7 +37,7 @@ public: * Return a matrix that applies the paint's text values: size, scale, skew */ static SkMatrix MakeTextMatrix(SkScalar size, SkScalar scaleX, SkScalar skewX) { - SkMatrix m = SkMatrix::MakeScale(size * scaleX, size); + SkMatrix m = SkMatrix::Scale(size * scaleX, size); if (skewX) { m.postSkew(skewX, 0); } diff --git a/src/core/SkImageFilterTypes.cpp b/src/core/SkImageFilterTypes.cpp index f2f6667967..ab967239e5 100644 --- a/src/core/SkImageFilterTypes.cpp +++ b/src/core/SkImageFilterTypes.cpp @@ -37,7 +37,7 @@ Mapping Mapping::Make(const SkMatrix& ctm, const SkImageFilter* filter) { // TODO (michaelludwig) - Should maybe strip out any fractional part of the translation in // 'ctm' so that can be incorporated during regular drawing, instead of by resampling the // filtered image. - layer = SkMatrix::MakeScale(scale.fWidth, scale.fHeight); + layer = SkMatrix::Scale(scale.fWidth, scale.fHeight); } else { // Perspective // TODO (michaelludwig) - Should investigate choosing a scale factor for the layer matrix diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index a9e053eb4a..725db7edcf 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -241,11 +241,11 @@ void SkPictureRecord::didConcat44(const SkM44& m) { } void SkPictureRecord::didScale(SkScalar x, SkScalar y) { - this->didConcat(SkMatrix::MakeScale(x, y)); + this->didConcat(SkMatrix::Scale(x, y)); } void SkPictureRecord::didTranslate(SkScalar x, SkScalar y) { - this->didConcat(SkMatrix::MakeTrans(x, y)); + this->didConcat(SkMatrix::Translate(x, y)); } void SkPictureRecord::didConcat(const SkMatrix& matrix) { diff --git a/src/effects/SkOpPathEffect.cpp b/src/effects/SkOpPathEffect.cpp index 3a2d820e95..d63e2f07d1 100644 --- a/src/effects/SkOpPathEffect.cpp +++ b/src/effects/SkOpPathEffect.cpp @@ -57,7 +57,7 @@ sk_sp SkMatrixPathEffect::MakeTranslate(SkScalar dx, SkScalar dy) if (!SkScalarsAreFinite(dx, dy)) { return nullptr; } - return sk_sp(new SkMatrixPE(SkMatrix::MakeTrans(dx, dy))); + return sk_sp(new SkMatrixPE(SkMatrix::Translate(dx, dy))); } sk_sp SkMatrixPathEffect::Make(const SkMatrix& matrix) { diff --git a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp index 9984491aab..2080c5cb87 100644 --- a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp +++ b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp @@ -168,7 +168,7 @@ sk_sp SkAlphaThresholdFilterImpl::onFilterImage(const Context& c auto textureFP = GrTextureEffect::Make( std::move(inputView), input->alphaType(), - SkMatrix::MakeTrans(input->subset().x(), input->subset().y())); + SkMatrix::Translate(input->subset().x(), input->subset().y())); textureFP = GrColorSpaceXformEffect::Make(std::move(textureFP), input->getColorSpace(), input->alphaType(), ctx.colorSpace()); if (!textureFP) { diff --git a/src/effects/imagefilters/SkArithmeticImageFilter.cpp b/src/effects/imagefilters/SkArithmeticImageFilter.cpp index b357cb8fef..df7465fd81 100644 --- a/src/effects/imagefilters/SkArithmeticImageFilter.cpp +++ b/src/effects/imagefilters/SkArithmeticImageFilter.cpp @@ -354,7 +354,7 @@ sk_sp ArithmeticImageFilterImpl::filterImageGPU( if (background) { SkRect bgSubset = SkRect::Make(background->subset()); - SkMatrix backgroundMatrix = SkMatrix::MakeTrans( + SkMatrix backgroundMatrix = SkMatrix::Translate( SkIntToScalar(bgSubset.left() - backgroundOffset.fX), SkIntToScalar(bgSubset.top() - backgroundOffset.fY)); bgFP = GrTextureEffect::MakeSubset(std::move(backgroundView), background->alphaType(), @@ -369,7 +369,7 @@ sk_sp ArithmeticImageFilterImpl::filterImageGPU( if (foreground) { SkRect fgSubset = SkRect::Make(foreground->subset()); - SkMatrix foregroundMatrix = SkMatrix::MakeTrans( + SkMatrix foregroundMatrix = SkMatrix::Translate( SkIntToScalar(fgSubset.left() - foregroundOffset.fX), SkIntToScalar(fgSubset.top() - foregroundOffset.fY)); auto fgFP = GrTextureEffect::MakeSubset(std::move(foregroundView), foreground->alphaType(), diff --git a/src/effects/imagefilters/SkDisplacementMapEffect.cpp b/src/effects/imagefilters/SkDisplacementMapEffect.cpp index aa926f8905..14e541d75d 100644 --- a/src/effects/imagefilters/SkDisplacementMapEffect.cpp +++ b/src/effects/imagefilters/SkDisplacementMapEffect.cpp @@ -338,7 +338,7 @@ sk_sp SkDisplacementMapEffectImpl::onFilterImage(const Context& } const auto isProtected = colorView.proxy()->isProtected(); - SkMatrix offsetMatrix = SkMatrix::MakeTrans(SkIntToScalar(colorOffset.fX - displOffset.fX), + SkMatrix offsetMatrix = SkMatrix::Translate(SkIntToScalar(colorOffset.fX - displOffset.fX), SkIntToScalar(colorOffset.fY - displOffset.fY)); std::unique_ptr fp = @@ -472,12 +472,12 @@ std::unique_ptr GrDisplacementMapEffect::Make(SkColorChanne GrSamplerState::Filter::kNearest); auto colorEffect = GrTextureEffect::MakeSubset(std::move(color), kPremul_SkAlphaType, - SkMatrix::MakeTrans(colorSubset.topLeft()), + SkMatrix::Translate(colorSubset.topLeft()), kColorSampler, SkRect::Make(colorSubset), caps); - auto dispM = SkMatrix::Concat(SkMatrix::MakeTrans(displSubset.topLeft()), offsetMatrix); + auto dispM = SkMatrix::Concat(SkMatrix::Translate(displSubset.topLeft()), offsetMatrix); auto dispEffect = GrTextureEffect::Make(std::move(displacement), kPremul_SkAlphaType, dispM, diff --git a/src/effects/imagefilters/SkXfermodeImageFilter.cpp b/src/effects/imagefilters/SkXfermodeImageFilter.cpp index 84a2764e2c..ff9af1c15d 100644 --- a/src/effects/imagefilters/SkXfermodeImageFilter.cpp +++ b/src/effects/imagefilters/SkXfermodeImageFilter.cpp @@ -264,7 +264,7 @@ sk_sp SkXfermodeImageFilterImpl::filterImageGPU( if (backgroundView.asTextureProxy()) { SkRect bgSubset = SkRect::Make(background->subset()); - SkMatrix bgMatrix = SkMatrix::MakeTrans( + SkMatrix bgMatrix = SkMatrix::Translate( SkIntToScalar(bgSubset.left() - backgroundOffset.fX), SkIntToScalar(bgSubset.top() - backgroundOffset.fY)); bgFP = GrTextureEffect::MakeSubset(std::move(backgroundView), background->alphaType(), @@ -279,7 +279,7 @@ sk_sp SkXfermodeImageFilterImpl::filterImageGPU( if (foregroundView.asTextureProxy()) { SkRect fgSubset = SkRect::Make(foreground->subset()); - SkMatrix fgMatrix = SkMatrix::MakeTrans( + SkMatrix fgMatrix = SkMatrix::Translate( SkIntToScalar(fgSubset.left() - foregroundOffset.fX), SkIntToScalar(fgSubset.top() - foregroundOffset.fY)); auto fgFP = GrTextureEffect::MakeSubset(std::move(foregroundView), foreground->alphaType(), diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp index 66c145da00..ebbfe91495 100644 --- a/src/gpu/GrBlurUtils.cpp +++ b/src/gpu/GrBlurUtils.cpp @@ -53,7 +53,7 @@ static bool draw_mask(GrRenderTargetContext* renderTargetContext, return false; } - SkMatrix matrix = SkMatrix::MakeTrans(-SkIntToScalar(maskRect.fLeft), + SkMatrix matrix = SkMatrix::Translate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRect.fTop)); matrix.preConcat(viewMatrix); paint.addCoverageFragmentProcessor( diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp index 37121fd858..f0f31a6672 100644 --- a/src/gpu/GrClipStackClip.cpp +++ b/src/gpu/GrClipStackClip.cpp @@ -79,7 +79,7 @@ static std::unique_ptr create_fp_for_mask(GrSurfaceProxyVie const GrCaps& caps) { GrSamplerState samplerState(GrSamplerState::WrapMode::kClampToBorder, GrSamplerState::Filter::kNearest); - auto m = SkMatrix::MakeTrans(-devBound.fLeft, -devBound.fTop); + auto m = SkMatrix::Translate(-devBound.fLeft, -devBound.fTop); auto subset = SkRect::Make(devBound.size()); // We scissor to devBounds. The mask's texel centers are aligned to device space // pixel centers. Hence this domain of texture coordinates. diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 5c3dc0f677..0990e76167 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -2011,7 +2011,7 @@ void GrRenderTargetContext::asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvC // TODO: Use one transfer buffer for all three planes to reduce map/unmap cost? - auto texMatrix = SkMatrix::MakeTrans(x, y); + auto texMatrix = SkMatrix::Translate(x, y); SkRect dstRectY = SkRect::Make(dstSize); SkRect dstRectUV = SkRect::MakeWH(halfW, halfH); diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp index 6646caeadb..ec0ce467c1 100644 --- a/src/gpu/GrSoftwarePathRenderer.cpp +++ b/src/gpu/GrSoftwarePathRenderer.cpp @@ -161,7 +161,7 @@ void GrSoftwarePathRenderer::DrawToTargetWithShapeMask( // We use device coords to compute the texture coordinates. We take the device coords and apply // a translation so that the top-left of the device bounds maps to 0,0, and then a scaling // matrix to normalized coords. - SkMatrix maskMatrix = SkMatrix::MakeTrans(SkIntToScalar(-textureOriginInDeviceSpace.fX), + SkMatrix maskMatrix = SkMatrix::Translate(SkIntToScalar(-textureOriginInDeviceSpace.fX), SkIntToScalar(-textureOriginInDeviceSpace.fY)); maskMatrix.preConcat(viewMatrix); diff --git a/src/gpu/effects/GrAlphaThresholdFragmentProcessor.fp b/src/gpu/effects/GrAlphaThresholdFragmentProcessor.fp index 4eb3a4eeef..4373512fd4 100644 --- a/src/gpu/effects/GrAlphaThresholdFragmentProcessor.fp +++ b/src/gpu/effects/GrAlphaThresholdFragmentProcessor.fp @@ -28,7 +28,7 @@ in uniform half outerThreshold; } @coordTransform(mask) { - SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())) + SkMatrix::Translate(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())) } @cpp { diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp index 114f54b2aa..6e70b20ae3 100644 --- a/src/gpu/effects/GrYUVtoRGBEffect.cpp +++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp @@ -74,7 +74,7 @@ std::unique_ptr GrYUVtoRGBEffect::Make(GrSurfaceProxyView v dimensions.height() == yDimensions.height() / 2 + 1) { sy = 0.5f; } - *planeMatrix.writable() = SkMatrix::MakeScale(sx, sy); + *planeMatrix.writable() = SkMatrix::Scale(sx, sy); planeMatrix.writable()->preConcat(localMatrix); planeFilter = subsampledPlaneFilterMode; if (subset) { diff --git a/src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.h b/src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.h index c4de913733..68e9465e4b 100644 --- a/src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.h +++ b/src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.h @@ -41,7 +41,7 @@ private: const SkIRect& bounds) : INHERITED(kGrAlphaThresholdFragmentProcessor_ClassID, kNone_OptimizationFlags) , maskCoordTransform( - SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())), + SkMatrix::Translate(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())), mask.proxy(), mask.origin()) , mask(std::move(mask)) diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp index 737bea301a..d708561e3e 100644 --- a/src/gpu/text/GrTextBlob.cpp +++ b/src/gpu/text/GrTextBlob.cpp @@ -520,8 +520,8 @@ void GrTextBlob::addOp(GrTextTarget* target, // Calculate the matrix that maps the path glyphs from their size in the strike to // the graphics source space. - SkMatrix strikeToSource = SkMatrix::MakeScale( - subRun->fStrikeSpec.strikeToSourceRatio()); + SkScalar scale = subRun->fStrikeSpec.strikeToSourceRatio(); + SkMatrix strikeToSource = SkMatrix::Scale(scale, scale); strikeToSource.postTranslate(drawOrigin.x(), drawOrigin.y()); if (!needsExactCTM) { for (const auto& pathPos : subRun->fPaths) { diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 9aba1e3122..fff0c33b1b 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -284,7 +284,7 @@ sk_sp SkImage::makeWithFilter(GrContext* grContext, // subset's top left corner. But the clip bounds and any crop rects on the filters are in the // original coordinate system, so configure the CTM to correct crop rects and explicitly adjust // the clip bounds (since it is assumed to already be in image space). - SkImageFilter_Base::Context context(SkMatrix::MakeTrans(-subset.x(), -subset.y()), + SkImageFilter_Base::Context context(SkMatrix::Translate(-subset.x(), -subset.y()), clipBounds.makeOffset(-subset.topLeft()), cache.get(), fInfo.colorType(), fInfo.colorSpace(), srcSpecialImage.get()); diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 8017ab5a0f..67bb2d4466 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -740,7 +740,7 @@ struct PositionedGlyph { static SkRect get_glyph_bounds_device_space(const SkGlyph* glyph, SkScalar xScale, SkScalar yScale, SkPoint xy, const SkMatrix& ctm) { - SkRect glyphBounds = SkMatrix::MakeScale(xScale, yScale).mapRect(glyph->rect()); + SkRect glyphBounds = SkMatrix::Scale(xScale, yScale).mapRect(glyph->rect()); glyphBounds.offset(xy); ctm.mapRect(&glyphBounds); // now in dev space. return glyphBounds; @@ -1000,7 +1000,7 @@ void SkPDFDevice::drawDevice(SkBaseDevice* device, int x, int y, const SkPaint& return; } - SkMatrix matrix = SkMatrix::MakeTrans(SkIntToScalar(x), SkIntToScalar(y)); + SkMatrix matrix = SkMatrix::Translate(SkIntToScalar(x), SkIntToScalar(y)); ScopedContentEntry content(this, &this->cs(), matrix, paint); if (!content) { return; diff --git a/src/shaders/gradients/SkSweepGradient.cpp b/src/shaders/gradients/SkSweepGradient.cpp index b8a8c51977..1cd7a05098 100644 --- a/src/shaders/gradients/SkSweepGradient.cpp +++ b/src/shaders/gradients/SkSweepGradient.cpp @@ -13,7 +13,7 @@ SkSweepGradient::SkSweepGradient(const SkPoint& center, SkScalar t0, SkScalar t1, const Descriptor& desc) - : SkGradientShaderBase(desc, SkMatrix::MakeTrans(-center.x(), -center.y())) + : SkGradientShaderBase(desc, SkMatrix::Translate(-center.x(), -center.y())) , fCenter(center) , fTBias(-t0) , fTScale(1 / (t1 - t0)) @@ -64,8 +64,7 @@ void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { void SkSweepGradient::appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* p, SkRasterPipeline*) const { p->append(SkRasterPipeline::xy_to_unit_angle); - p->append_matrix(alloc, SkMatrix::Concat(SkMatrix::MakeScale(fTScale, 1), - SkMatrix::MakeTrans(fTBias , 0))); + p->append_matrix(alloc, SkMatrix::Scale(fTScale, 1) * SkMatrix::Translate(fTBias, 0)); } skvm::F32 SkSweepGradient::transformT(skvm::Builder* p, skvm::Uniforms* uniforms, diff --git a/src/shaders/gradients/SkTwoPointConicalGradient.cpp b/src/shaders/gradients/SkTwoPointConicalGradient.cpp index 811d719b9d..42b3d6f71b 100644 --- a/src/shaders/gradients/SkTwoPointConicalGradient.cpp +++ b/src/shaders/gradients/SkTwoPointConicalGradient.cpp @@ -62,7 +62,7 @@ sk_sp SkTwoPointConicalGradient::Create(const SkPoint& c0, SkScalar r0 } // Concentric case: we can pretend we're radial (with a tiny twist). const SkScalar scale = sk_ieee_float_divide(1, std::max(r0, r1)); - gradientMatrix = SkMatrix::MakeTrans(-c1.x(), -c1.y()); + gradientMatrix = SkMatrix::Translate(-c1.x(), -c1.y()); gradientMatrix.postScale(scale, scale); gradientType = Type::kRadial; @@ -188,8 +188,7 @@ void SkTwoPointConicalGradient::appendGradientStages(SkArenaAlloc* alloc, SkRast auto scale = std::max(fRadius1, fRadius2) / dRadius; auto bias = -fRadius1 / dRadius; - p->append_matrix(alloc, SkMatrix::Concat(SkMatrix::MakeTrans(bias, 0), - SkMatrix::MakeScale(scale, 1))); + p->append_matrix(alloc, SkMatrix::Translate(bias, 0) * SkMatrix::Scale(scale, 1)); return; } diff --git a/src/sksl/SkSLCPPUniformCTypes.cpp b/src/sksl/SkSLCPPUniformCTypes.cpp index 061ad55c71..f18c410f2a 100644 --- a/src/sksl/SkSLCPPUniformCTypes.cpp +++ b/src/sksl/SkSLCPPUniformCTypes.cpp @@ -176,7 +176,7 @@ static const std::vector& get_mappers() { REGISTER(Layout::CType::kSkMatrix, { "half3x3", "float3x3", "double3x3" }, "${pdman}.setSkMatrix(${uniform}, ${var})", // to gpu - "SkMatrix::MakeScale(SK_FloatNaN)", // default value + "SkMatrix::Scale(SK_FloatNaN, SK_FloatNaN)", // default value "!${oldVar}.cheapEqualTo(${newVar})"), // dirty check REGISTER(Layout::CType::kSkM44, { "half4x4", "float4x4", "double4x4" }, diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp index 7bdeb482da..3a094c3f5f 100644 --- a/src/utils/SkLuaCanvas.cpp +++ b/src/utils/SkLuaCanvas.cpp @@ -114,10 +114,10 @@ void SkLuaCanvas::didConcat44(const SkM44&) { // TODO } void SkLuaCanvas::didScale(SkScalar x, SkScalar y) { - this->didConcat(SkMatrix::MakeScale(x, y)); + this->didConcat(SkMatrix::Scale(x, y)); } void SkLuaCanvas::didTranslate(SkScalar x, SkScalar y) { - this->didConcat(SkMatrix::MakeTrans(x, y)); + this->didConcat(SkMatrix::Translate(x, y)); } void SkLuaCanvas::didConcat(const SkMatrix& matrix) { switch (matrix.getType()) { diff --git a/src/utils/SkShadowUtils.cpp b/src/utils/SkShadowUtils.cpp index 869997f7b3..ade48e38b0 100644 --- a/src/utils/SkShadowUtils.cpp +++ b/src/utils/SkShadowUtils.cpp @@ -594,8 +594,7 @@ void SkBaseDevice::drawShadow(const SkPath& path, const SkDrawShadowRec& rec) { SkAutoDeviceTransformRestore adr( this, hasPerspective ? SkMatrix::I() - : SkMatrix::Concat(this->localToDevice(), - SkMatrix::MakeTrans(tx, ty))); + : this->localToDevice() * SkMatrix::Translate(tx, ty)); this->drawVertices(vertices, mode, paint); } }; diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index c6c47d8fc1..4c228dc3d9 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -245,10 +245,10 @@ static CanvasTest kCanvasTests[] = { c->skew(SkIntToScalar(1), SkIntToScalar(2)); }, [](SkCanvas* c, skiatest::Reporter* r) { - c->concat(SkMatrix::MakeScale(2, 3)); + c->concat(SkMatrix::Scale(2, 3)); }, [](SkCanvas* c, skiatest::Reporter* r) { - c->setMatrix(SkMatrix::MakeScale(2, 3)); + c->setMatrix(SkMatrix::Scale(2, 3)); }, [](SkCanvas* c, skiatest::Reporter* r) { c->clipRect(kRect); diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index 2c5f4739e7..1b4979d373 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -1385,7 +1385,7 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { SkScalar tx = SkScalarRoundToScalar(sx * alignedRect.x()) - sx * alignedRect.x(); SkScalar ty = SkScalarRoundToScalar(sy * alignedRect.y()) - sy * alignedRect.y(); - SkMatrix xform = SkMatrix::MakeScale(sx, sy); + SkMatrix xform = SkMatrix::Scale(sx, sy); xform.postTranslate(tx, ty); xform.mapRect(&alignedRect); xform.mapRect(&rect); diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp index 6deb485191..f7976fee3d 100644 --- a/tests/GrCCPRTest.cpp +++ b/tests/GrCCPRTest.cpp @@ -409,7 +409,7 @@ protected: class CCPR_cache_animationAtlasReuse : public CCPRCacheTest { void onRun(skiatest::Reporter* reporter, CCPRPathDrawer& ccpr, const RecordLastMockAtlasIDs& atlasIDRecorder) override { - SkMatrix m = SkMatrix::MakeTrans(kCanvasSize/2, kCanvasSize/2); + SkMatrix m = SkMatrix::Translate(kCanvasSize/2, kCanvasSize/2); m.preScale(80, 80); m.preTranslate(-.5,-.5); this->drawPathsAndFlush(ccpr, m); @@ -454,7 +454,7 @@ DEF_CCPR_TEST(CCPR_cache_animationAtlasReuse) class CCPR_cache_recycleEntries : public CCPRCacheTest { void onRun(skiatest::Reporter* reporter, CCPRPathDrawer& ccpr, const RecordLastMockAtlasIDs& atlasIDRecorder) override { - SkMatrix m = SkMatrix::MakeTrans(kCanvasSize/2, kCanvasSize/2); + SkMatrix m = SkMatrix::Translate(kCanvasSize/2, kCanvasSize/2); m.preScale(80, 80); m.preTranslate(-.5,-.5); @@ -499,9 +499,9 @@ class CCPR_cache_mostlyVisible : public CCPRCacheTest { void onRun(skiatest::Reporter* reporter, CCPRPathDrawer& ccpr, const RecordLastMockAtlasIDs& atlasIDRecorder) override { SkMatrix matrices[3] = { - SkMatrix::MakeScale(kCanvasSize/2, kCanvasSize/2), // Fully visible. - SkMatrix::MakeScale(kCanvasSize * 1.25, kCanvasSize * 1.25), // Mostly visible. - SkMatrix::MakeScale(kCanvasSize * 1.5, kCanvasSize * 1.5), // Mostly NOT visible. + SkMatrix::Scale(kCanvasSize/2, kCanvasSize/2), // Fully visible. + SkMatrix::Scale(kCanvasSize * 1.25, kCanvasSize * 1.25), // Mostly visible. + SkMatrix::Scale(kCanvasSize * 1.5, kCanvasSize * 1.5), // Mostly NOT visible. }; for (int i = 0; i < 10; ++i) { @@ -553,7 +553,7 @@ DEF_CCPR_TEST(CCPR_cache_mostlyVisible) class CCPR_cache_deferredCleanup : public CCPRCacheTest { void onRun(skiatest::Reporter* reporter, CCPRPathDrawer& ccpr, const RecordLastMockAtlasIDs& atlasIDRecorder) override { - SkMatrix m = SkMatrix::MakeScale(20, 20); + SkMatrix m = SkMatrix::Scale(20, 20); int lastRenderedAtlasID = 0; for (int i = 0; i < 5; ++i) { @@ -590,7 +590,7 @@ class CCPR_cache_hashTable : public CCPRCacheTest { void onRun(skiatest::Reporter* reporter, CCPRPathDrawer& ccpr, const RecordLastMockAtlasIDs& atlasIDRecorder) override { using CoverageType = GrCCAtlas::CoverageType; - SkMatrix m = SkMatrix::MakeScale(20, 20); + SkMatrix m = SkMatrix::Scale(20, 20); for (int i = 0; i < 5; ++i) { this->drawPathsAndFlush(ccpr, m); @@ -688,7 +688,7 @@ class CCPR_cache_multiTileCache : public CCPRCacheTest { void onRun(skiatest::Reporter* reporter, CCPRPathDrawer& ccpr, const RecordLastMockAtlasIDs& atlasIDRecorder) override { // Make sure a path drawn over 9 tiles gets cached (1 tile out of 9 is >10% visibility). - const SkMatrix m0 = SkMatrix::MakeScale(kCanvasSize*3, kCanvasSize*3); + const SkMatrix m0 = SkMatrix::Scale(kCanvasSize*3, kCanvasSize*3); const SkPath p0 = fPaths[0]; for (int i = 0; i < 9; ++i) { static constexpr int kRowOrder[9] = {0,1,1,0,2,2,2,1,0}; @@ -711,7 +711,7 @@ class CCPR_cache_multiTileCache : public CCPRCacheTest { } // Now make sure paths don't get cached when visibility is <10% for every draw (12 tiles). - const SkMatrix m1 = SkMatrix::MakeScale(kCanvasSize*4, kCanvasSize*3); + const SkMatrix m1 = SkMatrix::Scale(kCanvasSize*4, kCanvasSize*3); const SkPath p1 = fPaths[1]; for (int row = 0; row < 3; ++row) { for (int col = 0; col < 4; ++col) { @@ -751,8 +751,8 @@ class CCPR_cache_partialInvalidate : public CCPRCacheTest { void onRun(skiatest::Reporter* reporter, CCPRPathDrawer& ccpr, const RecordLastMockAtlasIDs& atlasIDRecorder) override { SkMatrix matrices[2] = { - SkMatrix::MakeTrans(5, 5), - SkMatrix::MakeTrans(kCanvasSize - kPathSize - 5, kCanvasSize - kPathSize - 5) + SkMatrix::Translate(5, 5), + SkMatrix::Translate(kCanvasSize - kPathSize - 5, kCanvasSize - kPathSize - 5) }; matrices[0].preScale(kPathSize, kPathSize); matrices[1].preScale(kPathSize, kPathSize); diff --git a/tests/GrQuadCropTest.cpp b/tests/GrQuadCropTest.cpp index 255cc77562..ded0b24072 100644 --- a/tests/GrQuadCropTest.cpp +++ b/tests/GrQuadCropTest.cpp @@ -232,8 +232,8 @@ static void test_crop_fully_covered(skiatest::Reporter* r, const SkMatrix& viewM TEST(AxisAligned) { test_axis_aligned(r, SkMatrix::I()); - test_axis_aligned(r, SkMatrix::MakeScale(-1.f, 1.f)); - test_axis_aligned(r, SkMatrix::MakeScale(1.f, -1.f)); + test_axis_aligned(r, SkMatrix::Scale(-1.f, 1.f)); + test_axis_aligned(r, SkMatrix::Scale(1.f, -1.f)); SkMatrix rotation; rotation.setRotate(90.f); diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp index 0a3433422a..e5fb544027 100644 --- a/tests/ImageFilterCacheTest.cpp +++ b/tests/ImageFilterCacheTest.cpp @@ -73,7 +73,7 @@ static void test_dont_find_if_diff_key(skiatest::Reporter* reporter, SkIRect clip2 = SkIRect::MakeWH(200, 200); SkImageFilterCacheKey key0(0, SkMatrix::I(), clip1, image->uniqueID(), image->subset()); SkImageFilterCacheKey key1(1, SkMatrix::I(), clip1, image->uniqueID(), image->subset()); - SkImageFilterCacheKey key2(0, SkMatrix::MakeTrans(5, 5), clip1, + SkImageFilterCacheKey key2(0, SkMatrix::Translate(5, 5), clip1, image->uniqueID(), image->subset()); SkImageFilterCacheKey key3(0, SkMatrix::I(), clip2, image->uniqueID(), image->subset()); SkImageFilterCacheKey key4(0, SkMatrix::I(), clip1, subset->uniqueID(), subset->subset()); diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index bfadf35e83..212da864ec 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -1915,7 +1915,7 @@ DEF_TEST(ImageSourceBounds, reporter) { REPORTER_ASSERT(reporter, input == source1->filterBounds(input, SkMatrix::I(), SkImageFilter::kReverse_MapDirection, &input)); - SkMatrix scale(SkMatrix::MakeScale(2)); + SkMatrix scale(SkMatrix::Scale(2, 2)); SkIRect scaledBounds = SkIRect::MakeWH(128, 128); REPORTER_ASSERT(reporter, scaledBounds == source1->filterBounds(input, scale, diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp index b44f1135f0..8ac2d53754 100644 --- a/tests/MatrixTest.cpp +++ b/tests/MatrixTest.cpp @@ -794,7 +794,7 @@ static bool check_decompScale(const SkMatrix& original) { original.mapPoints(v1, testPts, kNumPoints); SkPoint v2[kNumPoints]; - SkMatrix scaleMat = SkMatrix::MakeScale(scale.width(), scale.height()); + SkMatrix scaleMat = SkMatrix::Scale(scale.width(), scale.height()); // Note, we intend the decomposition to be applied in the order scale and then remainder but, // due to skbug.com/7211, the order is reversed! @@ -1004,7 +1004,7 @@ DEF_TEST(Matrix_maprects, r) { // We should report nonfinite-ness after a mapping { // We have special-cases in mapRect for different matrix types - SkMatrix m0 = SkMatrix::MakeScale(1e20f, 1e20f); + SkMatrix m0 = SkMatrix::Scale(1e20f, 1e20f); SkMatrix m1; m1.setRotate(30); m1.postScale(1e20f, 1e20f); for (const auto& m : { m0, m1 }) { diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp index 579097163b..386fcc8cca 100644 --- a/tests/OnFlushCallbackTest.cpp +++ b/tests/OnFlushCallbackTest.cpp @@ -590,7 +590,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) { for (int i = 0; i < kNumViews - 1; ++i) { SkRect r = SkRect::MakeXYWH(i*3*kDrawnTileSize, 0, 3*kDrawnTileSize, kDrawnTileSize); - SkMatrix t = SkMatrix::MakeTrans(-i*3*kDrawnTileSize, 0); + SkMatrix t = SkMatrix::Translate(-i*3*kDrawnTileSize, 0); GrPaint paint; auto fp = GrTextureEffect::Make(std::move(views[i]), kPremul_SkAlphaType, t); diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp index 1279a1e5ad..c637c72597 100644 --- a/tests/QuickRejectTest.cpp +++ b/tests/QuickRejectTest.cpp @@ -82,7 +82,7 @@ static void test_quick_reject(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, true == canvas.quickReject(r9)); REPORTER_ASSERT(reporter, true == canvas.quickReject(r10)); - SkMatrix m = SkMatrix::MakeScale(2.0f); + SkMatrix m = SkMatrix::Scale(2, 2); m.setTranslateX(10.0f); m.setTranslateY(10.0f); canvas.setMatrix(m); diff --git a/tests/RRectInPathTest.cpp b/tests/RRectInPathTest.cpp index 9dafad7a7f..7eb5459477 100644 --- a/tests/RRectInPathTest.cpp +++ b/tests/RRectInPathTest.cpp @@ -21,10 +21,10 @@ static SkRRect path_contains_rrect(skiatest::Reporter* reporter, const SkPath& p // Test that rotations/mirrors of the rrect path are still rrect paths and the returned // parameters for the transformed paths are correct. static const SkMatrix kMatrices[] = { - SkMatrix::MakeScale(1, 1), - SkMatrix::MakeScale(-1, 1), - SkMatrix::MakeScale(1, -1), - SkMatrix::MakeScale(-1, -1), + SkMatrix::Scale( 1, 1), + SkMatrix::Scale(-1, 1), + SkMatrix::Scale( 1, -1), + SkMatrix::Scale(-1, -1), }; for (auto& m : kMatrices) { SkPath xformed; diff --git a/tests/ShaderTest.cpp b/tests/ShaderTest.cpp index 032005428d..26b572d807 100644 --- a/tests/ShaderTest.cpp +++ b/tests/ShaderTest.cpp @@ -41,7 +41,7 @@ DEF_TEST(Shader_isAImage, reporter) { SkBitmap bm; bm.allocN32Pixels(W, H); auto img = SkImage::MakeFromBitmap(bm); - const SkMatrix localM = SkMatrix::MakeScale(2, 3); + const SkMatrix localM = SkMatrix::Scale(2, 3); const SkTileMode tmx = SkTileMode::kRepeat; const SkTileMode tmy = SkTileMode::kMirror; diff --git a/tests/SkGlyphBufferTest.cpp b/tests/SkGlyphBufferTest.cpp index 77c4c740a0..d7b78044af 100644 --- a/tests/SkGlyphBufferTest.cpp +++ b/tests/SkGlyphBufferTest.cpp @@ -170,7 +170,7 @@ DEF_TEST(SkDrawableGlyphBufferBasic, reporter) { { SkDrawableGlyphBuffer drawable; drawable.ensureSize(100); - SkMatrix matrix = SkMatrix::MakeScale(0.5); + SkMatrix matrix = SkMatrix::Scale(0.5, 0.5); SkGlyphPositionRoundingSpec rounding{true, kX_SkAxisAlignment}; drawable.startBitmapDevice(source, {100, 100}, matrix, rounding); for (auto [i, packedID, pos] : SkMakeEnumerate(drawable.input())) { diff --git a/tests/SkRemoteGlyphCacheTest.cpp b/tests/SkRemoteGlyphCacheTest.cpp index 1b870aafb8..69ebf413aa 100644 --- a/tests/SkRemoteGlyphCacheTest.cpp +++ b/tests/SkRemoteGlyphCacheTest.cpp @@ -686,7 +686,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextAsDFT, reporter, c SkFont font; // A scale transform forces fallback to dft. - SkMatrix matrix = SkMatrix::MakeScale(16); + SkMatrix matrix = SkMatrix::Scale(16, 16); SkSurfaceProps surfaceProps(0, kUnknown_SkPixelGeometry); GrTextContext::Options options; GrTextContext::SanitizeOptions(&options); diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp index cfa63251bf..df88a83fc1 100644 --- a/tests/SkResourceCacheTest.cpp +++ b/tests/SkResourceCacheTest.cpp @@ -181,8 +181,8 @@ DEF_TEST(BitmapCache_discarded_image, reporter) { // To exercise the latter, we draw scaled bitmap images using HQ filters. const SkMatrix xforms[] = { - SkMatrix::MakeScale(1, 1), - SkMatrix::MakeScale(1.7f, 0.5f), + SkMatrix::Scale(1, 1), + SkMatrix::Scale(1.7f, 0.5f), }; for (size_t i = 0; i < SK_ARRAY_COUNT(xforms); ++i) { diff --git a/tests/TriangulatingPathRendererTests.cpp b/tests/TriangulatingPathRendererTests.cpp index 9a5a8b79a0..f2abf19bca 100644 --- a/tests/TriangulatingPathRendererTests.cpp +++ b/tests/TriangulatingPathRendererTests.cpp @@ -762,7 +762,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TriangulatingPathRendererTests, reporter, ctxInfo) test_path(ctx, rtc.get(), create_path_14()); test_path(ctx, rtc.get(), create_path_15()); test_path(ctx, rtc.get(), create_path_16()); - SkMatrix nonInvertibleMatrix = SkMatrix::MakeScale(0, 0); + SkMatrix nonInvertibleMatrix = SkMatrix::Scale(0, 0); std::unique_ptr fp(create_linear_gradient_processor(ctx)); test_path(ctx, rtc.get(), create_path_17(), nonInvertibleMatrix, GrAAType::kCoverage, std::move(fp)); diff --git a/tools/debugger/DebugCanvas.cpp b/tools/debugger/DebugCanvas.cpp index 11b7608524..95d2e06e0c 100644 --- a/tools/debugger/DebugCanvas.cpp +++ b/tools/debugger/DebugCanvas.cpp @@ -328,11 +328,11 @@ void DebugCanvas::didConcat44(const SkM44& m) { } void DebugCanvas::didScale(SkScalar x, SkScalar y) { - this->didConcat(SkMatrix::MakeScale(x, y)); + this->didConcat(SkMatrix::Scale(x, y)); } void DebugCanvas::didTranslate(SkScalar x, SkScalar y) { - this->didConcat(SkMatrix::MakeTrans(x, y)); + this->didConcat(SkMatrix::Translate(x, y)); } void DebugCanvas::didConcat(const SkMatrix& matrix) { diff --git a/tools/viewer/ImGuiLayer.cpp b/tools/viewer/ImGuiLayer.cpp index 31b3a54eaa..768e2cce62 100644 --- a/tools/viewer/ImGuiLayer.cpp +++ b/tools/viewer/ImGuiLayer.cpp @@ -53,7 +53,7 @@ ImGuiLayer::ImGuiLayer() { io.Fonts->GetTexDataAsAlpha8(&pixels, &w, &h); SkImageInfo info = SkImageInfo::MakeA8(w, h); SkPixmap pmap(info, pixels, info.minRowBytes()); - SkMatrix localMatrix = SkMatrix::MakeScale(1.0f / w, 1.0f / h); + SkMatrix localMatrix = SkMatrix::Scale(1.0f / w, 1.0f / h); auto fontImage = SkImage::MakeFromRaster(pmap, nullptr, nullptr); auto fontShader = fontImage->makeShader(&localMatrix); fFontPaint.setShader(fontShader);