diff options
| author | 2012-11-30 15:39:11 -0800 | |
|---|---|---|
| committer | 2012-11-30 15:40:14 -0800 | |
| commit | 4ac170bd40e3fea0bae66d1f518d6cb389f3b280 (patch) | |
| tree | eb581880e0c895a6e41c7eecf0beaa129b9d16a0 /libs/hwui/TextDropShadowCache.h | |
| parent | b38f8ea546be7e1f043d2cdda78e83913ee5ea27 (diff) | |
| parent | 69fcbccf476ffc55af4da4dfedc72c3de8f91ce8 (diff) | |
Merge "Fix crash in TextDropShadowCache"
Diffstat (limited to 'libs/hwui/TextDropShadowCache.h')
| -rw-r--r-- | libs/hwui/TextDropShadowCache.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/hwui/TextDropShadowCache.h b/libs/hwui/TextDropShadowCache.h index 38bf05a0a0d1..0bed72b6b03f 100644 --- a/libs/hwui/TextDropShadowCache.h +++ b/libs/hwui/TextDropShadowCache.h @@ -35,6 +35,7 @@ struct ShadowText { flags(0), italicStyle(0.0f), scaleX(0), text(NULL), positions(NULL) { } + // len is the number of bytes in text ShadowText(SkPaint* paint, float radius, uint32_t len, const char* srcText, const float* positions): len(len), radius(radius), positions(positions) { @@ -69,11 +70,12 @@ struct ShadowText { } void copyTextLocally() { - str.setTo((const char16_t*) text, len * sizeof(char16_t)); + uint32_t charCount = len / sizeof(char16_t); + str.setTo((const char16_t*) text, charCount); text = str.string(); if (positions != NULL) { positionsCopy.clear(); - positionsCopy.appendArray(positions, len); + positionsCopy.appendArray(positions, charCount * 2); positions = positionsCopy.array(); } } |