Improve utf16/utf8 mismatch with ubidi.

The ubidi code only works with utf16 and SkTextBlob only with utf8. This
requires translating indexes. The current code starts cold when
translating indexes for each run, leading to taking O(n^2) time on the
number of runs. However, since this code is iterating over the runs in
order and each run begins where the last left off, simply keeping the
previous run's utf8 and utf16 end positions and using them as the next
starting position makes this O(N).

Change-Id: I921a87511fb4cdf5f6e92cd483959cf758d95306
Reviewed-on: https://skia-review.googlesource.com/41503
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
1 file changed