Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5371 → Rev 5372

/contrib/media/fplay/winlib/button.c
20,7 → 20,6
ctrl_t *create_control(size_t size, int id, int x, int y,
int w, int h, ctrl_t *parent)
{
 
ctrl_t *ctrl;
 
if( !parent )
126,8 → 125,6
 
ctx = btn->ctrl.ctx;
 
lock_bitmap(ctx->pixmap);
x = btn->ctrl.rc.l - ctx->offset_x;
y = btn->ctrl.rc.t - ctx->offset_y;
 
259,8 → 256,6
 
ctx = prg->ctrl.ctx;
lock_bitmap(ctx->pixmap);
 
x = prg->ctrl.rc.l - ctx->offset_x;
y = prg->ctrl.rc.t - ctx->offset_y;
 
268,8 → 263,8
{
src = res_progress_bar;
 
pixmap = (int*)ctx->pixmap->data;
pixmap+= y * ctx->pixmap->pitch/4 + x;
pixmap = (int*)ctx->pixmap_data;
pixmap+= y * ctx->pixmap_pitch/4 + x;
 
for(i=0; i < 10; i++)
{
276,24 → 271,23
for(j = 0; j < len; j++)
pixmap[j] = *src;
 
pixmap+= ctx->pixmap->pitch/4;
pixmap+= ctx->pixmap_pitch/4;
src++;
};
};
 
 
len = prg->current*prg->ctrl.w/(prg->max - prg->min);
 
src = res_prg_level;
 
pixmap = (int*)ctx->pixmap->data;
pixmap+= y*ctx->pixmap->pitch/4 + x;
pixmap = (int*)ctx->pixmap_data;
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->pixmap->pitch/4;
pixmap+= ctx->pixmap_pitch/4;
src++;
};
 
363,8 → 357,6
 
ctx = lvl->ctrl.ctx;
 
lock_bitmap(ctx->pixmap);
x = lvl->ctrl.rc.l - ctx->offset_x;
y = lvl->ctrl.rc.t - ctx->offset_y;
 
377,15 → 369,15
if(len > 96)
len = 96;
 
pixmap = (int*)ctx->pixmap->data;
pixmap = (int*)ctx->pixmap_data;
 
pixmap+= y*ctx->pixmap->pitch/4 + x;
pixmap+= y*ctx->pixmap_pitch/4 + x;
 
for(i=0; i < 10; i++)
{
for(j = 0; j < 96; j++)
pixmap[j] = 0xFF1C1C1C;
pixmap+= ctx->pixmap->pitch/4;
pixmap+= ctx->pixmap_pitch/4;
};
 
blit_raw(ctx, lvl->img_level, x, y, len, 10, 96*4);
397,7 → 389,6
int lvl_proc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
{
level_t *lvl = (level_t*)ctrl;
// int pos;
 
switch( msg )
{
454,25 → 445,22
 
ctx = sld->ctrl.ctx;
 
lock_bitmap(ctx->pixmap);
x = sld->ctrl.rc.l - ctx->offset_x;
y = sld->ctrl.rc.t - ctx->offset_y;
 
len = 96 + 12;
 
pixmap = (int*)ctx->pixmap->data;
pixmap+= y*ctx->pixmap->pitch/4 + x;
pixmap = (int*)ctx->pixmap_data;
pixmap+= y*ctx->pixmap_pitch/4 + x;
 
for(i=0; i < 11; i++)
{
for(j = 0; j < len; j++)
pixmap[j] = 0xFF1C1C1C;
pixmap+= ctx->pixmap->pitch/4;
pixmap+= ctx->pixmap_pitch/4;
};
 
blit_raw(ctx, sld->img_vol_slider, x+6, y+4, 96, 4, 96*4);
 
blit_raw(ctx, res_slider, x+sld->pos, y, 12, 11, 12*4);
 
return 0;
/contrib/media/fplay/winlib/caption.c
44,19 → 44,8
 
cpt->text = win->caption_txt;
 
cpt->bitmap.width = 1920;
cpt->bitmap.height = CAPTION_HEIGHT;
cpt->bitmap.flags = 0;
 
if( create_bitmap(&cpt->bitmap) )
{
printf("not enough memory for caption bitmap\n");
return 0;
}
 
 
// printf("win_w %d win_h %d\n", win->w, win->h);
ctx->pixmap = &cpt->bitmap;
ctx->pixmap_data = user_alloc(1920*CAPTION_HEIGHT*4);
ctx->pixmap_pitch= 1920*4;
ctx->offset_x = 0;
ctx->offset_y = 0;
 
92,10 → 81,9
void update_caption_size(window_t *win)
{
caption_t *cpt = &win->caption;
bitmap_t *bitmap = &cpt->bitmap;
ctx_t *ctx = &cpt->ctx;
 
bitmap->width = win->w;
resize_bitmap(bitmap);
ctx->pixmap_pitch = win->w * 4;
 
cpt->ctrl.rc.l = 0;
cpt->ctrl.rc.t = 0;
116,27 → 104,24
cpt->full_btn->ctrl.rc.l = win->w - 27 - 18 -18 - 5 - 5;
cpt->full_btn->ctrl.rc.r = cpt->full_btn->ctrl.rc.l +
cpt->full_btn->ctrl.w;
 
};
 
 
extern int win_font;
 
void draw_caption(caption_t *cpt)
{
ctx_t *ctx = &cpt->ctx;
int *pixmap, *src;
rect_t rc;
int i, j, w;
 
lock_bitmap(&cpt->bitmap);
 
blit_raw(&cpt->ctx, res_caption_left, 0, 0,
blit_raw(ctx, res_caption_left, 0, 0,
CAPTION_CORNER_W, CAPTION_HEIGHT, CAPTION_CORNER_W*4);
 
w = cpt->ctrl.w - (2*CAPTION_CORNER_W);
if( w > 0)
{
pixmap = (int*)cpt->ctx.pixmap->data;
pixmap = (int*)ctx->pixmap_data;
pixmap+= CAPTION_CORNER_W;
src = res_caption_body;
 
144,16 → 129,11
{
for(j = 0; j < w; j++)
pixmap[j] = src[i];
pixmap+= cpt->ctx.pixmap->pitch/4;
pixmap+= ctx->pixmap_pitch/4;
}
 
// blit_raw(&cpt->ctx,res_caption_body, CAPTION_CORNER_W, 0,
// w, CAPTION_HEIGHT, 0);
 
};
 
 
blit_raw(&cpt->ctx,res_caption_right, cpt->ctrl.w - CAPTION_CORNER_W, 0,
blit_raw(ctx,res_caption_right, cpt->ctrl.w - CAPTION_CORNER_W, 0,
CAPTION_CORNER_W, CAPTION_HEIGHT,CAPTION_CORNER_W*4);
 
rc.l = 8;
161,7 → 141,7
rc.r = cpt->ctrl.w - 27 - 18 - 18 - 5 - 5 - 8;
rc.b = 18;
 
draw_text_ext(cpt->ctx.pixmap, win_font, cpt->text, &rc, 0xFFFFFFFF);
draw_text_ext(ctx->pixmap_data, ctx->pixmap_pitch, win_font, cpt->text, &rc, 0xFFFFFFFF);
 
ctrl_t *child;
child = (ctrl_t*)cpt->ctrl.child.next;
264,9 → 244,8
// printf("%s w:%d h:%d stride: %d\n",__FUNCTION__,
// cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.stride);
 
lock_bitmap(&cpt->bitmap);
 
Blit(cpt->ctx.pixmap->data, 0, 0, 0, 0, cpt->ctrl.w, cpt->ctrl.h,
cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.pixmap->pitch);
Blit(cpt->ctx.pixmap_data, 0, 0, 0, 0, cpt->ctrl.w, cpt->ctrl.h,
cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.pixmap_pitch);
};
 
/contrib/media/fplay/winlib/control.h
1,7 → 1,7
#ifndef __CONTROL_H__
#define __CONTROL_H_
 
#include <pixlib2.h>
#include <pixlib3.h>
#include "link.h"
 
typedef struct
14,9 → 14,10
 
typedef struct ctx
{
bitmap_t *pixmap;
int offset_x;
int offset_y;
int *pixmap_data;
int pixmap_pitch;
}ctx_t;
 
ctx_t *get_window_ctx();
/contrib/media/fplay/winlib/fontlib.c
23,7 → 23,7
 
unsigned int ansi2utf32(unsigned char ch);
 
void my_draw_bitmap(bitmap_t *win, FT_Bitmap *bitmap, int dstx, int dsty, int col)
static void my_draw_bitmap(uint8_t *pixmap, uint32_t pitch, FT_Bitmap *bitmap, int dstx, int dsty, int col)
{
uint8_t *dst;
uint8_t *src, *tmpsrc;
31,7 → 31,7
uint32_t *tmpdst;
int i, j;
 
dst = win->data + dsty * win->pitch + dstx*4;
dst = pixmap + dsty * pitch + dstx*4;
src = bitmap->buffer;
 
for( i = 0; i < bitmap->rows; i++ )
39,7 → 39,7
tmpdst = (uint32_t*)dst;
tmpsrc = src;
 
dst+= win->pitch;
dst+= pitch;
src+= bitmap->pitch;
 
for( j = 0; j < bitmap->width; j++)
68,7 → 68,7
};
 
 
int draw_text_ext(bitmap_t *winbitmap, FT_Face face, char *text, rect_t *rc, int color)
int draw_text_ext(void *pixmap, uint32_t pitch, FT_Face face, char *text, rect_t *rc, int color)
{
FT_UInt glyph_index;
FT_Bool use_kerning = 0;
107,7 → 107,7
if ( err )
continue;
 
my_draw_bitmap(winbitmap, &face->glyph->bitmap, (x >> 6) + face->glyph->bitmap_left,
my_draw_bitmap(pixmap, pitch, &face->glyph->bitmap, (x >> 6) + face->glyph->bitmap_left,
y - face->glyph->bitmap_top, color);
 
x += face->glyph->advance.x;
/contrib/media/fplay/winlib/frame.c
67,8 → 67,12
extern int res_border_left[];
extern int res_border_right[];
 
#if 0
int draw_frame(window_t *win)
{
void *pixmap_data;
uint32_t pixmap_pitch;
 
int *pixmap, *src;
int i, j;
 
124,7 → 128,9
 
return 0;
};
#endif
 
 
int frame_proc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
{
static pos_t spos;
/contrib/media/fplay/winlib/panel.c
53,17 → 53,7
 
panel->layout = 0;
panel->bitmap.width = 1920;
panel->bitmap.height = PANEL_HEIGHT;
panel->bitmap.flags = 0;
 
if( create_bitmap(&panel->bitmap) )
{
printf("not enough memory for panel bitmap\n");
return 0;
}
 
ctx->pixmap = &panel->bitmap;
ctx->pixmap_data = user_alloc(1920*PANEL_HEIGHT*4);
ctx->offset_x = 0;
ctx->offset_y = 0;
 
100,8 → 90,6
// btn->img_hilite = res_minimize_btn_hl;
// btn->img_pressed = res_minimize_btn_pressed;
 
 
 
update_panel_size(win);
 
return 1;
157,10 → 145,8
void update_panel_size(window_t *win)
{
panel_t *panel = &win->panel;
bitmap_t *bitmap = &panel->bitmap;
 
bitmap->width = win->w;
resize_bitmap(bitmap);
panel->ctx.pixmap_pitch = win->w*4;
panel->ctx.offset_x = 0;
panel->ctx.offset_y = win->h-PANEL_HEIGHT;
200,19 → 186,17
 
void draw_panel(panel_t *panel)
{
ctx_t *ctx = &panel->ctx;
int *pixmap, *src;
int i, j, w;
 
lock_bitmap(&panel->bitmap);
blit_raw(&panel->ctx, res_panel_left, 0, 0,
blit_raw(ctx, res_panel_left, 0, 0,
PANEL_CORNER_W, PANEL_HEIGHT, PANEL_CORNER_W*4);
 
 
w = panel->ctrl.w - (2*PANEL_CORNER_W);
if( w > 0)
{
pixmap = (int*)panel->ctx.pixmap->data;
pixmap = (int*)ctx->pixmap_data;
pixmap+= PANEL_CORNER_W;
src = res_panel_body;
 
220,7 → 204,7
{
for(j = 0; j < w; j++)
pixmap[j] = src[i];
pixmap+= panel->ctx.pixmap->pitch/4;
pixmap+= ctx->pixmap_pitch/4;
}
};
 
302,13 → 286,10
 
void blit_panel(panel_t *panel)
{
// printf("%s w:%d h:%d stride: %d\n",__FUNCTION__,
// cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.stride);
ctx_t *ctx = &panel->ctx;
 
lock_bitmap(&panel->bitmap);
 
Blit(panel->ctx.pixmap->data, panel->draw.l, panel->draw.t,
Blit(ctx->pixmap_data, panel->draw.l, panel->draw.t,
0, 0, panel->ctrl.w, panel->ctrl.h,
panel->ctrl.w, panel->ctrl.h, panel->ctx.pixmap->pitch);
panel->ctrl.w, panel->ctrl.h, ctx->pixmap_pitch);
};
 
/contrib/media/fplay/winlib/window.c
79,7 → 79,7
if(handler==0) return 0;
 
BeginDraw();
DrawWindow(x, y, w-1, h-1,
DrawWindow(x, y, w, h,
NULL,0,0x41);
EndDraw();
 
213,13 → 213,14
 
void blit_client(window_t *win)
{
ctx_t *ctx = &win->ctx;
int w, h;
 
w = win->client.r - win->client.l;
h = win->client.b - win->client.t;
 
Blit(win->ctx->pixmap->data, win->client.l, win->client.t,
0, 0, w, h, w, h,win->ctx->pixmap->pitch);
Blit(ctx->pixmap_data, win->client.l, win->client.t,
0, 0, w, h, w, h, ctx->pixmap_pitch);
};
 
 
366,7 → 367,6
 
BeginDraw();
DrawWindow(0,0,0,0, NULL, 0x000000,0x41);
// DefineButton(15, 15, 0x00000001, 0);
EndDraw();
 
send_message((ctrl_t*)win, MSG_DRAW_CLIENT, 0, 0);
628,6 → 628,8
 
void update_rect(ctrl_t *ctrl)
{
ctx_t *ctx = ctrl->ctx;
 
int ctx_w, ctx_h;
int src_x, src_y;
 
637,36 → 639,12
ctx_w = ctrl->parent->w;
ctx_h = ctrl->parent->h;
 
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->pixmap->pitch);
Blit(ctx->pixmap_data, ctrl->rc.l, ctrl->rc.t, src_x, src_y,
ctrl->w, ctrl->h, ctx_w, ctx_h, ctx->pixmap_pitch);
 
// need_update++;
};
 
 
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)
{
volatile struct blit_call bc;
 
bc.dstx = dst_x;
bc.dsty = dst_y;
bc.w = w;
bc.h = h;
bc.srcx = src_x;
bc.srcy = src_y;
bc.srcw = src_w;
bc.srch = src_h;
bc.stride = stride;
bc.bitmap = bitmap;
 
__asm__ __volatile__(
"int $0x40"
::"a"(73),"b"(0x20),"c"(&bc.dstx));
 
};
 
ctrl_t *get_child(ctrl_t *ctrl, int x, int y)
{
ctrl_t *child = NULL;
/contrib/media/fplay/winlib/winlib.h
36,7 → 36,6
{
ctrl_t ctrl;
ctx_t ctx;
bitmap_t bitmap;
char *text;
ctrl_t *child_over;
 
50,7 → 49,6
{
ctrl_t ctrl;
ctx_t ctx;
bitmap_t bitmap;
rect_t draw;
ctrl_t *child_over;
int layout;
73,7 → 71,7
handler_t *handler;
ctrl_t *parent;
 
ctx_t *ctx;
ctx_t ctx;
uint32_t id;
uint32_t style;
 
84,10 → 82,6
rect_t saved;
rect_t client;
 
// ctx_t client_ctx;
// bitmap_t bitmap;
bitmap_t bitmap;
 
char *caption_txt;
ctrl_t *child_over;
ctrl_t *child_focus;