mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-14 17:13:40 +00:00
[gvar] Add optimize-size code path
This commit is contained in:
parent
7c9ed76d0a
commit
726590ed5f
1 changed files with 64 additions and 36 deletions
|
@ -368,50 +368,78 @@ struct gvar
|
|||
hb_memset (deltas.arrayZ, 0, deltas.get_size ());
|
||||
}
|
||||
|
||||
/* Ouch. Four cases... for optimization. */
|
||||
if (scalar != 1.0f)
|
||||
bool optimize_size =
|
||||
#ifdef HB_OPTIMIZE_SIZE
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
;
|
||||
if (optimize_size)
|
||||
{
|
||||
if (apply_to_all)
|
||||
for (unsigned int i = 0; i < num_deltas; i++)
|
||||
for (unsigned int i = 0; i < num_deltas; i++)
|
||||
{
|
||||
unsigned int pt_index;
|
||||
if (apply_to_all)
|
||||
pt_index = i;
|
||||
else
|
||||
{
|
||||
unsigned int pt_index = i;
|
||||
auto &delta = deltas.arrayZ[pt_index];
|
||||
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
|
||||
delta.x += x_deltas.arrayZ[i] * scalar;
|
||||
delta.y += y_deltas.arrayZ[i] * scalar;
|
||||
}
|
||||
else
|
||||
for (unsigned int i = 0; i < num_deltas; i++)
|
||||
{
|
||||
unsigned int pt_index = indices[i];
|
||||
pt_index = indices[i];
|
||||
if (unlikely (pt_index >= deltas.length)) continue;
|
||||
auto &delta = deltas.arrayZ[pt_index];
|
||||
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
|
||||
delta.x += x_deltas.arrayZ[i] * scalar;
|
||||
delta.y += y_deltas.arrayZ[i] * scalar;
|
||||
}
|
||||
auto &delta = deltas.arrayZ[pt_index];
|
||||
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
|
||||
delta.x += x_deltas.arrayZ[i] * scalar;
|
||||
delta.y += y_deltas.arrayZ[i] * scalar;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (apply_to_all)
|
||||
for (unsigned int i = 0; i < num_deltas; i++)
|
||||
{
|
||||
unsigned int pt_index = i;
|
||||
auto &delta = deltas.arrayZ[pt_index];
|
||||
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
|
||||
delta.x += x_deltas.arrayZ[i];
|
||||
delta.y += y_deltas.arrayZ[i];
|
||||
}
|
||||
/* Ouch. Four cases... for optimization. */
|
||||
if (scalar != 1.0f)
|
||||
{
|
||||
if (apply_to_all)
|
||||
for (unsigned int i = 0; i < num_deltas; i++)
|
||||
{
|
||||
unsigned int pt_index = i;
|
||||
auto &delta = deltas.arrayZ[pt_index];
|
||||
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
|
||||
delta.x += x_deltas.arrayZ[i] * scalar;
|
||||
delta.y += y_deltas.arrayZ[i] * scalar;
|
||||
}
|
||||
else
|
||||
for (unsigned int i = 0; i < num_deltas; i++)
|
||||
{
|
||||
unsigned int pt_index = indices[i];
|
||||
if (unlikely (pt_index >= deltas.length)) continue;
|
||||
auto &delta = deltas.arrayZ[pt_index];
|
||||
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
|
||||
delta.x += x_deltas.arrayZ[i] * scalar;
|
||||
delta.y += y_deltas.arrayZ[i] * scalar;
|
||||
}
|
||||
}
|
||||
else
|
||||
for (unsigned int i = 0; i < num_deltas; i++)
|
||||
{
|
||||
unsigned int pt_index = indices[i];
|
||||
if (unlikely (pt_index >= deltas.length)) continue;
|
||||
auto &delta = deltas.arrayZ[pt_index];
|
||||
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
|
||||
delta.x += x_deltas.arrayZ[i];
|
||||
delta.y += y_deltas.arrayZ[i];
|
||||
}
|
||||
{
|
||||
if (apply_to_all)
|
||||
for (unsigned int i = 0; i < num_deltas; i++)
|
||||
{
|
||||
unsigned int pt_index = i;
|
||||
auto &delta = deltas.arrayZ[pt_index];
|
||||
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
|
||||
delta.x += x_deltas.arrayZ[i];
|
||||
delta.y += y_deltas.arrayZ[i];
|
||||
}
|
||||
else
|
||||
for (unsigned int i = 0; i < num_deltas; i++)
|
||||
{
|
||||
unsigned int pt_index = indices[i];
|
||||
if (unlikely (pt_index >= deltas.length)) continue;
|
||||
auto &delta = deltas.arrayZ[pt_index];
|
||||
delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
|
||||
delta.x += x_deltas.arrayZ[i];
|
||||
delta.y += y_deltas.arrayZ[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* infer deltas for unreferenced points */
|
||||
|
|
Loading…
Add table
Reference in a new issue