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,31 +364,34 @@ static bool input_overlay_load_overlay(input_overlay_t *ol,
struct overlay *overlay, unsigned idx) struct overlay *overlay, unsigned idx)
{ {
size_t i; size_t i;
bool not_done = overlay->pos < overlay->size;
if (!not_done) for (i = 0; i < overlay->pos_increment; i++)
{ {
overlay->pos = 0; bool not_done = overlay->pos < overlay->size;
ol->loading_status = OVERLAY_IMAGE_TRANSFER_DESC_DONE; if (!not_done)
return true; {
} overlay->pos = 0;
ol->loading_status = OVERLAY_IMAGE_TRANSFER_DESC_DONE;
return true;
}
if (!input_overlay_load_desc(ol, &overlay->descs[overlay->pos], idx, overlay->pos, if (!input_overlay_load_desc(ol, &overlay->descs[overlay->pos], idx, overlay->pos,
overlay->image.width, overlay->image.height, overlay->image.width, overlay->image.height,
overlay->config.normalized, overlay->config.normalized,
overlay->config.alpha_mod, overlay->config.range_mod)) overlay->config.alpha_mod, overlay->config.range_mod))
{ {
RARCH_ERR("[Overlay]: Failed to load overlay descs for overlay #%u.\n", RARCH_ERR("[Overlay]: Failed to load overlay descs for overlay #%u.\n",
(unsigned)overlay->pos); (unsigned)overlay->pos);
goto error; goto error;
} }
if (overlay->descs[overlay->pos].image.pixels) if (overlay->descs[overlay->pos].image.pixels)
{ {
overlay->descs[overlay->pos].image_index = overlay->load_images_size; overlay->descs[overlay->pos].image_index = overlay->load_images_size;
overlay->load_images[overlay->load_images_size++] = overlay->descs[overlay->pos].image; overlay->load_images[overlay->load_images_size++] = overlay->descs[overlay->pos].image;
}
overlay->pos ++;
} }
overlay->pos++;
return true; return true;
@ -483,7 +486,15 @@ static bool input_overlay_load_overlay_image_done(struct overlay *overlay)
{ {
if (overlay->image.pixels) if (overlay->image.pixels)
overlay->load_images[overlay->load_images_size++] = overlay->image; overlay->load_images[overlay->load_images_size++] = overlay->image;
overlay->pos = 0; 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; return true;
} }

View File

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