diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2011-09-30 17:18:35 -0700 |
---|---|---|
committer | Fabrice Di Meglio <fdimeglio@google.com> | 2011-09-30 17:24:35 -0700 |
commit | 155fa38a71ff11e1617b1e3dfda770543df8eb1d (patch) | |
tree | dd0e65e3724b946856447c672b84265ed89b157a /core/jni | |
parent | d4ad7b49848371f71696ffd8bb12d19512926652 (diff) | |
download | frameworks_base-155fa38a71ff11e1617b1e3dfda770543df8eb1d.zip frameworks_base-155fa38a71ff11e1617b1e3dfda770543df8eb1d.tar.gz frameworks_base-155fa38a71ff11e1617b1e3dfda770543df8eb1d.tar.bz2 |
Fix potential issue with the TextLayoutCache with glyphs
- there may be a mapping of one char to many glyphs
Change-Id: I48846d176d61dc8d8e513ca144fdf8ad805e63b7
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android/graphics/TextLayoutCache.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index 86ae7d2..0d336ea 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -620,7 +620,9 @@ void TextLayoutCacheValue::getGlyphsIndexAndCount(size_t start, size_t count, si return; } *outStartIndex = mLogClusters[start]; - *outGlyphsCount = mLogClusters[start + count - 1] - mLogClusters[start] + 1; + size_t endIndex = (start + count >= mAdvances.size()) ? + mGlyphs.size() : mLogClusters[start + count]; + *outGlyphsCount = endIndex - *outStartIndex; #if DEBUG_GLYPHS LOGD("getGlyphsIndexes - start=%d count=%d - startIndex=%d count=%d", start, count, *outStartIndex, *outGlyphsCount); |