Less aggressive glyphs precaching
The renderer used to pre-cache glyphs at record time. This then changed
to pre-caching at the beginning of every frame. This unfortunately entails
a lot of duplicate work on every frame, which amounts to 0.5 to 1ms in
some stock applications.
This change is somewhere in the middle: pre-caching happens the first
time a DrawTextOp is deferred or every time the screen-space transform
is different from the last pre-caching operation.
Change-Id: Id6d9e2599d90a5b75010b0f0a28746befbf3c205
diff --git a/libs/hwui/Matrix.h b/libs/hwui/Matrix.h
index 7b7357e..75e280c 100644
--- a/libs/hwui/Matrix.h
+++ b/libs/hwui/Matrix.h
@@ -93,6 +93,14 @@
return *this;
}
+ friend bool operator==(const Matrix4& a, const Matrix4& b) {
+ return !memcmp(&a.data[0], &b.data[0], 16 * sizeof(float));
+ }
+
+ friend bool operator!=(const Matrix4& a, const Matrix4& b) {
+ return !(a == b);
+ }
+
void loadIdentity();
void load(const float* v);