^2.. url?
EDIT.. ah, c'est bon: http://test.griffor.com/
EDIT2: t1 liquid aurait un score de malade..
)
^2.. url?
)
(faut dire que je me suis calmé sur l'alcool, mais ça ne devrait pas jouer pour les questions "avez-vous déjà...")/* time = kr_timers_stop(timer); */
/* kr_timers_start(timer); */
previously_rastered = 0;
for (i = 0; i < n_rects; i++)
{
if (rects[i].area == 0) // we need to compute it
{
rects[i].area = rects[i].extent.x * rects[i].extent.y;
if (IS_VERBOSE_SADOMASOCHIST)
kr_log_printf(KR_LOG_FORMAT("rect[%d].area == 0, computing area = %d * %d = %d\n"),
i, rects[i].extent.x, rects[i].extent.y, rects[i].area);
}
else if (IS_VERBOSE_SADOMASOCHIST)
kr_log_printf(KR_LOG_FORMAT("rect[%d].area == %d\n"), i, rects[i].area);
// here, make sure we don't modify a rect marked as already processed...
// (for such a rect, its area is negative)
if (rects[i].sort_key == 0) // we need to compute it
{
if (!rects[i].extent.x ||
!rects[i].extent.y)
{
if (IS_VERBOSE_MYHARDDRIVEFEELSLIKESUICIDE)
kr_log_printf(KR_LOG_FORMAT("skipping sort key generation for rect %d\n"), i);
rects[i].sort_key = 0;
}
else
{
e_gf_rectangle_packer_sorting_heuristic sort_style;
sort_style = map->sort;
if (sort_style == GF_RECTANGLE_PACKER_SORTING_HEURISTIC_DEFAULT)
sort_style = GF_RECTANGLE_PACKER_SORTING_HEURISTIC_DEFAULT_VALUE;
// here, switch the sort key computation according to the wished heuristic
switch (sort_style)
{
case GF_RECTANGLE_PACKER_SORTING_HEURISTIC_SURFACE:
rects[i].sort_key = rects[i].extent.x * rects[i].extent.y;
break;
case GF_RECTANGLE_PACKER_SORTING_HEURISTIC_PERIMETER:
rects[i].sort_key = rects[i].extent.x + rects[i].extent.y;
break;
case GF_RECTANGLE_PACKER_SORTING_HEURISTIC_EDGE_MAX:
rects[i].sort_key = ((rects[i].extent.x > rects[i].extent.y) ?
rects[i].extent.x : rects[i].extent.y);
break;
case GF_RECTANGLE_PACKER_SORTING_HEURISTIC_EDGE_MIN:
rects[i].sort_key = ((rects[i].extent.x < rects[i].extent.y) ?
rects[i].extent.x : rects[i].extent.y);
break;
case GF_RECTANGLE_PACKER_SORTING_HEURISTIC_EDGE_MAX_W2_MIN_W1:
if (rects[i].extent.x > rects[i].extent.y)
rects[i].sort_key = rects[i].extent.x * 2 + rects[i].extent.y;
else
rects[i].sort_key = rects[i].extent.x + rects[i].extent.y * 2;
break;
case GF_RECTANGLE_PACKER_SORTING_HEURISTIC_EDGE_MAX_W1_MIN_W2:
if (rects[i].extent.x < rects[i].extent.y)
rects[i].sort_key = rects[i].extent.x * 2 + rects[i].extent.y;
else
rects[i].sort_key = rects[i].extent.x + rects[i].extent.y * 2;
break;
default:
kr_log_wrn_printf(KR_LOG_FORMAT_WRN("unknown sort style: %d\n"), sort_style);
printf("pwet... %d\n", sort_style);
exit(0);
}
if (IS_VERBOSE_MYHARDDRIVEFEELSLIKESUICIDE)
kr_log_printf(KR_LOG_FORMAT("computed rect %d sort key: %d\n"), i, rects[i].sort_key);
}
// check for overflow, and clamp the key so we don't overwrite
// one of the additional control flags. if the key gets this big anyway (with our
// current heuristics), we might have other problems than a
// slightly incorrect sorting order...
if (rects[i].sort_key > 0x1FFFFFFF)
rects[i].sort_key = 0x1FFFFFFF;
}
else if (rects[i].sort_key < 0) // these have already been processed
{
// don't count skipped ones, only the ones that were rastered
if (!(rects[i].sort_key & 0x40000000))
previously_rastered += rects[i].area;
}
if (sort)
pr[i] = rects + i;
}
/* time = kr_timers_stop(timer); */
/* kr_timers_start(timer); */
/* printf("sort setup time: %.3f ms\n", time * 1000.0); */
if (sort)
{
kr_sort_radix_data_stride(pr,
n_rects,
(int)(&(rects[i].sort_key)) - (int)(&(rects[i].id)),
sizeof(rects->sort_key));
// kr_sort_radix_data_stride sorts them from smallest to greatest, swap the order
// while we copy everything back...
for (i = 0; i < n_rects; i++)
r[n_rects - i - 1] = *(pr[i]);
memcpy(rects, r, n_rects * sizeof(*rects));
HH_FREE(pr);
}