Recycle TemporaryBuffer for reducing object count
Bug: 216219602 Test: N/A Change-Id: I1d0ca1719b2ec807249a47201fe62ccd06cf74e5
This commit is contained in:
@@ -2184,9 +2184,13 @@ public class Paint {
|
||||
contextCount, isRtl, outMetrics);
|
||||
} else {
|
||||
char[] buf = TemporaryBuffer.obtain(contextCount);
|
||||
TextUtils.getChars(text, contextStart, contextStart + contextCount, buf, 0);
|
||||
nGetFontMetricsIntForText(mNativePaint, buf, start - contextStart, count, 0,
|
||||
contextCount, isRtl, outMetrics);
|
||||
try {
|
||||
TextUtils.getChars(text, contextStart, contextStart + contextCount, buf, 0);
|
||||
nGetFontMetricsIntForText(mNativePaint, buf, start - contextStart, count, 0,
|
||||
contextCount, isRtl, outMetrics);
|
||||
} finally {
|
||||
TemporaryBuffer.recycle(buf);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user