FPlay: fullscreen mode

git-svn-id: svn://kolibrios.org@3334 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2013-03-05 15:33:29 +00:00
parent 8359c962a8
commit 13030ad148
5 changed files with 66 additions and 37 deletions

View File

@ -64,17 +64,6 @@ typedef struct
}; };
}hwcaps_t; }hwcaps_t;
static inline uint32_t GetScreenSize()
{
uint32_t retval;
__asm__ __volatile__(
"int $0x40"
:"=a"(retval)
:"a"(61), "b"(1));
return retval;
}
static uint32_t get_service(char *name) static uint32_t get_service(char *name)
{ {
uint32_t retval = 0; uint32_t retval = 0;

View File

@ -403,14 +403,17 @@ void render_time(render_t *render)
// sys_time*10, frames[vfx].pts, ctime, fdelay); // sys_time*10, frames[vfx].pts, ctime, fdelay);
main_render->draw(main_render, &frames[vfx].picture); main_render->draw(main_render, &frames[vfx].picture);
prg->current = frames[vfx].pts*1000; if(main_render->win->win_state != FULLSCREEN)
{
prg->current = frames[vfx].pts*1000;
// printf("current %f\n", prg->current); // printf("current %f\n", prg->current);
lvl->current = vfx & 1 ? sound_level_1 : sound_level_0; lvl->current = vfx & 1 ? sound_level_1 : sound_level_0;
send_message(&prg->ctrl, PRG_PROGRESS, 0, 0); send_message(&prg->ctrl, PRG_PROGRESS, 0, 0);
if(main_render->win->panel.layout) if(main_render->win->panel.layout)
send_message(&lvl->ctrl, MSG_PAINT, 0, 0); send_message(&lvl->ctrl, MSG_PAINT, 0, 0);
}
frames_count--; frames_count--;
frames[vfx].ready = 0; frames[vfx].ready = 0;
@ -707,8 +710,11 @@ void render_adjust_size(render_t *render, window_t *win)
uint8_t state; uint8_t state;
right = win->w; right = win->w;
bottom = win->h-CAPTION_HEIGHT-PANEL_HEIGHT; bottom = win->h;
if(win->win_state != FULLSCREEN)
bottom-= CAPTION_HEIGHT+PANEL_HEIGHT;
// printf("window width %d height %d\n", // printf("window width %d height %d\n",
// right, bottom); // right, bottom);
@ -724,6 +730,8 @@ void render_adjust_size(render_t *render, window_t *win)
bottom == render->win_height) bottom == render->win_height)
return; return;
printf("%s r: %d b: %d\n", __FUNCTION__, right, bottom);
new_w = bottom*render->ctx_width/render->ctx_height; new_w = bottom*render->ctx_width/render->ctx_height;
new_h = right*render->ctx_height/render->ctx_width; new_h = right*render->ctx_height/render->ctx_width;
@ -738,8 +746,8 @@ void render_adjust_size(render_t *render, window_t *win)
new_w = bottom*render->ctx_width/render->ctx_height; new_w = bottom*render->ctx_width/render->ctx_height;
}; };
render->win_width = win->w; render->win_width = right;
render->win_height = win->h-CAPTION_HEIGHT-PANEL_HEIGHT; render->win_height = bottom;
render_set_size(render, new_w, new_h); render_set_size(render, new_w, new_h);
if(render->caps & HW_TEX_BLIT) /* hw scaler */ if(render->caps & HW_TEX_BLIT) /* hw scaler */
@ -815,10 +823,14 @@ void draw_hw_picture(render_t *render, AVPicture *picture)
picture->linesize, 0, render->ctx_height, data, linesize); picture->linesize, 0, render->ctx_height, data, linesize);
// printf("sws_scale\n"); // printf("sws_scale\n");
blit_bitmap(bitmap, render->rcvideo.l, if(render->win->win_state == FULLSCREEN)
blit_bitmap(bitmap,render->rcvideo.l,render->rcvideo.t,
render->rcvideo.r, render->rcvideo.b);
else
blit_bitmap(bitmap, render->rcvideo.l,
CAPTION_HEIGHT+render->rcvideo.t, CAPTION_HEIGHT+render->rcvideo.t,
render->rcvideo.r, render->rcvideo.b); render->rcvideo.r, render->rcvideo.b);
render->last_bitmap = bitmap; render->last_bitmap = bitmap;
// printf("blit_bitmap\n"); // printf("blit_bitmap\n");
@ -863,43 +875,54 @@ void draw_sw_picture(render_t *render, AVPicture *picture)
sws_scale(cvt_ctx, (const uint8_t* const *)picture->data, sws_scale(cvt_ctx, (const uint8_t* const *)picture->data,
picture->linesize, 0, render->ctx_height, data, linesize); picture->linesize, 0, render->ctx_height, data, linesize);
blit_bitmap(&render->bitmap[0], render->rcvideo.l, if(render->win->win_state == FULLSCREEN)
render->rcvideo.t+CAPTION_HEIGHT, blit_bitmap(&render->bitmap[0],render->rcvideo.l,render->rcvideo.t,
render->rcvideo.r, render->rcvideo.b); render->rcvideo.r, render->rcvideo.b);
else
blit_bitmap(&render->bitmap[0], render->rcvideo.l,
CAPTION_HEIGHT+render->rcvideo.t,
render->rcvideo.r, render->rcvideo.b);
render->last_bitmap = &render->bitmap[0]; render->last_bitmap = &render->bitmap[0];
} }
void render_draw_client(render_t *render) void render_draw_client(render_t *render)
{ {
int y;
if(render->win_state == MINIMIZED || if(render->win_state == MINIMIZED ||
render->win_state == ROLLED) render->win_state == ROLLED )
return; return;
if(render->win_state == FULLSCREEN)
y = 0;
else
y = CAPTION_HEIGHT;
if(player_state == PAUSE) if(player_state == PAUSE)
{ {
if(frames[vfx].ready == 1 ) if(frames[vfx].ready == 1 )
main_render->draw(main_render, &frames[vfx].picture); main_render->draw(main_render, &frames[vfx].picture);
else else
draw_bar(0, CAPTION_HEIGHT, render->win_width, draw_bar(0, y, render->win_width,
render->rcvideo.b, 0); render->rcvideo.b, 0);
} }
else if( player_state == STOP ) else if( player_state == STOP )
{ {
draw_bar(0, CAPTION_HEIGHT, render->win_width, draw_bar(0,y, render->win_width,
render->rcvideo.b, 0); render->rcvideo.b, 0);
}; };
if(render->layout & HAS_TOP) if(render->layout & HAS_TOP)
draw_bar(0, CAPTION_HEIGHT, render->win_width, draw_bar(0, y, render->win_width,
render->rctop.b, 0); render->rctop.b, 0);
if(render->layout & HAS_LEFT) if(render->layout & HAS_LEFT)
draw_bar(0, render->rcvideo.t+CAPTION_HEIGHT, render->rcleft.r, draw_bar(0, render->rcvideo.t+y, render->rcleft.r,
render->rcvideo.b, 0); render->rcvideo.b, 0);
if(render->layout & HAS_RIGHT) if(render->layout & HAS_RIGHT)
draw_bar(render->rcright.l, render->rcvideo.t+CAPTION_HEIGHT, draw_bar(render->rcright.l, render->rcvideo.t+y,
render->rcright.r, render->rcvideo.b, 0); render->rcright.r, render->rcvideo.b, 0);
if(render->layout & HAS_BOTTOM) if(render->layout & HAS_BOTTOM)
draw_bar(0, render->rcbottom.t+CAPTION_HEIGHT, draw_bar(0, render->rcbottom.t+y,
render->win_width, render->rcbottom.b, 0); render->win_width, render->rcbottom.b, 0);
} }

View File

@ -1,5 +1,5 @@
#include "system.h" #include <system.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -77,7 +77,7 @@ int init_caption(window_t *win)
btn->img_hilite = res_minimize_btn_hl; btn->img_hilite = res_minimize_btn_hl;
btn->img_pressed = res_minimize_btn_pressed; btn->img_pressed = res_minimize_btn_pressed;
btn = create_button(NULL, ID_FULL,0,5,18,18,(ctrl_t*)cpt); btn = create_button(NULL, ID_FULLSCREEN,0,5,18,18,(ctrl_t*)cpt);
cpt->full_btn = btn; cpt->full_btn = btn;
btn->img_default = res_full_btn; btn->img_default = res_full_btn;
@ -243,6 +243,20 @@ int caption_proc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
win->win_state = MINIMIZED; win->win_state = MINIMIZED;
send_message((ctrl_t*)win, MSG_SIZE, 0, 0); send_message((ctrl_t*)win, MSG_SIZE, 0, 0);
break; break;
case ID_FULLSCREEN:
{
int screensize;
screensize = GetScreenSize();
__asm__ __volatile__(
"int $0x40"
::"a"(67), "b"(0), "c"(0),
"d"((screensize >> 16)-1),"S"((screensize & 0xFFFF)-1) );
win->win_state = FULLSCREEN;
window_update_layout(win);
};
break;
default: default:
break; break;
}; };

View File

@ -139,6 +139,9 @@ int frame_proc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
rect_t *rc = NULL; rect_t *rc = NULL;
int x, y; int x, y;
if(win->win_state == FULLSCREEN)
return 0;
x = ((pos_t)arg2).x; x = ((pos_t)arg2).x;
y = ((pos_t)arg2).y; y = ((pos_t)arg2).y;

View File

@ -252,7 +252,7 @@ void window_update_layout(window_t *win)
win->win_state = ROLLED; win->win_state = ROLLED;
return; return;
}; };
if(state & 1) if(state & 1)
state = MAXIMIZED; state = MAXIMIZED;
else else
@ -269,10 +269,10 @@ void window_update_layout(window_t *win)
if( winw == win->w && if( winw == win->w &&
winh == win->h && winh == win->h &&
state == win->win_state) state == win->win_state)
return; return;
win->win_state = state; if(win->win_state != FULLSCREEN)
win->win_state = state;
#if 0 #if 0
int old_size; int old_size;