move scaler object out of screenshot_task_state

This commit is contained in:
twinaphex 2021-09-30 02:19:16 +02:00
parent efe34f52af
commit 0e9b2179af

View File

@ -61,7 +61,6 @@ typedef struct screenshot_task_state screenshot_task_state_t;
struct screenshot_task_state
{
struct scaler_ctx scaler;
uint8_t *out_buffer;
const void *frame;
void *userbuf;
@ -84,26 +83,26 @@ struct screenshot_task_state
static bool screenshot_dump_direct(screenshot_task_state_t *state)
{
struct scaler_ctx *scaler = (struct scaler_ctx*)&state->scaler;
struct scaler_ctx scaler;
bool ret = false;
#if defined(HAVE_RPNG)
if (state->bgr24)
scaler->in_fmt = SCALER_FMT_BGR24;
scaler.in_fmt = SCALER_FMT_BGR24;
else if (state->pixel_format_type == RETRO_PIXEL_FORMAT_XRGB8888)
scaler->in_fmt = SCALER_FMT_ARGB8888;
scaler.in_fmt = SCALER_FMT_ARGB8888;
else
scaler->in_fmt = SCALER_FMT_RGB565;
scaler.in_fmt = SCALER_FMT_RGB565;
video_frame_convert_to_bgr24(
scaler,
&scaler,
state->out_buffer,
(const uint8_t*)state->frame + ((int)state->height - 1)
* state->pitch,
state->width, state->height,
-state->pitch);
scaler_ctx_gen_reset(&state->scaler);
scaler_ctx_gen_reset(&scaler);
ret = rpng_save_image_bgr24(
state->filename,