Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 777d2c26 authored by Seigo Nonaka's avatar Seigo Nonaka
Browse files

Recycle TemporaryBuffer for reducing object count

Bug: 216219602
Test: N/A
Change-Id: I1d0ca1719b2ec807249a47201fe62ccd06cf74e5
parent ea85bfc9
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -2184,9 +2184,13 @@ public class Paint {
                    contextCount, isRtl, outMetrics);
        } else {
            char[] buf = TemporaryBuffer.obtain(contextCount);
            try {
                TextUtils.getChars(text, contextStart, contextStart + contextCount, buf, 0);
                nGetFontMetricsIntForText(mNativePaint, buf, start - contextStart, count, 0,
                        contextCount, isRtl, outMetrics);
            } finally {
                TemporaryBuffer.recycle(buf);
            }
        }

    }