OSDN Git Service

Some refactoring of StaticLayout
authorRaph Levien <raph@google.com>
Mon, 2 Mar 2015 22:30:53 +0000 (14:30 -0800)
committerRaph Levien <raph@google.com>
Wed, 4 Mar 2015 21:49:12 +0000 (13:49 -0800)
commitd3ab692d28018825578ff05832644cfad60233fb
treeff5e9106660f5248e67a101eaf6481133452062d
parentf63a665f92fe13f8f9d8eb58cf0987616cade9b5
Some refactoring of StaticLayout

This patch refactors construction of StaticLayout to use an explicit
Builder object, which is intended to hold state used for constructing
the layout but not needed for merely reading out the results.

Builder objects are allocated from a pool and explicitly recycled,
so there is insignificant additional allocation cost.

This patch has very little impact on performance (it does avoid
allocating a FontMetricsInt object) but opens the way for significant
performance and functionality improvements as more of the Builder
functionality migrates to native code.

Change-Id: I2a576643e573a38b61f895a80d5d92a85c94b6b4
core/java/android/text/DynamicLayout.java
core/java/android/text/MeasuredText.java
core/java/android/text/StaticLayout.java