summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2013-07-16 13:47:01 -0700
committerRomain Guy <romainguy@google.com>2013-07-16 14:52:55 -0700
commit4e7b772b733593fbe25c733e95b8dcea293234b6 (patch)
tree26acbca3bc0a543bf90655412f04d3b4ae86fb0b /libs/hwui
parentd91f8af40b8f9eb8752c432315c619e90d095b6a (diff)
downloadframeworks_base-4e7b772b733593fbe25c733e95b8dcea293234b6.zip
frameworks_base-4e7b772b733593fbe25c733e95b8dcea293234b6.tar.gz
frameworks_base-4e7b772b733593fbe25c733e95b8dcea293234b6.tar.bz2
Fix crashes in setMatrix() and concat()
setMatrix() was crashing in native code, only with hw acceleration on. concat() would throw a NullPointerException. It now ignores null matrices. Change-Id: Iebd8b410a957d2ba501570c6fbb3f680ff4a1a23
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/DisplayListOp.h6
-rw-r--r--libs/hwui/DisplayListRenderer.h13
2 files changed, 13 insertions, 6 deletions
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 2b6f4cd..5ac2511 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -468,7 +468,11 @@ public:
}
virtual void output(int level, uint32_t logFlags) const {
- OP_LOG("SetMatrix " MATRIX_STRING, MATRIX_ARGS(mMatrix));
+ if (mMatrix) {
+ OP_LOG("SetMatrix " MATRIX_STRING, MATRIX_ARGS(mMatrix));
+ } else {
+ OP_LOGS("SetMatrix (reset)");
+ }
}
virtual const char* name() { return "SetMatrix"; }
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 03f50c8..d233150 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -269,11 +269,14 @@ private:
}
inline SkMatrix* refMatrix(SkMatrix* matrix) {
- // Copying the matrix is cheap and prevents against the user changing the original
- // matrix before the operation that uses it
- SkMatrix* copy = new SkMatrix(*matrix);
- mMatrices.add(copy);
- return copy;
+ if (matrix) {
+ // Copying the matrix is cheap and prevents against the user changing
+ // the original matrix before the operation that uses it
+ SkMatrix* copy = new SkMatrix(*matrix);
+ mMatrices.add(copy);
+ return copy;
+ }
+ return matrix;
}
inline Layer* refLayer(Layer* layer) {