Added the ability to set the entire matrix at once

Prior to this CL, the only/typical way to set the matrix was by
16 set() operations, which is slower now that typeMask is not
lazily computed.

Bug: 950253
Change-Id: I72176891068c90f247475deb8e946a8bb4ced7d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206346
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mason Freed 2019-04-06 17:57:43 -07:00 committed by Skia Commit-Bot
parent 9d22700af4
commit 8cef07e707
2 changed files with 17 additions and 0 deletions

View File

@ -322,6 +322,11 @@ public:
SkMScalar m_02, SkMScalar m_12, SkMScalar m_22);
void set3x3RowMajorf(const float[]);
void set4x4(SkMScalar m_00, SkMScalar m_10, SkMScalar m_20, SkMScalar m_30,
SkMScalar m_01, SkMScalar m_11, SkMScalar m_21, SkMScalar m_31,
SkMScalar m_02, SkMScalar m_12, SkMScalar m_22, SkMScalar m_32,
SkMScalar m_03, SkMScalar m_13, SkMScalar m_23, SkMScalar m_33);
void setTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz);
void preTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz);
void postTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz);

View File

@ -241,6 +241,18 @@ void SkMatrix44::set3x4RowMajorf(const float src[]) {
this->recomputeTypeMask();
}
void SkMatrix44::set4x4(SkMScalar m_00, SkMScalar m_10, SkMScalar m_20, SkMScalar m_30,
SkMScalar m_01, SkMScalar m_11, SkMScalar m_21, SkMScalar m_31,
SkMScalar m_02, SkMScalar m_12, SkMScalar m_22, SkMScalar m_32,
SkMScalar m_03, SkMScalar m_13, SkMScalar m_23, SkMScalar m_33) {
fMat[0][0] = m_00; fMat[0][1] = m_10; fMat[0][2] = m_20; fMat[0][3] = m_30;
fMat[1][0] = m_01; fMat[1][1] = m_11; fMat[1][2] = m_21; fMat[1][3] = m_31;
fMat[2][0] = m_02; fMat[2][1] = m_12; fMat[2][2] = m_22; fMat[2][3] = m_32;
fMat[3][0] = m_03; fMat[3][1] = m_13; fMat[3][2] = m_23; fMat[3][3] = m_33;
this->recomputeTypeMask();
}
///////////////////////////////////////////////////////////////////////////////
void SkMatrix44::setTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz) {