move onto new factories for SkMatrix
Just rename, no functional changes expected. Change-Id: Id77ab1cf6b1cab35087a7c56000750912cf47383 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290831 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
This commit is contained in:
parent
4ad6b50df3
commit
046c2b7d90
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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(
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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 ? '=' : '!');
|
||||
|
@ -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);
|
||||
|
@ -13,7 +13,7 @@ sk_sp<SkImage> 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);
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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()) {
|
||||
|
@ -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
|
||||
|
@ -121,7 +121,7 @@ static sk_sp<SkShader> 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);
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,7 @@ DEF_SIMPLE_GM(bug6783, canvas, 500, 500) {
|
||||
|
||||
sk_sp<SkImage> 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.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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<SkShader> shaders[] = {
|
||||
// gradient should appear over color bitmap
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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),
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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<SkTileMode>(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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -34,7 +34,7 @@ static sk_sp<SkImage> make_image(SkCanvas* rootCanvas, SkColor color) {
|
||||
|
||||
DEF_SIMPLE_GM(localmatriximageshader, canvas, 250, 250) {
|
||||
sk_sp<SkImage> 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<SkShader> 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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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});
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -48,8 +48,8 @@ class RuntimeShader : public skiagm::GM {
|
||||
DEF_GM(return new RuntimeShader;)
|
||||
|
||||
static sk_sp<SkShader> make_shader(sk_sp<SkImage> 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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -41,7 +41,7 @@ static sk_sp<SkShader> 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<SkShader> grad = SkGradientShader::MakeLinear(pts, colors, nullptr,
|
||||
SK_ARRAY_COUNT(colors),
|
||||
@ -51,8 +51,8 @@ static sk_sp<SkShader> make_shader1(SkScalar shaderScale) {
|
||||
return shaderScale == 1
|
||||
? grad
|
||||
: sk_make_sp<SkLocalMatrixShader>(
|
||||
sk_make_sp<SkLocalMatrixShader>(std::move(grad), SkMatrix::MakeTrans(-10, 0)),
|
||||
SkMatrix::MakeTrans(10, 0));
|
||||
sk_make_sp<SkLocalMatrixShader>(std::move(grad), SkMatrix::Translate(-10, 0)),
|
||||
SkMatrix::Translate(10, 0));
|
||||
}
|
||||
|
||||
static sk_sp<SkShader> 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<SkShader> children[] = {
|
||||
GetResourceAsImage("images/mandrill_256.png")->makeShader(),
|
||||
GetResourceAsImage("images/color_wheel.png")->makeShader(scale),
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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).
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ private:
|
||||
*
|
||||
* auto m33 = Matrix<SkMatrix>::Make(SkMatrix::I());
|
||||
* ...
|
||||
* m33->setMatrix(SkMatrix::MakeTrans(10, 10));
|
||||
* m33->setMatrix(SkMatrix::Translate(10, 10));
|
||||
*
|
||||
*/
|
||||
template <typename T>
|
||||
|
@ -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<SkRect> 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<SkRect> 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<SkRect> damage = { { 0, 0, 200, 200}, // draw1 prev bounds
|
||||
{ 100, 100, 300, 300}, // draw1 new bounds
|
||||
{ 0, 0, 100, 100}, // draw2 prev bounds
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,10 +92,10 @@ SkAnimatedImage::SkAnimatedImage(std::unique_ptr<SkAndroidCodec> 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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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<SkImageFilterCache> 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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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};
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -57,7 +57,7 @@ sk_sp<SkPathEffect> SkMatrixPathEffect::MakeTranslate(SkScalar dx, SkScalar dy)
|
||||
if (!SkScalarsAreFinite(dx, dy)) {
|
||||
return nullptr;
|
||||
}
|
||||
return sk_sp<SkPathEffect>(new SkMatrixPE(SkMatrix::MakeTrans(dx, dy)));
|
||||
return sk_sp<SkPathEffect>(new SkMatrixPE(SkMatrix::Translate(dx, dy)));
|
||||
}
|
||||
|
||||
sk_sp<SkPathEffect> SkMatrixPathEffect::Make(const SkMatrix& matrix) {
|
||||
|
@ -168,7 +168,7 @@ sk_sp<SkSpecialImage> 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) {
|
||||
|
@ -354,7 +354,7 @@ sk_sp<SkSpecialImage> 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<SkSpecialImage> 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(),
|
||||
|
@ -338,7 +338,7 @@ sk_sp<SkSpecialImage> 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<GrFragmentProcessor> fp =
|
||||
@ -472,12 +472,12 @@ std::unique_ptr<GrFragmentProcessor> 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,
|
||||
|
@ -264,7 +264,7 @@ sk_sp<SkSpecialImage> 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<SkSpecialImage> 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(),
|
||||
|
@ -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(
|
||||
|
@ -79,7 +79,7 @@ static std::unique_ptr<GrFragmentProcessor> 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.
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -74,7 +74,7 @@ std::unique_ptr<GrFragmentProcessor> 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) {
|
||||
|
@ -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))
|
||||
|
@ -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) {
|
||||
|
@ -284,7 +284,7 @@ sk_sp<SkImage> 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());
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -62,7 +62,7 @@ sk_sp<SkShader> 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;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ static const std::vector<UniformCTypeMapper>& 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" },
|
||||
|
@ -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()) {
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
@ -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,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user