Cleanups
This commit is contained in:
parent
a393d9a75b
commit
3ba02a3786
|
@ -1341,7 +1341,7 @@ static void gl_update_input_size(gl_t *gl, unsigned width,
|
||||||
* to use a custom SIMD-optimized conversion routine
|
* to use a custom SIMD-optimized conversion routine
|
||||||
* than letting GL do it. */
|
* than letting GL do it. */
|
||||||
#if !defined(HAVE_PSGL) && !defined(HAVE_OPENGLES2)
|
#if !defined(HAVE_PSGL) && !defined(HAVE_OPENGLES2)
|
||||||
static INLINE void gl_convert_frame_rgb16_32(
|
static INLINE void convert_frame_rgb16_32(
|
||||||
struct scaler_ctx *scaler,
|
struct scaler_ctx *scaler,
|
||||||
void *output,
|
void *output,
|
||||||
const void *input,
|
const void *input,
|
||||||
|
@ -1368,7 +1368,7 @@ static INLINE void gl_convert_frame_rgb16_32(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_OPENGLES2
|
#ifdef HAVE_OPENGLES2
|
||||||
static INLINE void gl_convert_frame_argb8888_abgr8888(
|
static INLINE void convert_frame_argb8888_abgr8888(
|
||||||
struct scaler_ctx *scaler,
|
struct scaler_ctx *scaler,
|
||||||
void *output, const void *input,
|
void *output, const void *input,
|
||||||
int width, int height, int in_pitch)
|
int width, int height, int in_pitch)
|
||||||
|
@ -1550,7 +1550,7 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
|
||||||
/* Fallback for GLES devices without GL_BGRA_EXT. */
|
/* Fallback for GLES devices without GL_BGRA_EXT. */
|
||||||
if (gl->base_size == 4 && use_rgba)
|
if (gl->base_size == 4 && use_rgba)
|
||||||
{
|
{
|
||||||
gl_convert_frame_argb8888_abgr8888(
|
convert_frame_argb8888_abgr8888(
|
||||||
&gl->scaler,
|
&gl->scaler,
|
||||||
gl->conv_buffer,
|
gl->conv_buffer,
|
||||||
frame, width, height, pitch);
|
frame, width, height, pitch);
|
||||||
|
@ -1619,7 +1619,7 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
|
||||||
if (gl->base_size == 2 && !gl->have_es2_compat)
|
if (gl->base_size == 2 && !gl->have_es2_compat)
|
||||||
{
|
{
|
||||||
/* Convert to 32-bit textures on desktop GL. */
|
/* Convert to 32-bit textures on desktop GL. */
|
||||||
gl_convert_frame_rgb16_32(
|
convert_frame_rgb16_32(
|
||||||
&gl->scaler,
|
&gl->scaler,
|
||||||
gl->conv_buffer,
|
gl->conv_buffer,
|
||||||
frame,
|
frame,
|
||||||
|
|
52
screenshot.c
52
screenshot.c
|
@ -50,6 +50,33 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/* Take frame bottom-up. */
|
/* Take frame bottom-up. */
|
||||||
static bool screenshot_dump(const char *folder, const void *frame,
|
static bool screenshot_dump(const char *folder, const void *frame,
|
||||||
unsigned width, unsigned height, int pitch, bool bgr24)
|
unsigned width, unsigned height, int pitch, bool bgr24)
|
||||||
|
@ -93,25 +120,14 @@ static bool screenshot_dump(const char *folder, const void *frame,
|
||||||
if (!out_buffer)
|
if (!out_buffer)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
scaler.in_width = width;
|
convert_frame_to_bgr_24(
|
||||||
scaler.in_height = height;
|
&scaler,
|
||||||
scaler.out_width = width;
|
out_buffer,
|
||||||
scaler.out_height = height;
|
(const uint8_t*)frame + ((int)height - 1) * pitch,
|
||||||
scaler.in_stride = -pitch;
|
width, height,
|
||||||
scaler.out_stride = width * 3;
|
-pitch,
|
||||||
scaler.out_fmt = SCALER_FMT_BGR24;
|
bgr24);
|
||||||
scaler.scaler_type = SCALER_TYPE_POINT;
|
|
||||||
|
|
||||||
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_ctx_gen_filter(&scaler);
|
|
||||||
scaler_ctx_scale(&scaler, out_buffer,
|
|
||||||
(const uint8_t*)frame + ((int)height - 1) * pitch);
|
|
||||||
scaler_ctx_gen_reset(&scaler);
|
scaler_ctx_gen_reset(&scaler);
|
||||||
|
|
||||||
RARCH_LOG("Using RPNG for PNG screenshots.\n");
|
RARCH_LOG("Using RPNG for PNG screenshots.\n");
|
||||||
|
|
Loading…
Reference in New Issue