bug fix in VarData get_delta ()

when LONG_WORDS flag is set, item row is not computed correctly
lcursor should be interpreted as INT32
This commit is contained in:
Qunxin Liu 2022-08-04 10:15:21 -07:00 committed by Behdad Esfahbod
parent b78546b1d2
commit d831e935df
1 changed files with 3 additions and 3 deletions

View File

@ -2284,19 +2284,19 @@ struct VarData
unsigned int lcount = is_long ? word_count : 0; unsigned int lcount = is_long ? word_count : 0;
const HBUINT8 *bytes = get_delta_bytes (); const HBUINT8 *bytes = get_delta_bytes ();
const HBUINT8 *row = bytes + inner * (scount + count); const HBUINT8 *row = bytes + inner * get_row_size ();
float delta = 0.; float delta = 0.;
unsigned int i = 0; unsigned int i = 0;
const HBINT16 *lcursor = reinterpret_cast<const HBINT16 *> (row); const HBINT32 *lcursor = reinterpret_cast<const HBINT32 *> (row);
for (; i < lcount; i++) for (; i < lcount; i++)
{ {
float scalar = regions.evaluate (regionIndices.arrayZ[i], coords, coord_count, cache); float scalar = regions.evaluate (regionIndices.arrayZ[i], coords, coord_count, cache);
delta += scalar * *lcursor++; delta += scalar * *lcursor++;
} }
const HBINT16 *scursor = reinterpret_cast<const HBINT16 *> (lcursor); const HBINT16 *scursor = reinterpret_cast<const HBINT16 *> (lcursor);
for (; i < scount; i++) for (; i < lcount + scount; i++)
{ {
float scalar = regions.evaluate (regionIndices.arrayZ[i], coords, coord_count, cache); float scalar = regions.evaluate (regionIndices.arrayZ[i], coords, coord_count, cache);
delta += scalar * *scursor++; delta += scalar * *scursor++;