Add pos_increment to allow us to iterate through steps

This commit is contained in:
twinaphex 2015-02-23 21:14:34 +01:00
parent 89685c5709
commit 00beda42f2
2 changed files with 32 additions and 20 deletions

View File

@ -364,8 +364,10 @@ static bool input_overlay_load_overlay(input_overlay_t *ol,
struct overlay *overlay, unsigned idx)
{
size_t i;
bool not_done = overlay->pos < overlay->size;
for (i = 0; i < overlay->pos_increment; i++)
{
bool not_done = overlay->pos < overlay->size;
if (!not_done)
{
overlay->pos = 0;
@ -389,6 +391,7 @@ static bool input_overlay_load_overlay(input_overlay_t *ol,
overlay->load_images[overlay->load_images_size++] = overlay->descs[overlay->pos].image;
}
overlay->pos ++;
}
return true;
@ -483,7 +486,15 @@ static bool input_overlay_load_overlay_image_done(struct overlay *overlay)
{
if (overlay->image.pixels)
overlay->load_images[overlay->load_images_size++] = overlay->image;
overlay->pos = 0;
/* Divide iteration steps by half of total descs if size is even,
* otherwise default to 8 (arbitrary value for now to speed things up). */
overlay->pos_increment = (overlay->size / 2) ? (overlay->size / 2) : 8;
#if 0
RARCH_LOG("pos increment: %u\n", overlay->pos_increment);
#endif
return true;
}

View File

@ -124,6 +124,7 @@ struct overlay
struct overlay_desc *descs;
size_t size;
size_t pos;
unsigned pos_increment;
struct texture_image image;