Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2c38315

Browse files
reed-at-googleSkia Commit-Bot
authored andcommitted
hide/remove obsolete/tricky SkMatrix methods
Change-Id: Iee399b929e8ca1a7326a326a643539d05e333d81 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260818 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com>
1 parent c880346 commit 2c38315

31 files changed

+63
-208
lines changed

docs/examples/Matrix_063.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void draw(SkCanvas* canvas) {
88
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
99
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
1010
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
11-
matrix.postIDiv(1, 2);
11+
matrix.postScale(1, 0.5f);
1212
canvas->concat(matrix);
1313
canvas->drawBitmap(source, 0, 0);
1414
}

docs/examples/Matrix_cheapEqualTo.cpp

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/examples/Matrix_equal_operator.cpp

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/examples/Matrix_fixedStepInX.cpp

Lines changed: 0 additions & 28 deletions
This file was deleted.

docs/examples/Matrix_isFixedStepInX.cpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs/examples/Matrix_notequal_operator.cpp

Lines changed: 0 additions & 17 deletions
This file was deleted.

include/core/SkMatrix.h

Lines changed: 3 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -938,34 +938,6 @@ class SK_API SkMatrix {
938938
*/
939939
SkMatrix& postScale(SkScalar sx, SkScalar sy);
940940

941-
/** Sets SkMatrix to SkMatrix constructed from scaling by (1/divx, 1/divy),
942-
about pivot point (px, py), multiplied by SkMatrix.
943-
944-
Returns false if either divx or divy is zero.
945-
946-
Given:
947-
948-
| J K L | | sx 0 0 |
949-
Matrix = | M N O |, I(divx, divy) = | 0 sy 0 |
950-
| P Q R | | 0 0 1 |
951-
952-
where
953-
954-
sx = 1 / divx
955-
sy = 1 / divy
956-
957-
sets SkMatrix to:
958-
959-
| sx 0 0 | | J K L | | sx*J sx*K sx*L |
960-
I(divx, divy) * Matrix = | 0 sy 0 | | M N O | = | sy*M sy*N sy*O |
961-
| 0 0 1 | | P Q R | | P Q R |
962-
963-
@param divx integer divisor for inverse scale in x
964-
@param divy integer divisor for inverse scale in y
965-
@return true on successful scale
966-
*/
967-
bool postIDiv(int divx, int divy);
968-
969941
/** Sets SkMatrix to SkMatrix constructed from rotating by degrees about pivot point
970942
(px, py), multiplied by SkMatrix.
971943
This can be thought of as rotating about a pivot point after applying SkMatrix.
@@ -1561,46 +1533,6 @@ class SK_API SkMatrix {
15611533
*/
15621534
SkScalar mapRadius(SkScalar radius) const;
15631535

1564-
/** Returns true if a unit step on x-axis at some y-axis value mapped through SkMatrix
1565-
can be represented by a constant vector. Returns true if getType() returns
1566-
kIdentity_Mask, or combinations of: kTranslate_Mask, kScale_Mask, and kAffine_Mask.
1567-
1568-
May return true if getType() returns kPerspective_Mask, but only when SkMatrix
1569-
does not include rotation or skewing along the y-axis.
1570-
1571-
@return true if SkMatrix does not have complex perspective
1572-
1573-
example: https://fiddle.skia.org/c/@Matrix_isFixedStepInX
1574-
*/
1575-
bool isFixedStepInX() const;
1576-
1577-
/** Returns vector representing a unit step on x-axis at y mapped through SkMatrix.
1578-
If isFixedStepInX() is false, returned value is undefined.
1579-
1580-
@param y position of line parallel to x-axis
1581-
@return vector advance of mapped unit step on x-axis
1582-
1583-
example: https://fiddle.skia.org/c/@Matrix_fixedStepInX
1584-
*/
1585-
SkVector fixedStepInX(SkScalar y) const;
1586-
1587-
/** Returns true if SkMatrix equals m, using an efficient comparison.
1588-
1589-
Returns false when the sign of zero values is the different; when one
1590-
matrix has positive zero value and the other has negative zero value.
1591-
1592-
Returns true even when both SkMatrix contain NaN.
1593-
1594-
NaN never equals any value, including itself. To improve performance, NaN values
1595-
are treated as bit patterns that are equal if their bit patterns are equal.
1596-
1597-
@param m SkMatrix to compare
1598-
@return true if m and SkMatrix are represented by identical bit patterns
1599-
*/
1600-
bool cheapEqualTo(const SkMatrix& m) const {
1601-
return 0 == memcmp(fMat, m.fMat, sizeof(fMat));
1602-
}
1603-
16041536
/** Compares a and b; returns true if a and b are numerically equal. Returns true
16051537
even if sign of zero values are different. Returns false if either SkMatrix
16061538
contains NaN, even if the other SkMatrix also contains NaN.
@@ -1932,6 +1864,9 @@ class SK_API SkMatrix {
19321864
*/
19331865
size_t readFromMemory(const void* buffer, size_t length);
19341866

1867+
// legacy method -- still needed? why not just postScale(1/divx, ...)?
1868+
bool postIDiv(int divx, int divy);
1869+
19351870
friend class SkPerspIter;
19361871
friend class SkMatrixPriv;
19371872
friend class SkReader32;

src/core/SkBitmapProcState.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ bool SkBitmapProcInfo::init(const SkMatrix& inv, const SkPaint& paint) {
215215
// in both X and Y since clamping to width,height is just as easy as to 0xFFFF.
216216

217217
if (fTileModeX != SkTileMode::kClamp || fTileModeY != SkTileMode::kClamp) {
218-
fInvMatrix.postIDiv(fPixmap.width(), fPixmap.height());
218+
SkMatrixPriv::PostIDiv(&fInvMatrix, fPixmap.width(), fPixmap.height());
219219
}
220220

221221
// Now that all possible changes to the matrix have taken place, check

src/core/SkMatrix.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ const SkMatrix::MapXYProc SkMatrix::gMapXYProcs[] = {
12971297
};
12981298

12991299
///////////////////////////////////////////////////////////////////////////////
1300-
1300+
#if 0
13011301
// if its nearly zero (just made up 26, perhaps it should be bigger or smaller)
13021302
#define PerspNearlyZero(x) SkScalarNearlyZero(x, (1.0f / (1 << 26)))
13031303

@@ -1315,6 +1315,7 @@ SkVector SkMatrix::fixedStepInX(SkScalar y) const {
13151315
return SkVector::Make(fMat[kMScaleX] / z, fMat[kMSkewY] / z);
13161316
}
13171317
}
1318+
#endif
13181319

13191320
///////////////////////////////////////////////////////////////////////////////
13201321

src/core/SkMatrixPriv.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ class SkMatrixPriv {
150150
// Returns the recommended filterquality, assuming the caller originally wanted kHigh (bicubic)
151151
static SkFilterQuality AdjustHighQualityFilterLevel(const SkMatrix&,
152152
bool matrixIsInverse = false);
153+
154+
static bool PostIDiv(SkMatrix* matrix, int divx, int divy) {
155+
return matrix->postIDiv(divx, divy);
156+
}
157+
158+
static bool CheapEqual(const SkMatrix& a, const SkMatrix& b) {
159+
return &a == &b || 0 == memcmp(a.fMat, b.fMat, sizeof(a.fMat));
160+
}
153161
};
154162

155163
#endif

0 commit comments

Comments
 (0)