mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Remove dependencies from gfx/video_frame.c
This commit is contained in:
parent
46f3e1878e
commit
279a90a01b
@ -2077,6 +2077,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
unsigned height, size_t pitch)
|
||||
{
|
||||
static char video_driver_msg[256];
|
||||
static struct retro_perf_counter video_frame_conv = {0};
|
||||
unsigned output_width = 0;
|
||||
unsigned output_height = 0;
|
||||
unsigned output_pitch = 0;
|
||||
@ -2086,6 +2087,9 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
if (!video_driver_active)
|
||||
return;
|
||||
|
||||
performance_counter_init(&video_frame_conv, "video_frame_conv");
|
||||
performance_counter_start(&video_frame_conv);
|
||||
|
||||
if (video_driver_scaler_ptr && data &&
|
||||
(video_driver_pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555) &&
|
||||
(data != RETRO_HW_FRAME_BUFFER_VALID) &&
|
||||
@ -2098,6 +2102,8 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
pitch = video_driver_scaler_ptr->scaler->out_stride;
|
||||
}
|
||||
|
||||
performance_counter_stop(&video_frame_conv);
|
||||
|
||||
video_driver_cached_frame_set(data, width, height, pitch);
|
||||
|
||||
/* Slightly messy code,
|
||||
|
@ -17,9 +17,6 @@
|
||||
|
||||
#include <libretro.h>
|
||||
|
||||
#include "../performance_counters.h"
|
||||
|
||||
#include "video_driver.h"
|
||||
#include "video_frame.h"
|
||||
|
||||
void video_frame_convert_rgb16_to_rgb32(
|
||||
@ -148,8 +145,7 @@ void video_frame_convert_argb8888_to_abgr8888(
|
||||
void video_frame_convert_to_bgr24(
|
||||
void *data,
|
||||
void *output, const void *input,
|
||||
int width, int height, int in_pitch,
|
||||
bool bgr24)
|
||||
int width, int height, int in_pitch)
|
||||
{
|
||||
struct scaler_ctx *scaler = (struct scaler_ctx*)data;
|
||||
|
||||
@ -157,12 +153,6 @@ void video_frame_convert_to_bgr24(
|
||||
scaler->in_height = height;
|
||||
scaler->out_width = width;
|
||||
scaler->out_height = height;
|
||||
if (bgr24)
|
||||
scaler->in_fmt = SCALER_FMT_BGR24;
|
||||
else if (video_driver_get_pixel_format() == RETRO_PIXEL_FORMAT_XRGB8888)
|
||||
scaler->in_fmt = SCALER_FMT_ARGB8888;
|
||||
else
|
||||
scaler->in_fmt = SCALER_FMT_RGB565;
|
||||
scaler->out_fmt = SCALER_FMT_BGR24;
|
||||
scaler->scaler_type = SCALER_TYPE_POINT;
|
||||
scaler_ctx_gen_filter(scaler);
|
||||
@ -197,10 +187,6 @@ bool video_pixel_frame_scale(
|
||||
size_t pitch)
|
||||
{
|
||||
struct scaler_ctx *scaler = (struct scaler_ctx*)scaler_data;
|
||||
static struct retro_perf_counter video_frame_conv = {0};
|
||||
|
||||
performance_counter_init(&video_frame_conv, "video_frame_conv");
|
||||
performance_counter_start(&video_frame_conv);
|
||||
|
||||
scaler->in_width = width;
|
||||
scaler->in_height = height;
|
||||
@ -211,7 +197,5 @@ bool video_pixel_frame_scale(
|
||||
|
||||
scaler_ctx_scale(scaler, output, data);
|
||||
|
||||
performance_counter_stop(&video_frame_conv);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -60,8 +60,7 @@ void video_frame_convert_argb8888_to_abgr8888(
|
||||
void video_frame_convert_to_bgr24(
|
||||
void *data,
|
||||
void *output, const void *input,
|
||||
int width, int height, int in_pitch,
|
||||
bool bgr24);
|
||||
int width, int height, int in_pitch);
|
||||
|
||||
void video_frame_convert_rgba_to_bgr(
|
||||
const void *src_data,
|
||||
|
@ -105,13 +105,23 @@ static void task_screenshot_handler(retro_task_t *task)
|
||||
ret = true;
|
||||
state->surf->Release();
|
||||
#elif defined(HAVE_RPNG)
|
||||
video_frame_convert_to_bgr24(
|
||||
&state->scaler,
|
||||
state->out_buffer,
|
||||
(const uint8_t*)state->frame + ((int)state->height - 1) * state->pitch,
|
||||
state->width, state->height,
|
||||
-state->pitch,
|
||||
state->bgr24);
|
||||
{
|
||||
struct scaler_ctx *scaler = (struct scaler_ctx*)&state->scaler;
|
||||
|
||||
if (state->bgr24)
|
||||
scaler->in_fmt = SCALER_FMT_BGR24;
|
||||
else if (video_driver_get_pixel_format() == RETRO_PIXEL_FORMAT_XRGB8888)
|
||||
scaler->in_fmt = SCALER_FMT_ARGB8888;
|
||||
else
|
||||
scaler->in_fmt = SCALER_FMT_RGB565;
|
||||
|
||||
video_frame_convert_to_bgr24(
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user