Commit b8741ce0 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Using new set4x4 function on SkMatrix44

Because SkMatrix set() recomputes the matrix type each time,
the old code here was very inefficient. This should be better.

Bug: 950253
Change-Id: I1ee1f6f6a296b5052117dc428bcfbd770479e0ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1556634Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#650578}
parent b5b88f6b
......@@ -2080,26 +2080,11 @@ void TransformationMatrix::ToColumnMajorFloatArray(FloatMatrix4& result) const {
SkMatrix44 TransformationMatrix::ToSkMatrix44(
const TransformationMatrix& matrix) {
// TODO(masonfreed): Replace this with an explicit 16-element constructor
// on SkMatrix44, once that's available. This code does a *lot* of extra
// work, because each call to setDouble re-calculates the matrix type.
SkMatrix44 ret(SkMatrix44::kIdentity_Constructor);
ret.setDouble(0, 0, matrix.M11());
ret.setDouble(0, 1, matrix.M21());
ret.setDouble(0, 2, matrix.M31());
ret.setDouble(0, 3, matrix.M41());
ret.setDouble(1, 0, matrix.M12());
ret.setDouble(1, 1, matrix.M22());
ret.setDouble(1, 2, matrix.M32());
ret.setDouble(1, 3, matrix.M42());
ret.setDouble(2, 0, matrix.M13());
ret.setDouble(2, 1, matrix.M23());
ret.setDouble(2, 2, matrix.M33());
ret.setDouble(2, 3, matrix.M43());
ret.setDouble(3, 0, matrix.M14());
ret.setDouble(3, 1, matrix.M24());
ret.setDouble(3, 2, matrix.M34());
ret.setDouble(3, 3, matrix.M44());
SkMatrix44 ret(SkMatrix44::kUninitialized_Constructor);
ret.set4x4(matrix.M11(), matrix.M12(), matrix.M13(), matrix.M14(),
matrix.M21(), matrix.M22(), matrix.M23(), matrix.M24(),
matrix.M31(), matrix.M32(), matrix.M33(), matrix.M34(),
matrix.M41(), matrix.M42(), matrix.M43(), matrix.M44());
return ret;
}
......
......@@ -53,29 +53,10 @@ Transform::Transform(SkMScalar col1row1,
SkMScalar col2row4,
SkMScalar col3row4,
SkMScalar col4row4)
: matrix_(SkMatrix44::kIdentity_Constructor) {
// TODO(masonfreed): Replace this with an explicit 16-element constructor
// on SkMatrix44, once that's available. This code does a *lot* of extra
// work, because each call to setDouble re-calculates the matrix type.
matrix_.set(0, 0, col1row1);
matrix_.set(1, 0, col1row2);
matrix_.set(2, 0, col1row3);
matrix_.set(3, 0, col1row4);
matrix_.set(0, 1, col2row1);
matrix_.set(1, 1, col2row2);
matrix_.set(2, 1, col2row3);
matrix_.set(3, 1, col2row4);
matrix_.set(0, 2, col3row1);
matrix_.set(1, 2, col3row2);
matrix_.set(2, 2, col3row3);
matrix_.set(3, 2, col3row4);
matrix_.set(0, 3, col4row1);
matrix_.set(1, 3, col4row2);
matrix_.set(2, 3, col4row3);
matrix_.set(3, 3, col4row4);
: matrix_(SkMatrix44::kUninitialized_Constructor) {
matrix_.set4x4(col1row1, col1row2, col1row3, col1row4, col2row1, col2row2,
col2row3, col2row4, col3row1, col3row2, col3row3, col3row4,
col4row1, col4row2, col4row3, col4row4);
}
Transform::Transform(SkMScalar col1row1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment