am c73314bc: am cf8b3b1c: Merge "Revert "Use getRunAdvance to position cursor"" into mnc-dev

* commit 'c73314bcb18f6879bb6f9923912ab38a0c831637':
  Revert "Use getRunAdvance to position cursor"
This commit is contained in:
Raph Levien
2015-06-01 20:06:24 +00:00
committed by Android Git Automerger
2 changed files with 6 additions and 5 deletions

View File

@@ -1121,7 +1121,6 @@ public abstract class Layout {
* closest to the specified horizontal position.
*/
public int getOffsetForHorizontal(int line, float horiz) {
// TODO: use Paint.getOffsetForAdvance to avoid binary search
int max = getLineEnd(line) - 1;
int min = getLineStart(line);
Directions dirs = getLineDirections(line);

View File

@@ -739,14 +739,16 @@ class TextLine {
float ret = 0;
int contextLen = contextEnd - contextStart;
if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) {
if (mCharsValid) {
ret = wp.getRunAdvance(mChars, start, contextEnd, contextStart, contextEnd,
runIsRtl, end);
ret = wp.getTextRunAdvances(mChars, start, runLen,
contextStart, contextLen, runIsRtl, null, 0);
} else {
int delta = mStart;
ret = wp.getRunAdvance(mText, delta + start, delta + contextEnd,
delta + contextStart, delta + contextEnd, runIsRtl, delta + end);
ret = wp.getTextRunAdvances(mText, delta + start,
delta + end, delta + contextStart, delta + contextEnd,
runIsRtl, null, 0);
}
}