Add support for transformations.
This change adds partial support for the following transforms:
- scale()
- translate()
- rotate()
- setMatrix()
- getMatrix()
The transform is stored in a snapshot and saved/restored as needed.
The transform is currently not applied to the clip rect and is not
mapped to the vertex shader.
Change-Id: Id48993453311200804149917d0c126a4d0471226
diff --git a/libs/hwui/Matrix.h b/libs/hwui/Matrix.h
index 51014a9..80f3fd6 100644
--- a/libs/hwui/Matrix.h
+++ b/libs/hwui/Matrix.h
@@ -17,6 +17,8 @@
#ifndef ANDROID_MATRIX_H
#define ANDROID_MATRIX_H
+#include <SkMatrix.h>
+
namespace android {
///////////////////////////////////////////////////////////////////////////////
@@ -37,10 +39,15 @@
load(v);
}
+ Matrix4(const SkMatrix& v) {
+ load(v);
+ }
+
void loadIdentity();
void load(const float* v);
void load(const Matrix4& v);
+ void load(const SkMatrix& v);
void loadTranslate(float x, float y, float z);
void loadScale(float sx, float sy, float sz);
@@ -74,10 +81,11 @@
}
void copyTo(float* v) const;
+ void copyTo(SkMatrix& v) const;
void dump() const;
-//private:
+private:
inline float get(int i, int j) const {
return mMat[i * 4 + j];
}