(Overlay) Create OVERLAY_IMAGE_TRANSFER_DESC_IMAGE_ITERATE

This commit is contained in:
twinaphex 2015-03-19 23:13:25 +01:00
parent 758039c3f5
commit 97d73557d8
2 changed files with 63 additions and 3 deletions

View File

@ -147,7 +147,7 @@ static void input_overlay_free_overlays(input_overlay_t *ol)
free(ol->overlays);
}
static bool input_overlay_load_desc(input_overlay_t *ol,
static bool input_overlay_load_desc_image(input_overlay_t *ol,
struct overlay_desc *desc,
struct overlay *input_overlay,
unsigned ol_idx, unsigned desc_idx,
@ -187,6 +187,33 @@ static bool input_overlay_load_desc(input_overlay_t *ol,
}
}
input_overlay->pos ++;
if (list)
string_list_free(list);
return ret;
}
static bool input_overlay_load_desc(input_overlay_t *ol,
struct overlay_desc *desc,
struct overlay *input_overlay,
unsigned ol_idx, unsigned desc_idx,
unsigned width, unsigned height,
bool normalized, float alpha_mod, float range_mod)
{
bool ret = true, by_pixel;
char overlay_desc_key[64], conf_key[64],
overlay_desc_normalized_key[64], image_path[PATH_MAX_LENGTH];
char overlay[256], *save, *key;
float width_mod, height_mod;
struct string_list *list = NULL;
const char *x = NULL;
const char *y = NULL;
const char *box = NULL;
snprintf(overlay_desc_key, sizeof(overlay_desc_key),
"overlay%u_desc%u", ol_idx, desc_idx);
snprintf(overlay_desc_normalized_key, sizeof(overlay_desc_normalized_key),
"overlay%u_desc%u_normalized", ol_idx, desc_idx);
config_get_bool(ol->conf, overlay_desc_normalized_key, &normalized);
@ -474,9 +501,41 @@ bool input_overlay_load_overlays_iterate(input_overlay_t *ol)
break;
case OVERLAY_IMAGE_TRANSFER_DONE:
input_overlay_load_overlay_image_done(&ol->overlays[ol->pos]);
ol->loading_status = OVERLAY_IMAGE_TRANSFER_DESC_ITERATE;
ol->loading_status = OVERLAY_IMAGE_TRANSFER_DESC_IMAGE_ITERATE;
ol->overlays[ol->pos].pos = 0;
break;
case OVERLAY_IMAGE_TRANSFER_DESC_IMAGE_ITERATE:
{
struct overlay *overlay = &ol->overlays[ol->pos];
for (i = 0; i < overlay->pos_increment; i++)
{
unsigned idx = ol->pos;
if (overlay->pos < overlay->size)
{
if (!input_overlay_load_desc_image(ol, &overlay->descs[overlay->pos], overlay,
idx, overlay->pos,
overlay->image.width, overlay->image.height,
overlay->config.normalized,
overlay->config.alpha_mod, overlay->config.range_mod))
{
RARCH_ERR("[Overlay]: Failed to load overlay desc images for overlay #%u.\n",
(unsigned)overlay->pos);
goto error;
}
}
else
{
overlay->pos = 0;
ol->loading_status = OVERLAY_IMAGE_TRANSFER_DESC_ITERATE;
break;
}
}
}
break;
case OVERLAY_IMAGE_TRANSFER_DESC_ITERATE:
{
struct overlay *overlay = &ol->overlays[ol->pos];
@ -501,7 +560,7 @@ bool input_overlay_load_overlays_iterate(input_overlay_t *ol)
}
else
{
overlay->pos = 0;
overlay->pos = 0;
ol->loading_status = OVERLAY_IMAGE_TRANSFER_DESC_DONE;
break;
}

View File

@ -87,6 +87,7 @@ enum overlay_image_transfer_status
OVERLAY_IMAGE_TRANSFER_NONE = 0,
OVERLAY_IMAGE_TRANSFER_BUSY,
OVERLAY_IMAGE_TRANSFER_DONE,
OVERLAY_IMAGE_TRANSFER_DESC_IMAGE_ITERATE,
OVERLAY_IMAGE_TRANSFER_DESC_ITERATE,
OVERLAY_IMAGE_TRANSFER_DESC_DONE,
OVERLAY_IMAGE_TRANSFER_ERROR,