mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-24 11:45:16 +00:00
Create video_frame_scale
This commit is contained in:
parent
71cc2fe761
commit
7b2a2f2336
@ -41,6 +41,8 @@
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#include "../video_context_driver.h"
|
||||
#include "../video_frame.h"
|
||||
|
||||
#include "../font_driver.h"
|
||||
|
||||
typedef struct omapfb_page
|
||||
@ -1087,49 +1089,23 @@ static bool omap_gfx_read_viewport(void *data, uint8_t *buffer)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void update_scaler(
|
||||
omap_video_t *vid,
|
||||
const void *frame,
|
||||
struct scaler_ctx *scaler,
|
||||
enum scaler_pix_fmt format,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
unsigned pitch)
|
||||
{
|
||||
if (
|
||||
width != scaler->in_width
|
||||
|| height != scaler->in_height
|
||||
|| format != scaler->in_fmt
|
||||
|| pitch != scaler->in_stride
|
||||
)
|
||||
{
|
||||
scaler->in_fmt = format;
|
||||
scaler->in_width = width;
|
||||
scaler->in_height = height;
|
||||
scaler->in_stride = pitch;
|
||||
|
||||
scaler->out_width = vid->width;
|
||||
scaler->out_height = vid->height;
|
||||
scaler->out_stride = vid->width * vid->bytes_per_pixel;
|
||||
|
||||
if (!scaler_ctx_gen_filter(scaler))
|
||||
RARCH_ERR("[video_omap]: scaler_ctx_gen_filter failed\n");
|
||||
}
|
||||
|
||||
scaler_ctx_scale(scaler, vid->menu.frame, frame);
|
||||
}
|
||||
|
||||
static void omap_gfx_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
unsigned width, unsigned height, float alpha)
|
||||
{
|
||||
omap_video_t *vid = (omap_video_t*)data;
|
||||
enum scaler_pix_fmt format = rgb32 ? SCALER_FMT_ARGB8888 : SCALER_FMT_RGBA4444;
|
||||
|
||||
(void) alpha;
|
||||
|
||||
update_scaler(vid, frame, &vid->menu.scaler, format, width, height,
|
||||
video_frame_scale(
|
||||
&vid->menu.scaler,
|
||||
vid->menu.frame,
|
||||
frame,
|
||||
format,
|
||||
vid->width,
|
||||
vid->height,
|
||||
vid->bytes_per_pixel,
|
||||
width,
|
||||
height,
|
||||
width * (rgb32 ? sizeof(uint32_t) : sizeof(uint16_t)));
|
||||
|
||||
}
|
||||
|
||||
static void omap_gfx_set_texture_enable(void *data, bool state, bool full_screen)
|
||||
|
@ -30,6 +30,40 @@ static INLINE void video_frame_convert_rgb16_to_rgb32(
|
||||
scaler_ctx_scale(scaler, output, input);
|
||||
}
|
||||
|
||||
static INLINE void video_frame_scale(
|
||||
struct scaler_ctx *scaler,
|
||||
void *output,
|
||||
const void *input,
|
||||
enum scaler_pix_fmt format,
|
||||
unsigned scaler_width,
|
||||
unsigned scaler_height,
|
||||
unsigned scaler_pitch,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
unsigned pitch)
|
||||
{
|
||||
if (
|
||||
width != scaler->in_width
|
||||
|| height != scaler->in_height
|
||||
|| format != scaler->in_fmt
|
||||
|| pitch != scaler->in_stride
|
||||
)
|
||||
{
|
||||
scaler->in_fmt = format;
|
||||
scaler->in_width = width;
|
||||
scaler->in_height = height;
|
||||
scaler->in_stride = pitch;
|
||||
|
||||
scaler->out_width = scaler_width;
|
||||
scaler->out_height = scaler_height;
|
||||
scaler->out_stride = scaler_width * scaler_pitch;
|
||||
|
||||
scaler_ctx_gen_filter(scaler);
|
||||
}
|
||||
|
||||
scaler_ctx_scale(scaler, output, input);
|
||||
}
|
||||
|
||||
static INLINE void video_frame_convert_argb8888_to_abgr8888(
|
||||
struct scaler_ctx *scaler,
|
||||
void *output, const void *input,
|
||||
|
Loading…
Reference in New Issue
Block a user