mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-30 10:04:24 +01:00
[glyf] Optimize flag decoding
This commit is contained in:
1 parent
30d58bfd0f
commit
86b7022503
1 file changed
+5
-4
@@ -170,17 +170,18 @@ struct SimpleGlyph
|
||||
endPtsOfContours[num_contours]);
|
||||
|
||||
/* Read flags */
|
||||
for (unsigned int i = 0; i < num_points; i++)
|
||||
for (unsigned int i = 0; i < num_points;)
|
||||
{
|
||||
if (unlikely (!bytes.check_range (p))) return false;
|
||||
uint8_t flag = *p++;
|
||||
points_[i].flag = flag;
|
||||
points_[i++].flag = flag;
|
||||
if (flag & FLAG_REPEAT)
|
||||
{
|
||||
if (unlikely (!bytes.check_range (p))) return false;
|
||||
unsigned int repeat_count = *p++;
|
||||
while ((repeat_count-- > 0) && (++i < num_points))
|
||||
points_[i].flag = flag;
|
||||
unsigned stop = hb_min (i + repeat_count, num_points);
|
||||
for (; i < stop;)
|
||||
points_.arrayZ[i++].flag = flag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user