diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2015-07-07 14:38:39 -0700 |
---|---|---|
committer | Deepanshu Gupta <deepanshu@google.com> | 2015-07-07 14:38:39 -0700 |
commit | cd595f1998b1331fe0efba02d96c95ee43e791da (patch) | |
tree | 1c773632834bbc49ef0d8079b6333bbacd493d19 /tools/layoutlib | |
parent | 490dd90c707de8426a068a90d74ec83c9c11fc83 (diff) | |
download | frameworks_base-cd595f1998b1331fe0efba02d96c95ee43e791da.zip frameworks_base-cd595f1998b1331fe0efba02d96c95ee43e791da.tar.gz frameworks_base-cd595f1998b1331fe0efba02d96c95ee43e791da.tar.bz2 |
Fix Paint_Delegate.native_getRunAdvance()
Bug: 22249573
Change-Id: I29f7abe6448f439059547e1c1e310d3d651ac2d8
Diffstat (limited to 'tools/layoutlib')
-rw-r--r-- | tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java index 57dd429..65b65ec 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java @@ -1171,8 +1171,9 @@ public class Paint_Delegate { float[] advances = new float[count]; native_getTextRunAdvances(nativePaint, nativeTypeface, text, start, count, contextStart, contextEnd - contextStart, isRtl, advances, 0); + int startOffset = offset - start; // offset from start. float sum = 0; - for (int i = 0; i < offset; i++) { + for (int i = 0; i < startOffset; i++) { sum += advances[i]; } return sum; |