forked from KolibriOS/kolibrios
Fplay: recovered files from broken hdd.
git-svn-id: svn://kolibrios.org@3248 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
deca8b884f
commit
fcddd916db
@ -299,16 +299,16 @@ int audio_thread(void *param)
|
|||||||
|
|
||||||
for(i = 0, val = 0; i < samples/2; i++, src++)
|
for(i = 0, val = 0; i < samples/2; i++, src++)
|
||||||
if(val < abs(*src))
|
if(val < abs(*src))
|
||||||
val= abs(*src); // * *src;
|
val= abs(*src); // * *src;
|
||||||
|
|
||||||
sound_level_0 = val; //sqrt(val / (samples/2));
|
sound_level_0 = val; //sqrt(val / (samples/2));
|
||||||
|
|
||||||
for(i = 0, val = 0; i < samples/2; i++, src++)
|
for(i = 0, val = 0; i < samples/2; i++, src++)
|
||||||
if(val < abs(*src))
|
if(val < abs(*src))
|
||||||
val= abs(*src); // * *src;
|
val= abs(*src); // * *src;
|
||||||
|
|
||||||
sound_level_1 = val; //sqrt(val / (samples/2));
|
sound_level_1 = val; //sqrt(val / (samples/2));
|
||||||
|
|
||||||
// printf("%d\n", sound_level);
|
// printf("%d\n", sound_level);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,13 +61,18 @@ double get_audio_base()
|
|||||||
int main( int argc, char *argv[])
|
int main( int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char *file_name, *dot;
|
||||||
|
|
||||||
if(argc < 2) {
|
if(argc < 2)
|
||||||
|
{
|
||||||
|
movie_file = get_moviefile();
|
||||||
|
if(movie_file == NULL)
|
||||||
|
{
|
||||||
printf("Please provide a movie file\n");
|
printf("Please provide a movie file\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
movie_file = argv[1];
|
else movie_file = argv[1];
|
||||||
/* register all codecs, demux and protocols */
|
/* register all codecs, demux and protocols */
|
||||||
|
|
||||||
av_log_set_level(AV_LOG_FATAL);
|
av_log_set_level(AV_LOG_FATAL);
|
||||||
@ -76,9 +81,9 @@ int main( int argc, char *argv[])
|
|||||||
avdevice_register_all();
|
avdevice_register_all();
|
||||||
av_register_all();
|
av_register_all();
|
||||||
|
|
||||||
if( avformat_open_input(&pFormatCtx, argv[1], NULL, NULL) < 0)
|
if( avformat_open_input(&pFormatCtx, movie_file, NULL, NULL) < 0)
|
||||||
{
|
{
|
||||||
printf("Cannot open file %s\n\r", argv[1]);
|
printf("Cannot open file %s\n\r", movie_file);
|
||||||
return -1; // Couldn't open file
|
return -1; // Couldn't open file
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -91,6 +96,17 @@ int main( int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
file_name = strrchr(movie_file,'/')+1;
|
||||||
|
dot = strrchr(file_name,'.');
|
||||||
|
if(dot)
|
||||||
|
{
|
||||||
|
movie_file = malloc(dot-file_name+1);
|
||||||
|
memcpy(movie_file, file_name, dot-file_name);
|
||||||
|
movie_file[dot-file_name] = 0;
|
||||||
|
}
|
||||||
|
else movie_file = file_name;
|
||||||
|
|
||||||
|
|
||||||
// __asm__ __volatile__("int3");
|
// __asm__ __volatile__("int3");
|
||||||
|
|
||||||
// dump_format(pFormatCtx, 0, argv[1], 0);
|
// dump_format(pFormatCtx, 0, argv[1], 0);
|
||||||
@ -304,7 +320,7 @@ void decoder()
|
|||||||
AVPacket packet;
|
AVPacket packet;
|
||||||
int ret;
|
int ret;
|
||||||
int64_t min_pos, max_pos;
|
int64_t min_pos, max_pos;
|
||||||
|
|
||||||
while( player_state != CLOSED )
|
while( player_state != CLOSED )
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@ -347,7 +363,7 @@ void decoder()
|
|||||||
decoder_state = STOP;
|
decoder_state = STOP;
|
||||||
// printf("stop decoder\n");
|
// printf("stop decoder\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
case STOP:
|
case STOP:
|
||||||
delay(1);
|
delay(1);
|
||||||
break;
|
break;
|
||||||
@ -380,7 +396,7 @@ void decoder()
|
|||||||
rewind_pos = -rewind_pos;
|
rewind_pos = -rewind_pos;
|
||||||
opts = AVSEEK_FLAG_BACKWARD;
|
opts = AVSEEK_FLAG_BACKWARD;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (pFormatCtx->start_time != AV_NOPTS_VALUE)
|
if (pFormatCtx->start_time != AV_NOPTS_VALUE)
|
||||||
rewind_pos += pFormatCtx->start_time;
|
rewind_pos += pFormatCtx->start_time;
|
||||||
|
|
||||||
@ -390,7 +406,7 @@ void decoder()
|
|||||||
|
|
||||||
ret = avformat_seek_file(pFormatCtx, -1, INT64_MIN,
|
ret = avformat_seek_file(pFormatCtx, -1, INT64_MIN,
|
||||||
rewind_pos, INT64_MAX, 0);
|
rewind_pos, INT64_MAX, 0);
|
||||||
|
|
||||||
// ret = avformat_seek_file(pFormatCtx, -1, min_pos,
|
// ret = avformat_seek_file(pFormatCtx, -1, min_pos,
|
||||||
// rewind_pos, max_pos, opts);
|
// rewind_pos, max_pos, opts);
|
||||||
// __asm__ __volatile__("int3");
|
// __asm__ __volatile__("int3");
|
||||||
|
@ -1,19 +1,12 @@
|
|||||||
|
|
||||||
|
#include "pixlib2.h"
|
||||||
|
|
||||||
#define BLACK_MAGIC_SOUND
|
#define BLACK_MAGIC_SOUND
|
||||||
#define BLACK_MAGIC_VIDEO
|
#define BLACK_MAGIC_VIDEO
|
||||||
|
|
||||||
typedef unsigned int color_t;
|
typedef unsigned int color_t;
|
||||||
typedef unsigned int count_t;
|
typedef unsigned int count_t;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t width;
|
|
||||||
uint32_t height;
|
|
||||||
uint32_t pitch;
|
|
||||||
uint32_t handle;
|
|
||||||
uint8_t *data;
|
|
||||||
}bitmap_t;
|
|
||||||
|
|
||||||
typedef struct render render_t;
|
typedef struct render render_t;
|
||||||
|
|
||||||
#define HAS_LEFT (1<<0)
|
#define HAS_LEFT (1<<0)
|
||||||
@ -124,7 +117,7 @@ void render_draw_client(render_t *render);
|
|||||||
|
|
||||||
int init_audio(int format);
|
int init_audio(int format);
|
||||||
int audio_thread(void *param);
|
int audio_thread(void *param);
|
||||||
void set_audio_volume(int left, int right);
|
void set_audio_volume(int left, int right);
|
||||||
|
|
||||||
int init_video(AVCodecContext *ctx);
|
int init_video(AVCodecContext *ctx);
|
||||||
int video_thread(void *param);
|
int video_thread(void *param);
|
||||||
@ -177,18 +170,8 @@ static inline void delay(uint32_t time)
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define HW_BIT_BLIT (1<<0) /* BGRX blitter */
|
|
||||||
#define HW_TEX_BLIT (1<<1) /* stretch blit */
|
|
||||||
#define HW_VID_BLIT (1<<2) /* planar and packed video */
|
|
||||||
|
|
||||||
uint32_t InitPixlib(uint32_t flags);
|
|
||||||
|
|
||||||
int create_bitmap(bitmap_t *bitmap);
|
|
||||||
int lock_bitmap(bitmap_t *bitmap);
|
|
||||||
int resize_bitmap(bitmap_t *bitmap);
|
|
||||||
int blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y,
|
|
||||||
int w, int h);
|
|
||||||
|
|
||||||
int init_fontlib();
|
int init_fontlib();
|
||||||
|
int draw_text(bitmap_t *winbitmap, int face, char *text, int x, int y, int color);
|
||||||
|
int draw_text_ext(bitmap_t *winbitmap, int face, char *text, rect_t *rc, int color);
|
||||||
|
char *get_moviefile();
|
||||||
|
|
||||||
|
@ -1,21 +1,7 @@
|
|||||||
#include <stdint.h>
|
|
||||||
//#include <libavcodec/avcodec.h>
|
|
||||||
//#include <libavformat/avformat.h>
|
|
||||||
//#include <libswscale/swscale.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
//#include <fcntl.h>
|
|
||||||
#include "../winlib/winlib.h"
|
|
||||||
//#include "fplay.h"
|
|
||||||
#include "system.h"
|
|
||||||
|
|
||||||
typedef struct
|
#include <stdio.h>
|
||||||
{
|
#include <pixlib2.h>
|
||||||
uint32_t width;
|
#include "system.h"
|
||||||
uint32_t height;
|
|
||||||
uint32_t pitch;
|
|
||||||
uint32_t handle;
|
|
||||||
uint8_t *data;
|
|
||||||
}bitmap_t;
|
|
||||||
|
|
||||||
|
|
||||||
#define DISPLAY_VERSION 0x0200 /* 2.00 */
|
#define DISPLAY_VERSION 0x0200 /* 2.00 */
|
||||||
@ -23,32 +9,21 @@ typedef struct
|
|||||||
#define SRV_GETVERSION 0
|
#define SRV_GETVERSION 0
|
||||||
#define SRV_GET_CAPS 3
|
#define SRV_GET_CAPS 3
|
||||||
|
|
||||||
#define SRV_CREATE_SURFACE 10
|
#define SRV_CREATE_SURFACE 10
|
||||||
#define SRV_DESTROY_SURFACE 11
|
#define SRV_DESTROY_SURFACE 11
|
||||||
#define SRV_LOCK_SURFACE 12
|
#define SRV_LOCK_SURFACE 12
|
||||||
#define SRV_UNLOCK_SURFACE 13
|
#define SRV_UNLOCK_SURFACE 13
|
||||||
#define SRV_RESIZE_SURFACE 14
|
#define SRV_RESIZE_SURFACE 14
|
||||||
#define SRV_BLIT_BITMAP 15
|
#define SRV_BLIT_BITMAP 15
|
||||||
#define SRV_BLIT_TEXTURE 16
|
#define SRV_BLIT_TEXTURE 16
|
||||||
#define SRV_BLIT_VIDEO 17
|
#define SRV_BLIT_VIDEO 17
|
||||||
|
|
||||||
|
|
||||||
|
#define BUFFER_SIZE(n) ((n)*sizeof(uint32_t))
|
||||||
#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
|
#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
|
||||||
#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
|
#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
|
||||||
|
|
||||||
|
|
||||||
#define HW_BIT_BLIT (1<<0) /* BGRX blitter */
|
|
||||||
#define HW_TEX_BLIT (1<<1) /* stretch blit */
|
|
||||||
#define HW_VID_BLIT (1<<2) /* planar and packed video */
|
|
||||||
|
|
||||||
uint32_t InitPixlib(uint32_t flags);
|
|
||||||
|
|
||||||
int create_bitmap(bitmap_t *bitmap);
|
|
||||||
int lock_bitmap(bitmap_t *bitmap);
|
|
||||||
int resize_bitmap(bitmap_t *bitmap);
|
|
||||||
int blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y,
|
|
||||||
int w, int h);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static uint32_t service;
|
static uint32_t service;
|
||||||
static uint32_t blit_caps;
|
static uint32_t blit_caps;
|
||||||
@ -114,16 +89,13 @@ static int call_service(ioctl_t *io)
|
|||||||
return retval;
|
return retval;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BUFFER_SIZE(n) ((n)*sizeof(uint32_t))
|
|
||||||
|
|
||||||
|
uint32_t init_pixlib(uint32_t caps)
|
||||||
|
|
||||||
uint32_t InitPixlib(uint32_t caps)
|
|
||||||
{
|
{
|
||||||
uint32_t api_version;
|
uint32_t api_version;
|
||||||
uint32_t screensize;
|
uint32_t screensize;
|
||||||
hwcaps_t hwcaps;
|
hwcaps_t hwcaps;
|
||||||
ioctl_t io;
|
ioctl_t io;
|
||||||
|
|
||||||
// __asm__ __volatile__("int3");
|
// __asm__ __volatile__("int3");
|
||||||
|
|
||||||
@ -187,7 +159,7 @@ int create_bitmap(bitmap_t *bitmap)
|
|||||||
{
|
{
|
||||||
// __asm__ __volatile__("int3");
|
// __asm__ __volatile__("int3");
|
||||||
|
|
||||||
if( blit_caps & HW_BIT_BLIT )
|
if( bitmap->flags && blit_caps & HW_BIT_BLIT )
|
||||||
{
|
{
|
||||||
struct __attribute__((packed)) /* SRV_CREATE_SURFACE */
|
struct __attribute__((packed)) /* SRV_CREATE_SURFACE */
|
||||||
{
|
{
|
||||||
@ -232,7 +204,6 @@ int create_bitmap(bitmap_t *bitmap)
|
|||||||
// bitmap->handle, bitmap->pitch, bitmap->data);
|
// bitmap->handle, bitmap->pitch, bitmap->data);
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
return err;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
@ -248,6 +219,7 @@ int create_bitmap(bitmap_t *bitmap)
|
|||||||
bitmap->handle = 0;
|
bitmap->handle = 0;
|
||||||
bitmap->pitch = pitch;
|
bitmap->pitch = pitch;
|
||||||
bitmap->data = buffer;
|
bitmap->data = buffer;
|
||||||
|
bitmap->flags = 0;
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -261,7 +233,7 @@ int lock_bitmap(bitmap_t *bitmap)
|
|||||||
// __asm__ __volatile__("int3");
|
// __asm__ __volatile__("int3");
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if( blit_caps & HW_BIT_BLIT )
|
if( bitmap->flags && blit_caps & HW_BIT_BLIT )
|
||||||
{
|
{
|
||||||
struct __attribute__((packed)) /* SRV_LOCK_SURFACE */
|
struct __attribute__((packed)) /* SRV_LOCK_SURFACE */
|
||||||
{
|
{
|
||||||
@ -302,7 +274,7 @@ int blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y,
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if( blit_caps & HW_BIT_BLIT )
|
if( bitmap->flags && blit_caps & HW_BIT_BLIT )
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -361,7 +333,7 @@ int blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y,
|
|||||||
:"=a"(err)
|
:"=a"(err)
|
||||||
:"a"(73),"b"(0x00),"c"(&bc)
|
:"a"(73),"b"(0x00),"c"(&bc)
|
||||||
:"memory");
|
:"memory");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -369,7 +341,7 @@ int resize_bitmap(bitmap_t *bitmap)
|
|||||||
{
|
{
|
||||||
// __asm__ __volatile__("int3");
|
// __asm__ __volatile__("int3");
|
||||||
|
|
||||||
if( blit_caps & HW_BIT_BLIT )
|
if( bitmap->flags && blit_caps & HW_BIT_BLIT )
|
||||||
{
|
{
|
||||||
struct __attribute__((packed))
|
struct __attribute__((packed))
|
||||||
{
|
{
|
||||||
@ -396,7 +368,7 @@ int resize_bitmap(bitmap_t *bitmap)
|
|||||||
|
|
||||||
err = call_service(&io);
|
err = call_service(&io);
|
||||||
if(err==0)
|
if(err==0)
|
||||||
{
|
{
|
||||||
bitmap->pitch = io_14.pitch;
|
bitmap->pitch = io_14.pitch;
|
||||||
bitmap->data = io_14.data;
|
bitmap->data = io_14.data;
|
||||||
};
|
};
|
||||||
|
@ -186,7 +186,7 @@ void draw_bitmap(void *bitmap, int x, int y, int w, int h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void draw_text(const char *text, int x, int y, int len, color_t color)
|
void draw_text_sys(const char *text, int x, int y, int len, color_t color)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
|
@ -97,3 +97,21 @@ int get_packet(queue_t *q, AVPacket *pkt)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void blit_raw(ctx_t *ctx, void *raw, int x, int y, int w, int h, int pitch)
|
||||||
|
{
|
||||||
|
int *dst = (int*)ctx->pixmap->data;
|
||||||
|
int *src = raw;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
dst+= y * ctx->pixmap->pitch/4 + x;
|
||||||
|
|
||||||
|
|
||||||
|
for(i=0; i < h; i++)
|
||||||
|
{
|
||||||
|
for(j = 0; j < w; j++)
|
||||||
|
dst[j] = src[j];
|
||||||
|
dst+= ctx->pixmap->pitch/4;
|
||||||
|
src+= pitch/4;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -52,7 +52,7 @@ void flush_video()
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < 4; i++)
|
for(i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
frames[i].pts = 0;
|
frames[i].pts = 0;
|
||||||
frames[i].ready = 0;
|
frames[i].ready = 0;
|
||||||
};
|
};
|
||||||
@ -135,8 +135,8 @@ int decode_video(AVCodecContext *ctx, queue_t *qv)
|
|||||||
pts= pkt.dts;
|
pts= pkt.dts;
|
||||||
else
|
else
|
||||||
pts= 0;
|
pts= 0;
|
||||||
|
|
||||||
|
|
||||||
pts *= av_q2d(video_time_base)*1000.0;
|
pts *= av_q2d(video_time_base)*1000.0;
|
||||||
*/
|
*/
|
||||||
if( 1 /*pts > current_clock*/)
|
if( 1 /*pts > current_clock*/)
|
||||||
@ -199,24 +199,24 @@ extern int64_t rewind_pos;
|
|||||||
|
|
||||||
static void player_stop()
|
static void player_stop()
|
||||||
{
|
{
|
||||||
window_t *win;
|
window_t *win;
|
||||||
|
|
||||||
win = main_render->win;
|
win = main_render->win;
|
||||||
|
|
||||||
rewind_pos = 0;
|
rewind_pos = 0;
|
||||||
|
|
||||||
win->panel.play_btn->img_default = res_play_btn;
|
win->panel.play_btn->img_default = res_play_btn;
|
||||||
win->panel.play_btn->img_hilite = res_play_btn;
|
win->panel.play_btn->img_hilite = res_play_btn;
|
||||||
win->panel.play_btn->img_pressed = res_play_btn_pressed;
|
win->panel.play_btn->img_pressed = res_play_btn_pressed;
|
||||||
win->panel.prg->current = rewind_pos;
|
win->panel.prg->current = rewind_pos;
|
||||||
|
|
||||||
send_message(&win->panel.ctrl, MSG_PAINT, 0, 0);
|
send_message(&win->panel.ctrl, MSG_PAINT, 0, 0);
|
||||||
player_state = STOP;
|
player_state = STOP;
|
||||||
decoder_state = PLAY_2_STOP;
|
decoder_state = PLAY_2_STOP;
|
||||||
sound_state = PLAY_2_STOP;
|
sound_state = PLAY_2_STOP;
|
||||||
render_draw_client(main_render);
|
render_draw_client(main_render);
|
||||||
// printf("stop player\n");
|
// printf("stop player\n");
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
|
int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
|
||||||
@ -237,7 +237,7 @@ int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MSG_LBTNDOWN:
|
case MSG_LBTNDOWN:
|
||||||
|
|
||||||
if(player_state == PAUSE)
|
if(player_state == PAUSE)
|
||||||
{
|
{
|
||||||
win->panel.play_btn->img_default = res_pause_btn;
|
win->panel.play_btn->img_default = res_pause_btn;
|
||||||
@ -284,24 +284,24 @@ int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
|
|||||||
win->panel.play_btn->img_default = res_pause_btn;
|
win->panel.play_btn->img_default = res_pause_btn;
|
||||||
win->panel.play_btn->img_hilite = res_pause_btn;
|
win->panel.play_btn->img_hilite = res_pause_btn;
|
||||||
win->panel.play_btn->img_pressed = res_pause_btn_pressed;
|
win->panel.play_btn->img_pressed = res_pause_btn_pressed;
|
||||||
rewind_pos = 0;
|
rewind_pos = 0;
|
||||||
send_message(&win->panel.ctrl, MSG_PAINT, 0, 0);
|
send_message(&win->panel.ctrl, MSG_PAINT, 0, 0);
|
||||||
player_state = PLAY;
|
player_state = PLAY;
|
||||||
decoder_state = PREPARE;
|
decoder_state = PREPARE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_STOP:
|
case ID_STOP:
|
||||||
player_stop();
|
player_stop();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PROGRESS:
|
case ID_PROGRESS:
|
||||||
if(player_state != REWIND)
|
if(player_state != REWIND)
|
||||||
{
|
{
|
||||||
progress_t *prg = (progress_t*)arg2;
|
progress_t *prg = (progress_t*)arg2;
|
||||||
|
|
||||||
rewind_pos = (prg->max - prg->min)*prg->pos/prg->ctrl.w;
|
rewind_pos = (prg->max - prg->min)*prg->pos/prg->ctrl.w;
|
||||||
|
|
||||||
// printf("progress action pos: %d time: %f\n", prg->pos, (double)rewind_pos);
|
// printf("progress action pos: %d time: %f\n", prg->pos, (double)rewind_pos);
|
||||||
player_state = REWIND;
|
player_state = REWIND;
|
||||||
decoder_state = REWIND;
|
decoder_state = REWIND;
|
||||||
@ -313,30 +313,30 @@ int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
prg->current = rewind_pos;
|
prg->current = rewind_pos;
|
||||||
|
|
||||||
win->panel.play_btn->img_default = res_pause_btn;
|
win->panel.play_btn->img_default = res_pause_btn;
|
||||||
win->panel.play_btn->img_hilite = res_pause_btn;
|
win->panel.play_btn->img_hilite = res_pause_btn;
|
||||||
win->panel.play_btn->img_pressed = res_pause_btn_pressed;
|
win->panel.play_btn->img_pressed = res_pause_btn_pressed;
|
||||||
send_message(&prg->ctrl, MSG_PAINT, 0, 0);
|
send_message(&prg->ctrl, MSG_PAINT, 0, 0);
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_VOL_CTRL:
|
case ID_VOL_CTRL:
|
||||||
{
|
{
|
||||||
slider_t *sld = (slider_t*)arg2;
|
slider_t *sld = (slider_t*)arg2;
|
||||||
int peak;
|
int peak;
|
||||||
int level;
|
int level;
|
||||||
|
|
||||||
peak = sld->min + sld->pos * (sld->max - sld->min)/(96);
|
peak = sld->min + sld->pos * (sld->max - sld->min)/(96);
|
||||||
// level = (log2(peak+16384)*10000.0)/15 - 10000;
|
// level = (log2(peak+16384)*10000.0)/15 - 10000;
|
||||||
level = peak;
|
level = peak;
|
||||||
|
|
||||||
// printf("level %d\n", level);
|
// printf("level %d\n", level);
|
||||||
set_audio_volume(level, level);
|
set_audio_volume(level, level);
|
||||||
send_message(&sld->ctrl, MSG_PAINT, 0, 0);
|
send_message(&sld->ctrl, MSG_PAINT, 0, 0);
|
||||||
win->panel.lvl->vol = level;
|
win->panel.lvl->vol = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -352,9 +352,9 @@ int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
|
|||||||
|
|
||||||
void render_time(render_t *render)
|
void render_time(render_t *render)
|
||||||
{
|
{
|
||||||
progress_t *prg = main_render->win->panel.prg;
|
progress_t *prg = main_render->win->panel.prg;
|
||||||
level_t *lvl = main_render->win->panel.lvl;
|
level_t *lvl = main_render->win->panel.lvl;
|
||||||
|
|
||||||
double ctime; /* milliseconds */
|
double ctime; /* milliseconds */
|
||||||
double fdelay; /* milliseconds */
|
double fdelay; /* milliseconds */
|
||||||
|
|
||||||
@ -368,11 +368,11 @@ void render_time(render_t *render)
|
|||||||
else if(player_state == REWIND)
|
else if(player_state == REWIND)
|
||||||
{
|
{
|
||||||
yield();
|
yield();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (decoder_state == STOP && frames_count == 0 &&
|
else if (decoder_state == STOP && frames_count == 0 &&
|
||||||
player_state != STOP)
|
player_state != STOP)
|
||||||
{
|
{
|
||||||
player_stop();
|
player_stop();
|
||||||
}
|
}
|
||||||
else if(player_state != PLAY)
|
else if(player_state != PLAY)
|
||||||
@ -413,12 +413,12 @@ void render_time(render_t *render)
|
|||||||
prg->current = frames[vfx].pts*1000;
|
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;
|
||||||
vfx++;
|
vfx++;
|
||||||
@ -538,7 +538,7 @@ render_t *create_render(uint32_t width, uint32_t height,
|
|||||||
render->ctx_format = ctx_format;
|
render->ctx_format = ctx_format;
|
||||||
|
|
||||||
mutex_lock(&driver_lock);
|
mutex_lock(&driver_lock);
|
||||||
render->caps = InitPixlib(flags);
|
render->caps = init_pixlib(flags);
|
||||||
mutex_unlock(&driver_lock);
|
mutex_unlock(&driver_lock);
|
||||||
|
|
||||||
if(render->caps==0)
|
if(render->caps==0)
|
||||||
@ -616,6 +616,7 @@ int render_set_size(render_t *render, int width, int height)
|
|||||||
{
|
{
|
||||||
render->bitmap[i].width = render->ctx_width;
|
render->bitmap[i].width = render->ctx_width;
|
||||||
render->bitmap[i].height = render->ctx_height;
|
render->bitmap[i].height = render->ctx_height;
|
||||||
|
render->bitmap[i].flags = HW_TEX_BLIT;
|
||||||
|
|
||||||
if( create_bitmap(&render->bitmap[i]) != 0 )
|
if( create_bitmap(&render->bitmap[i]) != 0 )
|
||||||
{
|
{
|
||||||
@ -632,6 +633,7 @@ int render_set_size(render_t *render, int width, int height)
|
|||||||
{
|
{
|
||||||
render->bitmap[0].width = width;
|
render->bitmap[0].width = width;
|
||||||
render->bitmap[0].height = height;
|
render->bitmap[0].height = height;
|
||||||
|
render->bitmap[0].flags = HW_BIT_BLIT;
|
||||||
|
|
||||||
if( create_bitmap(&render->bitmap[0]) != 0 )
|
if( create_bitmap(&render->bitmap[0]) != 0 )
|
||||||
return 0;
|
return 0;
|
||||||
@ -808,7 +810,7 @@ void render_draw_client(render_t *render)
|
|||||||
render->win_state == ROLLED)
|
render->win_state == ROLLED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
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);
|
||||||
|
BIN
programs/media/Fplay/winlib/ISTOKWEB.TTF
Normal file
BIN
programs/media/Fplay/winlib/ISTOKWEB.TTF
Normal file
Binary file not shown.
@ -0,0 +1,94 @@
|
|||||||
|
Copyright (c) 2008-2011, Andrey V. Panov (panov@canopus.iacp.dvo.ru),
|
||||||
|
with Reserved Font Name "Istok".
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
@ -3,6 +3,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "winlib.h"
|
#include "winlib.h"
|
||||||
|
|
||||||
extern int res_level[];
|
extern int res_level[];
|
||||||
@ -120,9 +121,8 @@ int draw_button(button_t *btn)
|
|||||||
|
|
||||||
int draw_button_cairo(button_t *btn)
|
int draw_button_cairo(button_t *btn)
|
||||||
{
|
{
|
||||||
int *pixmap, *src;
|
int *src;
|
||||||
ctx_t *ctx;
|
ctx_t *ctx;
|
||||||
int i, j;
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
ctx = btn->ctrl.ctx;
|
ctx = btn->ctrl.ctx;
|
||||||
@ -130,10 +130,6 @@ int draw_button_cairo(button_t *btn)
|
|||||||
x = btn->ctrl.rc.l - ctx->offset_x;
|
x = btn->ctrl.rc.l - ctx->offset_x;
|
||||||
y = btn->ctrl.rc.t - ctx->offset_y;
|
y = btn->ctrl.rc.t - ctx->offset_y;
|
||||||
|
|
||||||
pixmap = ctx->pixmap;
|
|
||||||
|
|
||||||
pixmap+= y*ctx->stride/4 + x;
|
|
||||||
|
|
||||||
src = btn->img_default;
|
src = btn->img_default;
|
||||||
|
|
||||||
if(btn->state & bPressed)
|
if(btn->state & bPressed)
|
||||||
@ -141,13 +137,7 @@ int draw_button_cairo(button_t *btn)
|
|||||||
else if(btn->state & bHighlight)
|
else if(btn->state & bHighlight)
|
||||||
src = btn->img_hilite;
|
src = btn->img_hilite;
|
||||||
|
|
||||||
for(i=0; i < btn->ctrl.h ;i++)
|
blit_raw(ctx, src, x, y, btn->ctrl.w, btn->ctrl.h, btn->ctrl.w*4);
|
||||||
{
|
|
||||||
for(j = 0; j < btn->ctrl.w; j++)
|
|
||||||
pixmap[j] = src[j];
|
|
||||||
pixmap+= ctx->stride/4;
|
|
||||||
src+= btn->ctrl.w;
|
|
||||||
};
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
@ -262,6 +252,7 @@ int draw_progress(progress_t *prg, int background)
|
|||||||
ctx_t *ctx;
|
ctx_t *ctx;
|
||||||
int i, j;
|
int i, j;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
rect_t rc = prg->ctrl.rc;
|
||||||
|
|
||||||
int len = prg->ctrl.w;
|
int len = prg->ctrl.w;
|
||||||
|
|
||||||
@ -274,15 +265,15 @@ int draw_progress(progress_t *prg, int background)
|
|||||||
{
|
{
|
||||||
src = res_progress_bar;
|
src = res_progress_bar;
|
||||||
|
|
||||||
pixmap = ctx->pixmap;
|
pixmap = (int*)ctx->pixmap->data;
|
||||||
pixmap+= y * ctx->stride/4 + x;
|
pixmap+= y * ctx->pixmap->pitch/4 + x;
|
||||||
|
|
||||||
for(i=0; i < 10; i++)
|
for(i=0; i < 10; i++)
|
||||||
{
|
{
|
||||||
for(j = 0; j < len; j++)
|
for(j = 0; j < len; j++)
|
||||||
pixmap[j] = *src;
|
pixmap[j] = *src;
|
||||||
|
|
||||||
pixmap+= ctx->stride/4;
|
pixmap+= ctx->pixmap->pitch/4;
|
||||||
src++;
|
src++;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -292,14 +283,14 @@ int draw_progress(progress_t *prg, int background)
|
|||||||
|
|
||||||
src = res_prg_level;
|
src = res_prg_level;
|
||||||
|
|
||||||
pixmap = ctx->pixmap;
|
pixmap = (int*)ctx->pixmap->data;
|
||||||
pixmap+= y*ctx->stride/4 + x;
|
pixmap+= y*ctx->pixmap->pitch/4 + x;
|
||||||
|
|
||||||
for(i=0; i < prg->ctrl.h ;i++)
|
for(i=0; i < prg->ctrl.h ;i++)
|
||||||
{
|
{
|
||||||
for(j=0; j < len; j++)
|
for(j=0; j < len; j++)
|
||||||
pixmap[j] = *src;
|
pixmap[j] = *src;
|
||||||
pixmap+= ctx->stride/4;
|
pixmap+= ctx->pixmap->pitch/4;
|
||||||
src++;
|
src++;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -359,7 +350,7 @@ progress_t *create_progress(char *caption, int id, int x, int y,
|
|||||||
|
|
||||||
int draw_level(level_t *lvl)
|
int draw_level(level_t *lvl)
|
||||||
{
|
{
|
||||||
int *pixmap, *src;
|
int *pixmap;
|
||||||
ctx_t *ctx;
|
ctx_t *ctx;
|
||||||
int i, j;
|
int i, j;
|
||||||
int x, y;
|
int x, y;
|
||||||
@ -381,36 +372,18 @@ int draw_level(level_t *lvl)
|
|||||||
if(len > 96)
|
if(len > 96)
|
||||||
len = 96;
|
len = 96;
|
||||||
|
|
||||||
pixmap = ctx->pixmap;
|
pixmap = (int*)ctx->pixmap->data;
|
||||||
|
|
||||||
pixmap+= y*ctx->stride/4 + x;
|
pixmap+= y*ctx->pixmap->pitch/4 + x;
|
||||||
|
|
||||||
// for(i=0; i < prg->ctrl.h ;i++)
|
|
||||||
// {
|
|
||||||
// for(j=0; j < len; j++)
|
|
||||||
// pixmap[j] = src;
|
|
||||||
// pixmap+= ctx->stride/4;
|
|
||||||
// };
|
|
||||||
|
|
||||||
src = lvl->img_level;
|
|
||||||
|
|
||||||
for(i=0; i < 10; i++)
|
for(i=0; i < 10; i++)
|
||||||
{
|
{
|
||||||
for(j = 0; j < 96; j++)
|
for(j = 0; j < 96; j++)
|
||||||
pixmap[j] = 0xFF1C1C1C;
|
pixmap[j] = 0xFF1C1C1C;
|
||||||
pixmap+= ctx->stride/4;
|
pixmap+= ctx->pixmap->pitch/4;
|
||||||
};
|
};
|
||||||
|
|
||||||
pixmap = ctx->pixmap;
|
blit_raw(ctx, lvl->img_level, x, y, len, 10, 96*4);
|
||||||
pixmap+= y*ctx->stride/4 + x;
|
|
||||||
|
|
||||||
for(i=0; i < 10; i++)
|
|
||||||
{
|
|
||||||
for(j = 0; j < len; j++)
|
|
||||||
pixmap[j] = src[j];
|
|
||||||
pixmap+= ctx->stride/4;
|
|
||||||
src+= 96;
|
|
||||||
};
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
@ -466,7 +439,7 @@ level_t *create_level(char *caption, int id, int x, int y,
|
|||||||
|
|
||||||
int draw_slider(slider_t *sld)
|
int draw_slider(slider_t *sld)
|
||||||
{
|
{
|
||||||
int *pixmap, *src;
|
int *pixmap;
|
||||||
ctx_t *ctx;
|
ctx_t *ctx;
|
||||||
int i, j;
|
int i, j;
|
||||||
int x, y;
|
int x, y;
|
||||||
@ -479,44 +452,21 @@ int draw_slider(slider_t *sld)
|
|||||||
x = sld->ctrl.rc.l - ctx->offset_x;
|
x = sld->ctrl.rc.l - ctx->offset_x;
|
||||||
y = sld->ctrl.rc.t - ctx->offset_y;
|
y = sld->ctrl.rc.t - ctx->offset_y;
|
||||||
|
|
||||||
|
|
||||||
len = 96 + 12;
|
len = 96 + 12;
|
||||||
|
|
||||||
pixmap = ctx->pixmap;
|
pixmap = (int*)ctx->pixmap->data;
|
||||||
pixmap+= y*ctx->stride/4 + x;
|
pixmap+= y*ctx->pixmap->pitch/4 + x;
|
||||||
|
|
||||||
for(i=0; i < 11; i++)
|
for(i=0; i < 11; i++)
|
||||||
{
|
{
|
||||||
for(j = 0; j < len; j++)
|
for(j = 0; j < len; j++)
|
||||||
pixmap[j] = 0xFF1C1C1C;
|
pixmap[j] = 0xFF1C1C1C;
|
||||||
pixmap+= ctx->stride/4;
|
pixmap+= ctx->pixmap->pitch/4;
|
||||||
};
|
};
|
||||||
|
|
||||||
pixmap = ctx->pixmap;
|
blit_raw(ctx, sld->img_vol_slider, x+6, y+4, 96, 4, 96*4);
|
||||||
pixmap+= (y+4)*ctx->stride/4 + x + 6;
|
|
||||||
|
|
||||||
src = sld->img_vol_slider;
|
blit_raw(ctx, res_slider, x+sld->pos, y, 12, 11, 12*4);
|
||||||
|
|
||||||
for(i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
for(j = 0; j < 96; j++)
|
|
||||||
pixmap[j] = src[j];
|
|
||||||
pixmap+= ctx->stride/4;
|
|
||||||
src+= 96;
|
|
||||||
};
|
|
||||||
|
|
||||||
pixmap = ctx->pixmap;
|
|
||||||
pixmap+= y*ctx->stride/4 + x + sld->pos;
|
|
||||||
|
|
||||||
src = res_slider;
|
|
||||||
|
|
||||||
for(i = 0; i < 11; i++)
|
|
||||||
{
|
|
||||||
for(j = 0; j < 12; j++)
|
|
||||||
pixmap[j] = src[j];
|
|
||||||
pixmap+= ctx->stride/4;
|
|
||||||
src+= 12;
|
|
||||||
};
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
@ -41,16 +41,19 @@ int init_caption(window_t *win)
|
|||||||
|
|
||||||
cpt->text = win->caption_txt;
|
cpt->text = win->caption_txt;
|
||||||
|
|
||||||
ctx->pixmap = user_alloc(1920*CAPTION_HEIGHT*4);
|
cpt->bitmap.width = 1920;
|
||||||
if(!ctx->pixmap)
|
cpt->bitmap.height = CAPTION_HEIGHT;
|
||||||
|
cpt->bitmap.flags = 0;
|
||||||
|
|
||||||
|
if( create_bitmap(&cpt->bitmap) )
|
||||||
{
|
{
|
||||||
printf("not enough memory for caption bitmap\n");
|
printf("not enough memory for caption bitmap\n");
|
||||||
return 0;
|
return 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
// printf("win_w %d win_h %d\n", win->w, win->h);
|
// printf("win_w %d win_h %d\n", win->w, win->h);
|
||||||
|
ctx->pixmap = &cpt->bitmap;
|
||||||
ctx->stride = win->w*4;
|
|
||||||
ctx->offset_x = 0;
|
ctx->offset_x = 0;
|
||||||
ctx->offset_y = 0;
|
ctx->offset_y = 0;
|
||||||
|
|
||||||
@ -79,23 +82,25 @@ int init_caption(window_t *win)
|
|||||||
void update_caption_size(window_t *win)
|
void update_caption_size(window_t *win)
|
||||||
{
|
{
|
||||||
caption_t *cpt = &win->caption;
|
caption_t *cpt = &win->caption;
|
||||||
|
bitmap_t *bitmap = cpt->ctx.pixmap;
|
||||||
|
|
||||||
int old_size;
|
int old_size;
|
||||||
int new_size;
|
int new_size;
|
||||||
int stride;
|
int pitch;
|
||||||
|
|
||||||
old_size = cpt->ctx.stride * CAPTION_HEIGHT;
|
old_size = bitmap->pitch * bitmap->height;
|
||||||
old_size = (old_size+4095) & ~4095;
|
old_size = (old_size+4095) & ~4095;
|
||||||
|
|
||||||
stride = win->w*4;
|
pitch = ALIGN(win->w*4, 16);
|
||||||
|
|
||||||
new_size = stride * CAPTION_HEIGHT;
|
new_size = pitch * CAPTION_HEIGHT;
|
||||||
new_size = (new_size+4095) & ~4095;
|
new_size = (new_size+4095) & ~4095;
|
||||||
|
|
||||||
if( new_size < old_size)
|
if( new_size < old_size)
|
||||||
user_unmap(cpt->ctx.pixmap, new_size, old_size-new_size);
|
user_unmap(bitmap->data, new_size, old_size-new_size);
|
||||||
|
|
||||||
cpt->ctx.stride = stride;
|
bitmap->width = win->w;
|
||||||
|
bitmap->pitch = pitch;
|
||||||
|
|
||||||
cpt->ctrl.rc.l = 0;
|
cpt->ctrl.rc.l = 0;
|
||||||
cpt->ctrl.rc.t = 0;
|
cpt->ctrl.rc.t = 0;
|
||||||
@ -115,37 +120,22 @@ void update_caption_size(window_t *win)
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t width;
|
|
||||||
uint32_t height;
|
|
||||||
uint32_t pitch;
|
|
||||||
uint32_t handle;
|
|
||||||
uint8_t *data;
|
|
||||||
}bitmap_t;
|
|
||||||
|
|
||||||
extern int win_font;
|
extern int win_font;
|
||||||
|
|
||||||
void draw_caption(caption_t *cpt)
|
void draw_caption(caption_t *cpt)
|
||||||
{
|
{
|
||||||
int *pixmap, *src;
|
int *pixmap, *src;
|
||||||
|
rect_t rc;
|
||||||
int i, j, w;
|
int i, j, w;
|
||||||
|
|
||||||
pixmap = cpt->ctx.pixmap;
|
blit_raw(&cpt->ctx, res_caption_left, 0, 0,
|
||||||
src = res_caption_left;
|
CAPTION_CORNER_W, CAPTION_HEIGHT, CAPTION_CORNER_W*4);
|
||||||
|
|
||||||
for(i=0; i < CAPTION_HEIGHT; i++)
|
|
||||||
{
|
|
||||||
for(j=0; j < CAPTION_CORNER_W; j++)
|
|
||||||
pixmap[j] = src[j];
|
|
||||||
pixmap+= cpt->ctx.stride/4;
|
|
||||||
src+= CAPTION_CORNER_W;
|
|
||||||
};
|
|
||||||
|
|
||||||
w = cpt->ctrl.w - (2*CAPTION_CORNER_W);
|
w = cpt->ctrl.w - (2*CAPTION_CORNER_W);
|
||||||
if( w > 0)
|
if( w > 0)
|
||||||
{
|
{
|
||||||
pixmap = cpt->ctx.pixmap;
|
pixmap = (int*)cpt->ctx.pixmap->data;
|
||||||
pixmap+= CAPTION_CORNER_W;
|
pixmap+= CAPTION_CORNER_W;
|
||||||
src = res_caption_body;
|
src = res_caption_body;
|
||||||
|
|
||||||
@ -153,29 +143,25 @@ void draw_caption(caption_t *cpt)
|
|||||||
{
|
{
|
||||||
for(j = 0; j < w; j++)
|
for(j = 0; j < w; j++)
|
||||||
pixmap[j] = src[i];
|
pixmap[j] = src[i];
|
||||||
pixmap+= cpt->ctx.stride/4;
|
pixmap+= cpt->ctx.pixmap->pitch/4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// blit_raw(&cpt->ctx,res_caption_body, CAPTION_CORNER_W, 0,
|
||||||
|
// w, CAPTION_HEIGHT, 0);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pixmap = cpt->ctx.pixmap;
|
|
||||||
pixmap+= cpt->ctrl.w - CAPTION_CORNER_W;
|
|
||||||
|
|
||||||
src = res_caption_right;
|
blit_raw(&cpt->ctx,res_caption_right, cpt->ctrl.w - CAPTION_CORNER_W, 0,
|
||||||
|
CAPTION_CORNER_W, CAPTION_HEIGHT,CAPTION_CORNER_W*4);
|
||||||
|
|
||||||
for(i = 0; i < CAPTION_HEIGHT; i++)
|
rc.l = 8;
|
||||||
{
|
rc.t = 0;
|
||||||
for(j = 0; j < CAPTION_CORNER_W; j++)
|
rc.r = cpt->ctrl.w - 25 - 16 - 5 - 8;
|
||||||
pixmap[j] = src[j];
|
rc.b = 18;
|
||||||
pixmap+= cpt->ctx.stride/4;
|
|
||||||
src+= CAPTION_CORNER_W;
|
printf(cpt->text);
|
||||||
};
|
draw_text_ext(cpt->ctx.pixmap, win_font, cpt->text, &rc, 0xFFFFFFFF);
|
||||||
|
|
||||||
bitmap_t bitmap;
|
|
||||||
|
|
||||||
bitmap.data = cpt->ctx.pixmap;
|
|
||||||
bitmap.pitch = cpt->ctx.stride;
|
|
||||||
|
|
||||||
draw_text(&bitmap, win_font, cpt->text, 8, 18, 0xFFFFFFFF);
|
|
||||||
|
|
||||||
ctrl_t *child;
|
ctrl_t *child;
|
||||||
child = (ctrl_t*)cpt->ctrl.child.next;
|
child = (ctrl_t*)cpt->ctrl.child.next;
|
||||||
@ -261,7 +247,7 @@ void blit_caption(caption_t *cpt)
|
|||||||
// printf("%s w:%d h:%d stride: %d\n",__FUNCTION__,
|
// printf("%s w:%d h:%d stride: %d\n",__FUNCTION__,
|
||||||
// cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.stride);
|
// cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.stride);
|
||||||
|
|
||||||
Blit(cpt->ctx.pixmap, 0, 0, 0, 0, cpt->ctrl.w, cpt->ctrl.h,
|
Blit(cpt->ctx.pixmap->data, 0, 0, 0, 0, cpt->ctrl.w, cpt->ctrl.h,
|
||||||
cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.stride);
|
cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.pixmap->pitch);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef __CONTROL_H__
|
#ifndef __CONTROL_H__
|
||||||
#define __CONTROL_H_
|
#define __CONTROL_H_
|
||||||
|
|
||||||
|
#include <pixlib2.h>
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -13,8 +14,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct ctx
|
typedef struct ctx
|
||||||
{
|
{
|
||||||
void *pixmap;
|
bitmap_t *pixmap;
|
||||||
int stride;
|
|
||||||
int offset_x;
|
int offset_x;
|
||||||
int offset_y;
|
int offset_y;
|
||||||
}ctx_t;
|
}ctx_t;
|
||||||
@ -201,4 +201,10 @@ ctrl_t *get_child(ctrl_t *ctrl, int x, int y);
|
|||||||
|
|
||||||
ctrl_t *capture_mouse(ctrl_t *newm);
|
ctrl_t *capture_mouse(ctrl_t *newm);
|
||||||
|
|
||||||
|
void blit_raw(ctx_t *ctx, void *raw, int x, int y, int w, int h, int pitch);
|
||||||
|
|
||||||
|
#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
|
||||||
|
#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,21 +4,24 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include "font_droid.h"
|
//#include "font_droid.h"
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
|
#include <pixlib2.h>
|
||||||
|
|
||||||
typedef unsigned int color_t;
|
extern char res_def_font[];
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t width;
|
int l;
|
||||||
uint32_t height;
|
int t;
|
||||||
uint32_t pitch;
|
int r;
|
||||||
uint32_t handle;
|
int b;
|
||||||
uint8_t *data;
|
}rect_t;
|
||||||
}bitmap_t;
|
|
||||||
|
|
||||||
|
typedef unsigned int color_t;
|
||||||
|
|
||||||
|
unsigned int ansi2utf32(unsigned char ch);
|
||||||
|
|
||||||
void my_draw_bitmap(bitmap_t *win, FT_Bitmap *bitmap, int dstx, int dsty, int col)
|
void my_draw_bitmap(bitmap_t *win, FT_Bitmap *bitmap, int dstx, int dsty, int col)
|
||||||
{
|
{
|
||||||
@ -65,23 +68,26 @@ void my_draw_bitmap(bitmap_t *win, FT_Bitmap *bitmap, int dstx, int dsty, int co
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int draw_text(bitmap_t * winbitmap, FT_Face face, char *text, int x, int y, int color)
|
int draw_text_ext(bitmap_t *winbitmap, FT_Face face, char *text, rect_t *rc, int color)
|
||||||
{
|
{
|
||||||
FT_UInt glyph_index;
|
FT_UInt glyph_index;
|
||||||
FT_Bool use_kerning = 0;
|
FT_Bool use_kerning = 0;
|
||||||
FT_UInt previous;
|
FT_UInt previous;
|
||||||
|
int x, y, w;
|
||||||
char ch;
|
char ch;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
use_kerning = FT_HAS_KERNING( face );
|
use_kerning = FT_HAS_KERNING( face );
|
||||||
previous = 0;
|
previous = 0;
|
||||||
|
|
||||||
x <<= 6;
|
x = rc->l << 6;
|
||||||
|
y = rc->b;
|
||||||
|
|
||||||
|
w = (rc->r - rc->l) << 6;
|
||||||
|
|
||||||
while( ch = *text++ )
|
while( ch = *text++ )
|
||||||
{
|
{
|
||||||
glyph_index = FT_Get_Char_Index( face, ch );
|
glyph_index = FT_Get_Char_Index( face, ansi2utf32(ch) );
|
||||||
|
|
||||||
if ( use_kerning && previous && glyph_index )
|
if ( use_kerning && previous && glyph_index )
|
||||||
{
|
{
|
||||||
@ -90,6 +96,9 @@ int draw_text(bitmap_t * winbitmap, FT_Face face, char *text, int x, int y, int
|
|||||||
x += delta.x ;
|
x += delta.x ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( x + face->glyph->advance.x > w)
|
||||||
|
break;
|
||||||
|
|
||||||
err = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
|
err = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
|
||||||
if ( err )
|
if ( err )
|
||||||
continue;
|
continue;
|
||||||
@ -108,6 +117,7 @@ int draw_text(bitmap_t * winbitmap, FT_Face face, char *text, int x, int y, int
|
|||||||
return err;
|
return err;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int init_fontlib()
|
int init_fontlib()
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@ -122,9 +132,9 @@ int init_fontlib()
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = FT_New_Face( library, "/hd0/1/istokweb.ttf", 0, &face );
|
// err = FT_New_Face( library, "/hd0/1/IstokWeb.ttf", 0, &face );
|
||||||
|
|
||||||
// err = FT_New_Memory_Face( library, pdf_font_DroidSans, 139280, 0, &face );
|
err = FT_New_Memory_Face( library, res_def_font, 277996, 0, &face );
|
||||||
if ( err == FT_Err_Unknown_File_Format )
|
if ( err == FT_Err_Unknown_File_Format )
|
||||||
{
|
{
|
||||||
printf("font format is unsupported\n");
|
printf("font format is unsupported\n");
|
||||||
@ -138,7 +148,7 @@ int init_fontlib()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = FT_Set_Char_Size( face, 0, 12*64, 96, 96 );
|
err = FT_Set_Char_Size( face, 0, 11*64, 96, 96 );
|
||||||
// err = FT_Set_Pixel_Sizes( face, 0, 100 );
|
// err = FT_Set_Pixel_Sizes( face, 0, 100 );
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@ -148,3 +158,26 @@ done:
|
|||||||
|
|
||||||
// draw_text(face,"/hd0/1/demo", 10, 80, 0x00000000);
|
// draw_text(face,"/hd0/1/demo", 10, 80, 0x00000000);
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int ansi2utf32(unsigned char ch)
|
||||||
|
{
|
||||||
|
if(ch < 0x80)
|
||||||
|
return ch;
|
||||||
|
|
||||||
|
if(ch < 0xB0)
|
||||||
|
return 0x410-0x80 + ch;
|
||||||
|
|
||||||
|
if(ch < 0xE0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if(ch < 0xF0)
|
||||||
|
return 0x440-0xE0 + ch;
|
||||||
|
|
||||||
|
if(ch == 0xF0)
|
||||||
|
return 0x401;
|
||||||
|
else if(ch==0xF1)
|
||||||
|
return 0x451;
|
||||||
|
else return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,8 +77,7 @@ int draw_frame(window_t *win)
|
|||||||
|
|
||||||
frame_t *fr = &win->frame;
|
frame_t *fr = &win->frame;
|
||||||
|
|
||||||
|
pixmap = (int*)win->ctx->pixmap->data;
|
||||||
pixmap = win->ctx->pixmap;
|
|
||||||
pixmap+= CAPTION_HEIGHT*win->w;
|
pixmap+= CAPTION_HEIGHT*win->w;
|
||||||
src = res_border_left;
|
src = res_border_left;
|
||||||
|
|
||||||
@ -87,11 +86,11 @@ int draw_frame(window_t *win)
|
|||||||
for(j = 0; j < FRAME_WIDTH; j++)
|
for(j = 0; j < FRAME_WIDTH; j++)
|
||||||
pixmap[j] = src[j];
|
pixmap[j] = src[j];
|
||||||
|
|
||||||
pixmap+= win->ctx->stride/4;
|
pixmap+= win->ctx->pixmap->pitch/4;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
pixmap = win->ctx->pixmap;
|
pixmap = (int*)win->ctx->pixmap->data;
|
||||||
pixmap+= (CAPTION_HEIGHT+1)*win->w - FRAME_WIDTH;
|
pixmap+= (CAPTION_HEIGHT+1)*win->w - FRAME_WIDTH;
|
||||||
src = res_border_right;
|
src = res_border_right;
|
||||||
|
|
||||||
@ -100,10 +99,10 @@ int draw_frame(window_t *win)
|
|||||||
for(j = 0; j < FRAME_WIDTH; j++)
|
for(j = 0; j < FRAME_WIDTH; j++)
|
||||||
pixmap[j] = src[j];
|
pixmap[j] = src[j];
|
||||||
|
|
||||||
pixmap+= win->ctx->stride/4;
|
pixmap+= win->ctx->pixmap->pitch/4;
|
||||||
};
|
};
|
||||||
|
|
||||||
pixmap = win->ctx->pixmap;
|
pixmap = (int*)win->ctx->pixmap->data;
|
||||||
|
|
||||||
pixmap+= fr->bottom.t * win->w;
|
pixmap+= fr->bottom.t * win->w;
|
||||||
|
|
||||||
@ -112,7 +111,7 @@ int draw_frame(window_t *win)
|
|||||||
for(j = 0; j < win->w; j++)
|
for(j = 0; j < win->w; j++)
|
||||||
pixmap[j] = 0x808080;
|
pixmap[j] = 0x808080;
|
||||||
|
|
||||||
pixmap+= win->ctx->stride/4;
|
pixmap+= win->ctx->pixmap->pitch/4;
|
||||||
};
|
};
|
||||||
|
|
||||||
ctrl_t *child;
|
ctrl_t *child;
|
||||||
|
BIN
programs/media/Fplay/winlib/logo.raw
Normal file
BIN
programs/media/Fplay/winlib/logo.raw
Normal file
Binary file not shown.
@ -53,17 +53,21 @@ int init_panel(window_t *win)
|
|||||||
panel->ctrl.parent = (ctrl_t*)win;
|
panel->ctrl.parent = (ctrl_t*)win;
|
||||||
|
|
||||||
panel->layout = 0;
|
panel->layout = 0;
|
||||||
|
|
||||||
|
panel->bitmap.width = 1920;
|
||||||
|
panel->bitmap.height = PANEL_HEIGHT;
|
||||||
|
panel->bitmap.flags = 0;
|
||||||
|
|
||||||
ctx->pixmap = user_alloc(1920*PANEL_HEIGHT*4);
|
if( create_bitmap(&panel->bitmap) )
|
||||||
if(!ctx->pixmap)
|
|
||||||
{
|
{
|
||||||
printf("not enough memory for caption bitmap\n");
|
printf("not enough memory for panel bitmap\n");
|
||||||
return 0;
|
return 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
// printf("win_w %d win_h %d\n", win->w, win->h);
|
ctx->pixmap = &panel->bitmap;
|
||||||
|
ctx->offset_x = 0;
|
||||||
|
ctx->offset_y = 0;
|
||||||
|
|
||||||
ctx->stride = win->w*4;
|
|
||||||
panel->ctrl.ctx = ctx;
|
panel->ctrl.ctx = ctx;
|
||||||
|
|
||||||
btn = create_button(NULL, ID_PLAY,0,19,32,32,&panel->ctrl);
|
btn = create_button(NULL, ID_PLAY,0,19,32,32,&panel->ctrl);
|
||||||
@ -86,10 +90,10 @@ int init_panel(window_t *win)
|
|||||||
lvl = create_level(NULL, ID_VOL_LEVEL, 0, 20, 96, 10, &panel->ctrl);
|
lvl = create_level(NULL, ID_VOL_LEVEL, 0, 20, 96, 10, &panel->ctrl);
|
||||||
lvl->vol = -1875;
|
lvl->vol = -1875;
|
||||||
panel->lvl = lvl;
|
panel->lvl = lvl;
|
||||||
|
|
||||||
sld = create_slider(NULL, ID_VOL_CTRL, 0, 20, 96+12, 12, &panel->ctrl);
|
sld = create_slider(NULL, ID_VOL_CTRL, 0, 20, 96+12, 12, &panel->ctrl);
|
||||||
panel->sld = sld;
|
panel->sld = sld;
|
||||||
|
|
||||||
// btn = create_button(NULL, ID_MINIMIZE,0,5,16,18,(ctrl_t*)cpt);
|
// btn = create_button(NULL, ID_MINIMIZE,0,5,16,18,(ctrl_t*)cpt);
|
||||||
// cpt->minimize_btn = btn;
|
// cpt->minimize_btn = btn;
|
||||||
|
|
||||||
@ -109,7 +113,7 @@ static void panel_update_layout(panel_t *panel)
|
|||||||
{
|
{
|
||||||
progress_t *prg = panel->prg;
|
progress_t *prg = panel->prg;
|
||||||
level_t *lvl = panel->lvl;
|
level_t *lvl = panel->lvl;
|
||||||
|
|
||||||
if(panel->layout == 0)
|
if(panel->layout == 0)
|
||||||
{
|
{
|
||||||
prg->ctrl.rc.l = panel->ctrl.rc.l;
|
prg->ctrl.rc.l = panel->ctrl.rc.l;
|
||||||
@ -129,7 +133,7 @@ static void panel_update_layout(panel_t *panel)
|
|||||||
lvl->ctrl.rc.t = panel->ctrl.rc.t+7;
|
lvl->ctrl.rc.t = panel->ctrl.rc.t+7;
|
||||||
lvl->ctrl.rc.r = lvl->ctrl.rc.l + lvl->ctrl.w;
|
lvl->ctrl.rc.r = lvl->ctrl.rc.l + lvl->ctrl.w;
|
||||||
lvl->ctrl.rc.b = lvl->ctrl.rc.t + lvl->ctrl.h;
|
lvl->ctrl.rc.b = lvl->ctrl.rc.t + lvl->ctrl.h;
|
||||||
|
|
||||||
prg->ctrl.rc.l = lvl->ctrl.rc.r;
|
prg->ctrl.rc.l = lvl->ctrl.rc.r;
|
||||||
prg->ctrl.rc.t = panel->ctrl.rc.t+7;
|
prg->ctrl.rc.t = panel->ctrl.rc.t+7;
|
||||||
prg->ctrl.rc.r = panel->ctrl.rc.r;
|
prg->ctrl.rc.r = panel->ctrl.rc.r;
|
||||||
@ -140,13 +144,13 @@ static void panel_update_layout(panel_t *panel)
|
|||||||
|
|
||||||
void panel_set_layout(panel_t *panel, int layout)
|
void panel_set_layout(panel_t *panel, int layout)
|
||||||
{
|
{
|
||||||
panel->layout = layout;
|
panel->layout = layout;
|
||||||
panel->lvl->visible = layout;
|
panel->lvl->visible = layout;
|
||||||
|
|
||||||
panel_update_layout(panel);
|
panel_update_layout(panel);
|
||||||
|
|
||||||
send_message(&panel->prg->ctrl, MSG_PAINT, 0, 0);
|
send_message(&panel->prg->ctrl, MSG_PAINT, 0, 0);
|
||||||
|
|
||||||
if(layout)
|
if(layout)
|
||||||
send_message(&panel->lvl->ctrl, MSG_PAINT, 0, 0);
|
send_message(&panel->lvl->ctrl, MSG_PAINT, 0, 0);
|
||||||
};
|
};
|
||||||
@ -154,23 +158,26 @@ void panel_set_layout(panel_t *panel, int layout)
|
|||||||
void update_panel_size(window_t *win)
|
void update_panel_size(window_t *win)
|
||||||
{
|
{
|
||||||
panel_t *panel = &win->panel;
|
panel_t *panel = &win->panel;
|
||||||
|
bitmap_t *bitmap = panel->ctx.pixmap;
|
||||||
|
|
||||||
int old_size;
|
int old_size;
|
||||||
int new_size;
|
int new_size;
|
||||||
int stride;
|
int pitch;
|
||||||
|
|
||||||
old_size = panel->ctx.stride * PANEL_HEIGHT;
|
old_size = bitmap->pitch * bitmap->height;
|
||||||
old_size = (old_size+4095) & ~4095;
|
old_size = (old_size+4095) & ~4095;
|
||||||
|
|
||||||
stride = win->w*4;
|
pitch = ALIGN(win->w*4, 16);
|
||||||
|
|
||||||
new_size = stride * PANEL_HEIGHT;
|
new_size = pitch * PANEL_HEIGHT;
|
||||||
new_size = (new_size+4095) & ~4095;
|
new_size = (new_size+4095) & ~4095;
|
||||||
|
|
||||||
if( new_size < old_size)
|
if( new_size < old_size)
|
||||||
user_unmap(panel->ctx.pixmap, new_size, old_size-new_size);
|
user_unmap(bitmap->data, new_size, old_size-new_size);
|
||||||
|
|
||||||
|
bitmap->width = win->w;
|
||||||
|
bitmap->pitch = pitch;
|
||||||
|
|
||||||
panel->ctx.stride = stride;
|
|
||||||
panel->ctx.offset_x = 0;
|
panel->ctx.offset_x = 0;
|
||||||
panel->ctx.offset_y = win->h-PANEL_HEIGHT;
|
panel->ctx.offset_y = win->h-PANEL_HEIGHT;
|
||||||
|
|
||||||
@ -203,7 +210,7 @@ void update_panel_size(window_t *win)
|
|||||||
panel->sld->ctrl.rc.r = panel->sld->ctrl.rc.l + panel->sld->ctrl.w;
|
panel->sld->ctrl.rc.r = panel->sld->ctrl.rc.l + panel->sld->ctrl.w;
|
||||||
panel->sld->ctrl.rc.b = panel->sld->ctrl.rc.t + panel->sld->ctrl.h;
|
panel->sld->ctrl.rc.b = panel->sld->ctrl.rc.t + panel->sld->ctrl.h;
|
||||||
|
|
||||||
panel_update_layout(panel);
|
panel_update_layout(panel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -212,21 +219,14 @@ void draw_panel(panel_t *panel)
|
|||||||
int *pixmap, *src;
|
int *pixmap, *src;
|
||||||
int i, j, w;
|
int i, j, w;
|
||||||
|
|
||||||
pixmap = panel->ctx.pixmap;
|
blit_raw(&panel->ctx, res_panel_left, 0, 0,
|
||||||
src = res_panel_left;
|
PANEL_CORNER_W, PANEL_HEIGHT, PANEL_CORNER_W*4);
|
||||||
|
|
||||||
for(i=0; i < PANEL_HEIGHT; i++)
|
|
||||||
{
|
|
||||||
for(j=0; j < PANEL_CORNER_W; j++)
|
|
||||||
pixmap[j] = src[j];
|
|
||||||
pixmap+= panel->ctx.stride/4;
|
|
||||||
src+= PANEL_CORNER_W;
|
|
||||||
};
|
|
||||||
|
|
||||||
w = panel->ctrl.w - (2*PANEL_CORNER_W);
|
w = panel->ctrl.w - (2*PANEL_CORNER_W);
|
||||||
if( w > 0)
|
if( w > 0)
|
||||||
{
|
{
|
||||||
pixmap = panel->ctx.pixmap;
|
pixmap = (int*)panel->ctx.pixmap->data;
|
||||||
pixmap+= PANEL_CORNER_W;
|
pixmap+= PANEL_CORNER_W;
|
||||||
src = res_panel_body;
|
src = res_panel_body;
|
||||||
|
|
||||||
@ -234,29 +234,20 @@ void draw_panel(panel_t *panel)
|
|||||||
{
|
{
|
||||||
for(j = 0; j < w; j++)
|
for(j = 0; j < w; j++)
|
||||||
pixmap[j] = src[i];
|
pixmap[j] = src[i];
|
||||||
pixmap+= panel->ctx.stride/4;
|
pixmap+= panel->ctx.pixmap->pitch/4;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pixmap = panel->ctx.pixmap;
|
blit_raw(&panel->ctx, res_panel_right, panel->ctrl.w - PANEL_CORNER_W, 0,
|
||||||
pixmap+= panel->ctrl.w - PANEL_CORNER_W;
|
PANEL_CORNER_W, PANEL_HEIGHT, PANEL_CORNER_W*4);
|
||||||
|
|
||||||
src = res_panel_right;
|
|
||||||
|
|
||||||
for(i = 0; i < PANEL_HEIGHT; i++)
|
|
||||||
{
|
|
||||||
for(j = 0; j < PANEL_CORNER_W; j++)
|
|
||||||
pixmap[j] = src[j];
|
|
||||||
pixmap+= panel->ctx.stride/4;
|
|
||||||
src+= PANEL_CORNER_W;
|
|
||||||
};
|
|
||||||
|
|
||||||
ctrl_t *child;
|
ctrl_t *child;
|
||||||
child = (ctrl_t*)panel->ctrl.child.next;
|
child = (ctrl_t*)panel->ctrl.child.next;
|
||||||
|
|
||||||
while( &child->link != &panel->ctrl.child)
|
while( &child->link != &panel->ctrl.child)
|
||||||
{
|
{
|
||||||
send_message(child, 1, 0, 0);
|
send_message(child, MSG_PAINT, 0, 0);
|
||||||
child = (ctrl_t*)child->link.next;
|
child = (ctrl_t*)child->link.next;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -306,7 +297,7 @@ int panel_proc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
|
|||||||
case ID_PLAY:
|
case ID_PLAY:
|
||||||
case ID_STOP:
|
case ID_STOP:
|
||||||
case ID_PROGRESS:
|
case ID_PROGRESS:
|
||||||
case ID_VOL_CTRL:
|
case ID_VOL_CTRL:
|
||||||
win = get_parent_window(ctrl);
|
win = get_parent_window(ctrl);
|
||||||
send_message(win, msg, arg1, arg2);
|
send_message(win, msg, arg1, arg2);
|
||||||
break;
|
break;
|
||||||
@ -328,8 +319,8 @@ void blit_panel(panel_t *panel)
|
|||||||
// printf("%s w:%d h:%d stride: %d\n",__FUNCTION__,
|
// printf("%s w:%d h:%d stride: %d\n",__FUNCTION__,
|
||||||
// cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.stride);
|
// cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.stride);
|
||||||
|
|
||||||
Blit(panel->ctx.pixmap, panel->draw.l, panel->draw.t,
|
Blit(panel->ctx.pixmap->data, panel->draw.l, panel->draw.t,
|
||||||
0, 0, panel->ctrl.w, panel->ctrl.h,
|
0, 0, panel->ctrl.w, panel->ctrl.h,
|
||||||
panel->ctrl.w, panel->ctrl.h, panel->ctx.stride);
|
panel->ctrl.w, panel->ctrl.h, panel->ctx.pixmap->pitch);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ public _res_vol_slider
|
|||||||
public _res_progress_bar
|
public _res_progress_bar
|
||||||
public _res_prg_level
|
public _res_prg_level
|
||||||
|
|
||||||
|
public _res_def_font
|
||||||
|
|
||||||
section '.rdata' data readable align 16
|
section '.rdata' data readable align 16
|
||||||
|
|
||||||
@ -87,3 +88,5 @@ _res_slider: file 'slider.raw'
|
|||||||
|
|
||||||
_res_progress_bar: file 'pbar.raw'
|
_res_progress_bar: file 'pbar.raw'
|
||||||
_res_prg_level: file 'prg_level.raw'
|
_res_prg_level: file 'prg_level.raw'
|
||||||
|
|
||||||
|
_res_def_font: file 'IstokWeb.ttf'
|
||||||
|
10
programs/media/Fplay/winlib/resource.h
Normal file
10
programs/media/Fplay/winlib/resource.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef IDC_STATIC
|
||||||
|
#define IDC_STATIC (-1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define IDI_CURSOR1 100
|
||||||
|
#define IDR_MENU1 101
|
||||||
|
#define IDD_DIALOG1 102
|
||||||
|
#define IDD_DIALOG2 103
|
||||||
|
#define IDOK 1000
|
||||||
|
#define IDCANCEL 1001
|
326
programs/media/Fplay/winlib/system.h
Normal file
326
programs/media/Fplay/winlib/system.h
Normal file
@ -0,0 +1,326 @@
|
|||||||
|
|
||||||
|
#include <newlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUF
|
||||||
|
#define DBG(format,...) printf(format,##__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define DBG(format,...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned int color_t;
|
||||||
|
|
||||||
|
typedef union __attribute__((packed))
|
||||||
|
{
|
||||||
|
uint32_t val;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
short x;
|
||||||
|
short y;
|
||||||
|
};
|
||||||
|
}pos_t;
|
||||||
|
|
||||||
|
typedef union __attribute__((packed))
|
||||||
|
{
|
||||||
|
uint32_t val;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint8_t state;
|
||||||
|
uint8_t code;
|
||||||
|
uint16_t ctrl_key;
|
||||||
|
};
|
||||||
|
}oskey_t;
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void BeginDraw(void)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40" ::"a"(12),"b"(1));
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void EndDraw(void)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40" ::"a"(12),"b"(2));
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline void DrawWindow(int x, int y, int w, int h, char *name,
|
||||||
|
color_t workcolor, uint32_t style)
|
||||||
|
{
|
||||||
|
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
::"a"(0),
|
||||||
|
"b"((x << 16) | (w & 0xFFFF)),
|
||||||
|
"c"((y << 16) | (h & 0xFFFF)),
|
||||||
|
"d"((style << 24) | (workcolor & 0xFFFFFF)),
|
||||||
|
"D"(name));
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline
|
||||||
|
pos_t get_mouse_pos(void)
|
||||||
|
{
|
||||||
|
pos_t val;
|
||||||
|
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40 \n\t"
|
||||||
|
"rol $16, %%eax"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(37),"b"(1));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
pos_t get_cursor_pos(void)
|
||||||
|
{
|
||||||
|
pos_t val;
|
||||||
|
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40 \n\t"
|
||||||
|
"rol $16, %%eax"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(37),"b"(0));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
uint32_t get_mouse_buttons(void)
|
||||||
|
{
|
||||||
|
uint32_t val;
|
||||||
|
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(37),"b"(2));
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline
|
||||||
|
uint32_t get_mouse_wheels(void)
|
||||||
|
{
|
||||||
|
uint32_t val;
|
||||||
|
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40 \n\t"
|
||||||
|
"rol $16, %%eax"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(37),"b"(7));
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline
|
||||||
|
uint32_t wait_for_event(uint32_t time)
|
||||||
|
{
|
||||||
|
uint32_t val;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(23), "b"(time));
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline uint32_t check_os_event()
|
||||||
|
{
|
||||||
|
uint32_t val;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(11));
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline
|
||||||
|
uint32_t get_tick_count(void)
|
||||||
|
{
|
||||||
|
uint32_t val;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(26),"b"(9));
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline
|
||||||
|
oskey_t get_key(void)
|
||||||
|
{
|
||||||
|
oskey_t val;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(2));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void draw_line(int xs, int ys, int xe, int ye, color_t color)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
::"a"(38), "d"(color),
|
||||||
|
"b"((xs << 16) | xe),
|
||||||
|
"c"((ys << 16) | ye));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void draw_bar(int x, int y, int w, int h, color_t color)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
::"a"(13), "d"(color),
|
||||||
|
"b"((x << 16) | w),
|
||||||
|
"c"((y << 16) | h));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void draw_bitmap(void *bitmap, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
::"a"(7), "b"(bitmap),
|
||||||
|
"c"((w << 16) | h),
|
||||||
|
"d"((x << 16) | y));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static inline
|
||||||
|
void draw_text_sys(const char *text, int x, int y, int len, color_t color)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
::"a"(4),"d"(text),
|
||||||
|
"b"((x << 16) | y),
|
||||||
|
"S"(len),"c"(color));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void *user_alloc(size_t size)
|
||||||
|
{
|
||||||
|
void *val;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(68),"b"(12),"c"(size));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int user_free(void *mem)
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(68),"b"(12),"c"(mem));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int *user_unmap(void *base, size_t offset, size_t size)
|
||||||
|
{
|
||||||
|
void *val;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(68),"b"(26),"c"(base),"d"(offset),"S"(size));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
extern inline
|
||||||
|
void exit(int status) __attribute__((noreturn)) ;
|
||||||
|
|
||||||
|
extern inline
|
||||||
|
void exit(int status)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
::"a"(-1));
|
||||||
|
for(;;);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline
|
||||||
|
uint32_t load_cursor(void *path, uint32_t flags)
|
||||||
|
{
|
||||||
|
uint32_t val;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(37), "b"(4), "c"(path), "d"(flags));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
uint32_t set_cursor(uint32_t cursor)
|
||||||
|
{
|
||||||
|
uint32_t old;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(old)
|
||||||
|
:"a"(37), "b"(5), "c"(cursor));
|
||||||
|
return old;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int destroy_cursor(uint32_t cursor)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(ret)
|
||||||
|
:"a"(37), "b"(6), "c"(cursor)
|
||||||
|
:"memory");
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static inline void get_proc_info(char *info)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:
|
||||||
|
:"a"(9), "b"(info), "c"(-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void* user_realloc(void *mem, size_t size)
|
||||||
|
{
|
||||||
|
void *val;
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(val)
|
||||||
|
:"a"(68),"b"(12),"c"(size),"d"(mem)
|
||||||
|
:"memory");
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *load_file(const char *path, size_t *len);
|
||||||
|
|
||||||
|
void *get_resource(void *data, uint32_t id);
|
||||||
|
|
||||||
|
struct blit_call
|
||||||
|
{
|
||||||
|
int dstx;
|
||||||
|
int dsty;
|
||||||
|
int w;
|
||||||
|
int h;
|
||||||
|
|
||||||
|
int srcx;
|
||||||
|
int srcy;
|
||||||
|
int srcw;
|
||||||
|
int srch;
|
||||||
|
|
||||||
|
unsigned char *bitmap;
|
||||||
|
int stride;
|
||||||
|
};
|
||||||
|
|
||||||
|
void Blit(void *bitmap, int dst_x, int dst_y,
|
||||||
|
int src_x, int src_y, int w, int h,
|
||||||
|
int src_w, int src_h, int stride);
|
||||||
|
|
@ -63,15 +63,20 @@ window_t *create_window(char *caption, int style, int x, int y,
|
|||||||
list_initialize(&Window.link);
|
list_initialize(&Window.link);
|
||||||
list_initialize(&Window.child);
|
list_initialize(&Window.child);
|
||||||
|
|
||||||
ctx->pixmap = user_alloc(1280*1024*4);
|
|
||||||
if(!ctx->pixmap)
|
|
||||||
{
|
|
||||||
printf("not enough memory for context bitmap\n");
|
|
||||||
return NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
stride = w*4;
|
Window.bitmap.width = 1920;
|
||||||
ctx->stride = stride;
|
Window.bitmap.height = 1080;
|
||||||
|
Window.bitmap.flags = 0;
|
||||||
|
|
||||||
|
if( create_bitmap(&Window.bitmap) )
|
||||||
|
{
|
||||||
|
printf("not enough memory for window bitmap\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->pixmap = &Window.bitmap;
|
||||||
|
ctx->offset_x = 0;
|
||||||
|
ctx->offset_y = 0;
|
||||||
|
|
||||||
Window.rc.l = x;
|
Window.rc.l = x;
|
||||||
Window.rc.t = y;
|
Window.rc.t = y;
|
||||||
@ -179,8 +184,8 @@ void blit_client(window_t *win)
|
|||||||
w = win->client.r - win->client.l;
|
w = win->client.r - win->client.l;
|
||||||
h = win->client.b - win->client.t;
|
h = win->client.b - win->client.t;
|
||||||
|
|
||||||
Blit(win->ctx->pixmap, win->client.l, win->client.t,
|
Blit(win->ctx->pixmap->data, win->client.l, win->client.t,
|
||||||
0, 0, w, h, w, h,win->ctx->stride);
|
0, 0, w, h, w, h,win->ctx->pixmap->pitch);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -250,21 +255,22 @@ void window_update_layout(window_t *win)
|
|||||||
|
|
||||||
int old_size;
|
int old_size;
|
||||||
int new_size;
|
int new_size;
|
||||||
int stride;
|
int pitch;
|
||||||
|
|
||||||
old_size = win->ctx->stride * win->h;
|
|
||||||
|
old_size = win->bitmap.pitch * win->bitmap.height;
|
||||||
old_size = (old_size+4095) & ~4095;
|
old_size = (old_size+4095) & ~4095;
|
||||||
|
|
||||||
new_size = winw*winh*4;
|
pitch = ALIGN(win->w*4, 16);
|
||||||
|
|
||||||
|
new_size = pitch * win->h;
|
||||||
new_size = (new_size+4095) & ~4095;
|
new_size = (new_size+4095) & ~4095;
|
||||||
|
|
||||||
stride = winw*4;
|
|
||||||
|
|
||||||
// printf("update win size %d %d\n", winw, winh);
|
|
||||||
|
|
||||||
if( new_size < old_size)
|
if( new_size < old_size)
|
||||||
user_unmap(win->ctx->pixmap, new_size, old_size-new_size);
|
user_unmap(win->bitmap.data, new_size, old_size-new_size);
|
||||||
win->ctx->stride = stride;
|
|
||||||
|
win->bitmap.width = win->w;
|
||||||
|
win->bitmap.pitch = pitch;
|
||||||
|
|
||||||
win->rc.r = winx + winw;
|
win->rc.r = winx + winw;
|
||||||
win->rc.b = winy + winh;
|
win->rc.b = winy + winh;
|
||||||
@ -563,8 +569,8 @@ void update_rect(ctrl_t *ctrl)
|
|||||||
ctx_w = ctrl->parent->w;
|
ctx_w = ctrl->parent->w;
|
||||||
ctx_h = ctrl->parent->h;
|
ctx_h = ctrl->parent->h;
|
||||||
|
|
||||||
Blit(ctrl->ctx->pixmap, ctrl->rc.l, ctrl->rc.t, src_x, src_y,
|
Blit(ctrl->ctx->pixmap->data, ctrl->rc.l, ctrl->rc.t, src_x, src_y,
|
||||||
ctrl->w, ctrl->h, ctx_w, ctx_h, ctrl->ctx->stride);
|
ctrl->w, ctrl->h, ctx_w, ctx_h, ctrl->ctx->pixmap->pitch);
|
||||||
|
|
||||||
// need_update++;
|
// need_update++;
|
||||||
};
|
};
|
||||||
|
@ -34,6 +34,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
ctrl_t ctrl;
|
ctrl_t ctrl;
|
||||||
ctx_t ctx;
|
ctx_t ctx;
|
||||||
|
bitmap_t bitmap;
|
||||||
char *text;
|
char *text;
|
||||||
ctrl_t *child_over;
|
ctrl_t *child_over;
|
||||||
button_t *close_btn;
|
button_t *close_btn;
|
||||||
@ -45,6 +46,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
ctrl_t ctrl;
|
ctrl_t ctrl;
|
||||||
ctx_t ctx;
|
ctx_t ctx;
|
||||||
|
bitmap_t bitmap;
|
||||||
rect_t draw;
|
rect_t draw;
|
||||||
ctrl_t *child_over;
|
ctrl_t *child_over;
|
||||||
int layout;
|
int layout;
|
||||||
@ -74,6 +76,7 @@ typedef struct
|
|||||||
rect_t client;
|
rect_t client;
|
||||||
|
|
||||||
ctx_t client_ctx;
|
ctx_t client_ctx;
|
||||||
|
bitmap_t bitmap;
|
||||||
|
|
||||||
char *caption_txt;
|
char *caption_txt;
|
||||||
ctrl_t *child_over;
|
ctrl_t *child_over;
|
||||||
@ -123,6 +126,9 @@ level_t *create_level(char *caption, int id, int x, int y,
|
|||||||
int w, int h, ctrl_t *parent);
|
int w, int h, ctrl_t *parent);
|
||||||
scroller_t *create_scroller(uint32_t style, int id, int x, int y,
|
scroller_t *create_scroller(uint32_t style, int id, int x, int y,
|
||||||
int w, int h, ctrl_t *parent);
|
int w, int h, ctrl_t *parent);
|
||||||
|
slider_t *create_slider(char *caption, int id, int x, int y,
|
||||||
|
int w, int h, ctrl_t *parent);
|
||||||
|
|
||||||
|
|
||||||
//static uint32_t update_timers(uint32_t realtime);
|
//static uint32_t update_timers(uint32_t realtime);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user