aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/SkMatrix44.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-17 16:01:19 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-17 16:01:19 +0000
commit2b16570bda716725e08ad2e92a852f043179c13c (patch)
treeb2c761287b8fd61e5d5463e9cd6a0c0530c4a7ed /src/utils/SkMatrix44.cpp
parent6be0b4c63dfa90fba1acf5ea538faa4d61a1681a (diff)
cherry-pick from 7241: speed-up matrix44::setconcat when both inputs are
scale+translate by inlining the zero-assignments, rather than calling sk_bzero. bench: matrix44_setconcat 2x faster git-svn-id: http://skia.googlecode.com/svn/trunk@7251 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/utils/SkMatrix44.cpp')
-rw-r--r--src/utils/SkMatrix44.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/utils/SkMatrix44.cpp b/src/utils/SkMatrix44.cpp
index 1906593acd..92c8715faa 100644
--- a/src/utils/SkMatrix44.cpp
+++ b/src/utils/SkMatrix44.cpp
@@ -360,11 +360,14 @@ void SkMatrix44::setConcat(const SkMatrix44& a, const SkMatrix44& b) {
SkMScalar storage[16];
SkMScalar* result = useStorage ? storage : &fMat[0][0];
+ // Both matrices are at most scale+translate
if (bits_isonly(a_mask | b_mask, kScale_Mask | kTranslate_Mask)) {
- sk_bzero(result, sizeof(storage));
result[0] = a.fMat[0][0] * b.fMat[0][0];
+ result[1] = result[2] = result[3] = result[4] = 0;
result[5] = a.fMat[1][1] * b.fMat[1][1];
+ result[6] = result[7] = result[8] = result[9] = 0;
result[10] = a.fMat[2][2] * b.fMat[2][2];
+ result[11] = 0;
result[12] = a.fMat[0][0] * b.fMat[3][0] + a.fMat[3][0];
result[13] = a.fMat[1][1] * b.fMat[3][1] + a.fMat[3][1];
result[14] = a.fMat[2][2] * b.fMat[3][2] + a.fMat[3][2];