Take only the scale params into account to rasterize text
This change extracts the scale parameters of the current transform
to pass then to the font renderer. Rotation and perspective are
applied to the generated mesh inside the vertex shader. This limits
the number of glyphs we have to create in the font cache and thus
reduces memory churn.
Change-Id: Ic5b3bae2b2b0e0250a8ee723b071a1709725c749
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index d542315..e961af2 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -335,6 +335,12 @@
}
}
+ /**
+ * Return the best transform to use to rasterize text given a full
+ * transform matrix.
+ */
+ mat4 findBestFontTransform(const mat4& transform) const;
+
protected:
/**
* Computes the projection matrix, initialize the first snapshot
@@ -384,28 +390,28 @@
/**
* Returns the current snapshot.
*/
- sp<Snapshot> getSnapshot() {
+ sp<Snapshot> getSnapshot() const {
return mSnapshot;
}
/**
* Returns the region of the current layer.
*/
- virtual Region* getRegion() {
+ virtual Region* getRegion() const {
return mSnapshot->region;
}
/**
* Indicates whether rendering is currently targeted at a layer.
*/
- virtual bool hasLayer() {
+ virtual bool hasLayer() const {
return (mSnapshot->flags & Snapshot::kFlagFboTarget) && mSnapshot->region;
}
/**
* Returns the name of the FBO this renderer is rendering into.
*/
- virtual GLint getTargetFbo() {
+ virtual GLint getTargetFbo() const {
return 0;
}
@@ -442,7 +448,7 @@
/**
* Set to true to suppress error checks at the end of a frame.
*/
- virtual bool suppressErrorChecks() {
+ virtual bool suppressErrorChecks() const {
return false;
}