Fix argument names and documentation for SkMatrix44::set3x3()

Column-major is an implementation choice, not an interface. There is
exactly one acceptable subscript notation for indexing matrix elements,
and it's row first, then column. Having these named backwards was
unnecessarily confusing.

Note that this doesn't alter behavior in any way, it just brings this
function in line with expectations from any reasonable mathematician.

Change-Id: Ie4ceb40281ef507889d25403afbf24116514c45a
Reviewed-on: https://skia-review.googlesource.com/122790
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2018-04-20 12:04:06 -04:00 committed by Skia Commit-Bot
parent 1df7cd8712
commit 2fda63abcd
2 changed files with 12 additions and 12 deletions

View File

@ -328,11 +328,11 @@ public:
#endif
/* This sets the top-left of the matrix and clears the translation and
* perspective components (with [3][3] set to 1). mXY is interpreted
* as the matrix entry at col = X, row = Y. */
void set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02,
SkMScalar m10, SkMScalar m11, SkMScalar m12,
SkMScalar m20, SkMScalar m21, SkMScalar m22);
* perspective components (with [3][3] set to 1). m_ij is interpreted
* as the matrix entry at row = i, col = j. */
void set3x3(SkMScalar m_00, SkMScalar m_10, SkMScalar m_20,
SkMScalar m_01, SkMScalar m_11, SkMScalar m_21,
SkMScalar m_02, SkMScalar m_12, SkMScalar m_22);
void set3x3RowMajorf(const float[]);
void setTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz);

View File

@ -205,13 +205,13 @@ void SkMatrix44::setIdentity() {
this->setTypeMask(kIdentity_Mask);
}
void SkMatrix44::set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02,
SkMScalar m10, SkMScalar m11, SkMScalar m12,
SkMScalar m20, SkMScalar m21, SkMScalar m22) {
fMat[0][0] = m00; fMat[0][1] = m01; fMat[0][2] = m02; fMat[0][3] = 0;
fMat[1][0] = m10; fMat[1][1] = m11; fMat[1][2] = m12; fMat[1][3] = 0;
fMat[2][0] = m20; fMat[2][1] = m21; fMat[2][2] = m22; fMat[2][3] = 0;
fMat[3][0] = 0; fMat[3][1] = 0; fMat[3][2] = 0; fMat[3][3] = 1;
void SkMatrix44::set3x3(SkMScalar m_00, SkMScalar m_10, SkMScalar m_20,
SkMScalar m_01, SkMScalar m_11, SkMScalar m_21,
SkMScalar m_02, SkMScalar m_12, SkMScalar m_22) {
fMat[0][0] = m_00; fMat[0][1] = m_10; fMat[0][2] = m_20; fMat[0][3] = 0;
fMat[1][0] = m_01; fMat[1][1] = m_11; fMat[1][2] = m_21; fMat[1][3] = 0;
fMat[2][0] = m_02; fMat[2][1] = m_12; fMat[2][2] = m_22; fMat[2][3] = 0;
fMat[3][0] = 0; fMat[3][1] = 0; fMat[3][2] = 0; fMat[3][3] = 1;
this->dirtyTypeMask();
}