mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Move convert frame function to gfx/video_frame.h
This commit is contained in:
parent
bf53a939da
commit
2c3ca6efed
@ -52,4 +52,30 @@ static INLINE void video_frame_convert_argb8888_to_abgr8888(
|
||||
scaler_ctx_scale(scaler, output, input);
|
||||
}
|
||||
|
||||
static INLINE void video_frame_convert_to_bgr24(
|
||||
struct scaler_ctx *scaler,
|
||||
void *output, const void *input,
|
||||
int width, int height, int in_pitch,
|
||||
bool bgr24)
|
||||
{
|
||||
scaler->in_width = width;
|
||||
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);
|
||||
|
||||
scaler->in_stride = in_pitch;
|
||||
scaler->out_stride = width * 3;
|
||||
|
||||
scaler_ctx_scale(scaler, output, input);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
35
screenshot.c
35
screenshot.c
@ -40,45 +40,18 @@
|
||||
|
||||
#include "general.h"
|
||||
#include "msg_hash.h"
|
||||
#include "gfx/scaler/scaler.h"
|
||||
#include "retroarch.h"
|
||||
#include "screenshot.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
#include "gfx/video_driver.h"
|
||||
#include "gfx/scaler/scaler.h"
|
||||
#include "gfx/video_frame.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ZLIB_DEFLATE) && defined(HAVE_RPNG)
|
||||
static INLINE void convert_frame_to_bgr_24(
|
||||
struct scaler_ctx *scaler,
|
||||
void *output,
|
||||
const void *input,
|
||||
int width, int height,
|
||||
int in_pitch, bool bgr24)
|
||||
{
|
||||
scaler->in_width = width;
|
||||
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);
|
||||
|
||||
scaler->in_stride = in_pitch;
|
||||
scaler->out_stride = width * 3;
|
||||
|
||||
scaler_ctx_scale(scaler, output, input);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Take frame bottom-up. */
|
||||
static bool screenshot_dump(const char *folder, const void *frame,
|
||||
unsigned width, unsigned height, int pitch, bool bgr24)
|
||||
@ -122,7 +95,7 @@ static bool screenshot_dump(const char *folder, const void *frame,
|
||||
if (!out_buffer)
|
||||
return false;
|
||||
|
||||
convert_frame_to_bgr_24(
|
||||
video_frame_convert_to_bgr24(
|
||||
&scaler,
|
||||
out_buffer,
|
||||
(const uint8_t*)frame + ((int)height - 1) * pitch,
|
||||
|
Loading…
x
Reference in New Issue
Block a user