Revert "Revert "move onto new factories for SkMatrix""
This reverts commit c80ee456adf664c4a62fa2ccaeaf157c723ed656.
fix: update flutter's gn file to add guard
Change-Id: Iac5171c8475d9a862d06255dab1c6f38f10de2f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291361
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 069f0a1..aeb56aa 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -574,7 +574,7 @@
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 @@
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 @@
// (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 @@
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 bf2ee61..af6b269 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -931,7 +931,7 @@
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 @@
#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 ab2fcd8..bbcec4f 100644
--- a/src/core/SkClipStackDevice.cpp
+++ b/src/core/SkClipStackDevice.cpp
@@ -44,7 +44,7 @@
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 62b0272..5e12fa5 100644
--- a/src/core/SkDrawable.cpp
+++ b/src/core/SkDrawable.cpp
@@ -43,7 +43,7 @@
}
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 9a47675..6e066dd 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -270,7 +270,7 @@
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 (*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 6b7bd86..5d07909 100644
--- a/src/core/SkFontPriv.h
+++ b/src/core/SkFontPriv.h
@@ -37,7 +37,7 @@
* 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 f2f6667..ab96723 100644
--- a/src/core/SkImageFilterTypes.cpp
+++ b/src/core/SkImageFilterTypes.cpp
@@ -37,7 +37,7 @@
// 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 a9e053e..725db7e 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -241,11 +241,11 @@
}
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) {