vim - add RetroArch style conventions
This commit is contained in:
parent
2fc08ce394
commit
f21493947d
|
@ -162,41 +162,41 @@ static bool switch_frame(void *data, const void *frame,
|
||||||
centerx = (1280-tgtw)/2;
|
centerx = (1280-tgtw)/2;
|
||||||
centery = (720-tgth)/2;
|
centery = (720-tgth)/2;
|
||||||
|
|
||||||
// clear image to black
|
/* clear image to black */
|
||||||
for(y = 0; y < 720; y++)
|
for(y = 0; y < 720; y++)
|
||||||
{
|
{
|
||||||
for(x = 0; x < 1280; x++)
|
for(x = 0; x < 1280; x++)
|
||||||
{
|
|
||||||
sw->image[y*1280+x] = 0xFF000000;
|
sw->image[y*1280+x] = 0xFF000000;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(width > 0 && height > 0) {
|
if(width > 0 && height > 0)
|
||||||
|
{
|
||||||
if(sw->last_width != width ||
|
if(sw->last_width != width ||
|
||||||
sw->last_height != height)
|
sw->last_height != height)
|
||||||
{
|
{
|
||||||
scaler_ctx_gen_reset(&sw->scaler);
|
scaler_ctx_gen_reset(&sw->scaler);
|
||||||
|
|
||||||
sw->scaler.in_width = width;
|
|
||||||
sw->scaler.in_height = height;
|
|
||||||
sw->scaler.in_stride = pitch;
|
|
||||||
sw->scaler.in_fmt = sw->rgb32 ? SCALER_FMT_ARGB8888 : SCALER_FMT_RGB565;
|
|
||||||
|
|
||||||
sw->scaler.out_width = tgtw;
|
|
||||||
sw->scaler.out_height = tgth;
|
|
||||||
sw->scaler.out_stride = 1280 * sizeof(uint32_t);
|
|
||||||
sw->scaler.out_fmt = SCALER_FMT_ABGR8888;
|
|
||||||
|
|
||||||
sw->scaler.scaler_type = SCALER_TYPE_POINT;
|
|
||||||
|
|
||||||
if(!scaler_ctx_gen_filter(&sw->scaler)) {
|
|
||||||
RARCH_ERR("failed to generate scaler for main image\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
sw->last_width = width;
|
sw->scaler.in_width = width;
|
||||||
sw->last_height = height;
|
sw->scaler.in_height = height;
|
||||||
}
|
sw->scaler.in_stride = pitch;
|
||||||
|
sw->scaler.in_fmt = sw->rgb32 ? SCALER_FMT_ARGB8888 : SCALER_FMT_RGB565;
|
||||||
|
|
||||||
|
sw->scaler.out_width = tgtw;
|
||||||
|
sw->scaler.out_height = tgth;
|
||||||
|
sw->scaler.out_stride = 1280 * sizeof(uint32_t);
|
||||||
|
sw->scaler.out_fmt = SCALER_FMT_ABGR8888;
|
||||||
|
|
||||||
|
sw->scaler.scaler_type = SCALER_TYPE_POINT;
|
||||||
|
|
||||||
|
if(!scaler_ctx_gen_filter(&sw->scaler))
|
||||||
|
{
|
||||||
|
RARCH_ERR("failed to generate scaler for main image\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
sw->last_width = width;
|
||||||
|
sw->last_height = height;
|
||||||
|
}
|
||||||
|
|
||||||
scaler_ctx_scale(&sw->scaler, sw->image + (centery * 1280) + centerx, frame);
|
scaler_ctx_scale(&sw->scaler, sw->image + (centery * 1280) + centerx, frame);
|
||||||
}
|
}
|
||||||
|
@ -229,10 +229,8 @@ static bool switch_frame(void *data, const void *frame,
|
||||||
&video_info->osd_stat_params;
|
&video_info->osd_stat_params;
|
||||||
|
|
||||||
if (osd_params)
|
if (osd_params)
|
||||||
{
|
|
||||||
font_driver_render_msg(video_info, NULL, video_info->stat_text,
|
font_driver_render_msg(video_info, NULL, video_info->stat_text,
|
||||||
(const struct font_params*)&video_info->osd_stat_params);
|
(const struct font_params*)&video_info->osd_stat_params);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -248,14 +246,12 @@ static bool switch_frame(void *data, const void *frame,
|
||||||
RARCH_LOG("message: %s\n", msg);
|
RARCH_LOG("message: %s\n", msg);
|
||||||
|
|
||||||
r = surface_dequeue_buffer(&sw->surface, &out_buffer);
|
r = surface_dequeue_buffer(&sw->surface, &out_buffer);
|
||||||
if(r != RESULT_OK) {
|
if(r != RESULT_OK)
|
||||||
return true; // just skip the frame
|
return true; /* just skip the frame */
|
||||||
}
|
|
||||||
|
|
||||||
r = surface_wait_buffer(&sw->surface);
|
r = surface_wait_buffer(&sw->surface);
|
||||||
if(r != RESULT_OK) {
|
if(r != RESULT_OK)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
gfx_slow_swizzling_blit(out_buffer, sw->image, 1280, 720, 0, 0);
|
gfx_slow_swizzling_blit(out_buffer, sw->image, 1280, 720, 0, 0);
|
||||||
|
|
||||||
r = surface_queue_buffer(&sw->surface);
|
r = surface_queue_buffer(&sw->surface);
|
||||||
|
@ -349,6 +345,8 @@ static void switch_set_texture_frame(
|
||||||
sw->menu_texture.width != width ||
|
sw->menu_texture.width != width ||
|
||||||
sw->menu_texture.height != height)
|
sw->menu_texture.height != height)
|
||||||
{
|
{
|
||||||
|
struct scaler_ctx *sctx;
|
||||||
|
int xsf, ysf, sf;
|
||||||
if (sw->menu_texture.pixels)
|
if (sw->menu_texture.pixels)
|
||||||
free(sw->menu_texture.pixels);
|
free(sw->menu_texture.pixels);
|
||||||
|
|
||||||
|
@ -359,32 +357,32 @@ static void switch_set_texture_frame(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xsf = 1280 / width;
|
xsf = 1280 / width;
|
||||||
int ysf = 720 / height;
|
ysf = 720 / height;
|
||||||
int sf = xsf;
|
sf = xsf;
|
||||||
|
|
||||||
if (ysf < sf)
|
if (ysf < sf)
|
||||||
sf = ysf;
|
sf = ysf;
|
||||||
|
|
||||||
sw->menu_texture.width = width;
|
sw->menu_texture.width = width;
|
||||||
sw->menu_texture.height = height;
|
sw->menu_texture.height = height;
|
||||||
sw->menu_texture.tgtw = width * sf;
|
sw->menu_texture.tgtw = width * sf;
|
||||||
sw->menu_texture.tgth = height * sf;
|
sw->menu_texture.tgth = height * sf;
|
||||||
|
|
||||||
struct scaler_ctx *sctx = &sw->menu_texture.scaler;
|
sctx = &sw->menu_texture.scaler;
|
||||||
scaler_ctx_gen_reset(sctx);
|
scaler_ctx_gen_reset(sctx);
|
||||||
|
|
||||||
sctx->in_width = width;
|
sctx->in_width = width;
|
||||||
sctx->in_height = height;
|
sctx->in_height = height;
|
||||||
sctx->in_stride = width * (rgb32 ? 4 : 2);
|
sctx->in_stride = width * (rgb32 ? 4 : 2);
|
||||||
sctx->in_fmt = rgb32 ? SCALER_FMT_ARGB8888 : SCALER_FMT_RGB565;
|
sctx->in_fmt = rgb32 ? SCALER_FMT_ARGB8888 : SCALER_FMT_RGB565;
|
||||||
|
|
||||||
sctx->out_width = sw->menu_texture.tgtw;
|
sctx->out_width = sw->menu_texture.tgtw;
|
||||||
sctx->out_height = sw->menu_texture.tgth;
|
sctx->out_height = sw->menu_texture.tgth;
|
||||||
sctx->out_stride = 1280 * 4;
|
sctx->out_stride = 1280 * 4;
|
||||||
sctx->out_fmt = SCALER_FMT_ABGR8888;
|
sctx->out_fmt = SCALER_FMT_ABGR8888;
|
||||||
|
|
||||||
sctx->scaler_type = SCALER_TYPE_POINT;
|
sctx->scaler_type = SCALER_TYPE_POINT;
|
||||||
|
|
||||||
if (!scaler_ctx_gen_filter(sctx))
|
if (!scaler_ctx_gen_filter(sctx))
|
||||||
{
|
{
|
||||||
|
@ -399,6 +397,9 @@ static void switch_set_texture_frame(
|
||||||
static void switch_set_texture_enable(void *data, bool enable, bool full_screen)
|
static void switch_set_texture_enable(void *data, bool enable, bool full_screen)
|
||||||
{
|
{
|
||||||
switch_video_t *sw = data;
|
switch_video_t *sw = data;
|
||||||
|
if (!sw)
|
||||||
|
return;
|
||||||
|
|
||||||
sw->menu_texture.enable = enable;
|
sw->menu_texture.enable = enable;
|
||||||
sw->menu_texture.fullscreen = full_screen;
|
sw->menu_texture.fullscreen = full_screen;
|
||||||
}
|
}
|
||||||
|
@ -457,3 +458,5 @@ video_driver_t video_switch = {
|
||||||
#endif
|
#endif
|
||||||
switch_get_poke_interface,
|
switch_get_poke_interface,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* vim: set ts=3 sw=3 */
|
||||||
|
|
|
@ -773,4 +773,4 @@ video_driver_t video_switch = {
|
||||||
switch_get_poke_interface,
|
switch_get_poke_interface,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* vim: set ts=6 sw=6 sts=6: */
|
/* vim: set ts=3 sw=3 */
|
||||||
|
|
Loading…
Reference in New Issue