Rev 4438 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4438 | Rev 5372 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | cpt->ctrl.parent = (ctrl_t*)win; |
42 | cpt->ctrl.parent = (ctrl_t*)win; |
43 | 43 | ||
Line 44... | Line 44... | ||
44 | cpt->text = win->caption_txt; |
44 | cpt->text = win->caption_txt; |
Line 45... | Line -... | ||
45 | - | ||
46 | cpt->bitmap.width = 1920; |
45 | |
47 | cpt->bitmap.height = CAPTION_HEIGHT; |
- | |
48 | cpt->bitmap.flags = 0; |
- | |
49 | - | ||
50 | if( create_bitmap(&cpt->bitmap) ) |
- | |
51 | { |
- | |
52 | printf("not enough memory for caption bitmap\n"); |
- | |
53 | return 0; |
- | |
54 | } |
- | |
55 | - | ||
56 | - | ||
57 | // printf("win_w %d win_h %d\n", win->w, win->h); |
46 | ctx->pixmap_data = user_alloc(1920*CAPTION_HEIGHT*4); |
58 | ctx->pixmap = &cpt->bitmap; |
47 | ctx->pixmap_pitch= 1920*4; |
59 | ctx->offset_x = 0; |
48 | ctx->offset_x = 0; |
Line 60... | Line 49... | ||
60 | ctx->offset_y = 0; |
49 | ctx->offset_y = 0; |
Line 90... | Line 79... | ||
90 | 79 | ||
91 | void update_caption_size(window_t *win) |
80 | void update_caption_size(window_t *win) |
92 | { |
81 | { |
93 | caption_t *cpt = &win->caption; |
82 | caption_t *cpt = &win->caption; |
Line 94... | Line 83... | ||
94 | bitmap_t *bitmap = &cpt->bitmap; |
83 | ctx_t *ctx = &cpt->ctx; |
95 | - | ||
Line 96... | Line 84... | ||
96 | bitmap->width = win->w; |
84 | |
97 | resize_bitmap(bitmap); |
85 | ctx->pixmap_pitch = win->w * 4; |
98 | 86 | ||
99 | cpt->ctrl.rc.l = 0; |
87 | cpt->ctrl.rc.l = 0; |
Line 114... | Line 102... | ||
114 | 102 | ||
Line 115... | Line 103... | ||
115 | cpt->full_btn->ctrl.rc.l = win->w - 27 - 18 -18 - 5 - 5; |
103 | cpt->full_btn->ctrl.rc.l = win->w - 27 - 18 -18 - 5 - 5; |
116 | cpt->full_btn->ctrl.rc.r = cpt->full_btn->ctrl.rc.l + |
104 | cpt->full_btn->ctrl.rc.r = cpt->full_btn->ctrl.rc.l + |
117 | cpt->full_btn->ctrl.w; |
105 | cpt->full_btn->ctrl.w; |
118 | - | ||
119 | }; |
106 | }; |
Line 120... | Line -... | ||
120 | - | ||
121 | 107 | ||
Line 122... | Line 108... | ||
122 | extern int win_font; |
108 | extern int win_font; |
123 | 109 | ||
- | 110 | void draw_caption(caption_t *cpt) |
|
124 | void draw_caption(caption_t *cpt) |
111 | { |
125 | { |
112 | ctx_t *ctx = &cpt->ctx; |
126 | int *pixmap, *src; |
113 | int *pixmap, *src; |
Line 127... | Line -... | ||
127 | rect_t rc; |
- | |
128 | int i, j, w; |
- | |
129 | 114 | rect_t rc; |
|
130 | lock_bitmap(&cpt->bitmap); |
115 | int i, j, w; |
Line 131... | Line 116... | ||
131 | 116 | ||
132 | blit_raw(&cpt->ctx, res_caption_left, 0, 0, |
117 | blit_raw(ctx, res_caption_left, 0, 0, |
133 | CAPTION_CORNER_W, CAPTION_HEIGHT, CAPTION_CORNER_W*4); |
118 | CAPTION_CORNER_W, CAPTION_HEIGHT, CAPTION_CORNER_W*4); |
134 | 119 | ||
135 | w = cpt->ctrl.w - (2*CAPTION_CORNER_W); |
120 | w = cpt->ctrl.w - (2*CAPTION_CORNER_W); |
136 | if( w > 0) |
121 | if( w > 0) |
Line 137... | Line 122... | ||
137 | { |
122 | { |
138 | pixmap = (int*)cpt->ctx.pixmap->data; |
123 | pixmap = (int*)ctx->pixmap_data; |
139 | pixmap+= CAPTION_CORNER_W; |
124 | pixmap+= CAPTION_CORNER_W; |
140 | src = res_caption_body; |
125 | src = res_caption_body; |
141 | 126 | ||
142 | for(i = 0; i < CAPTION_HEIGHT; i++) |
127 | for(i = 0; i < CAPTION_HEIGHT; i++) |
143 | { |
- | |
144 | for(j = 0; j < w; j++) |
- | |
145 | pixmap[j] = src[i]; |
- | |
146 | pixmap+= cpt->ctx.pixmap->pitch/4; |
- | |
147 | } |
128 | { |
Line 148... | Line -... | ||
148 | - | ||
149 | // blit_raw(&cpt->ctx,res_caption_body, CAPTION_CORNER_W, 0, |
129 | for(j = 0; j < w; j++) |
150 | // w, CAPTION_HEIGHT, 0); |
130 | pixmap[j] = src[i]; |
Line 151... | Line 131... | ||
151 | 131 | pixmap+= ctx->pixmap_pitch/4; |
|
152 | }; |
132 | } |
153 | 133 | }; |
|
154 | 134 | ||
Line 155... | Line 135... | ||
155 | blit_raw(&cpt->ctx,res_caption_right, cpt->ctrl.w - CAPTION_CORNER_W, 0, |
135 | blit_raw(ctx,res_caption_right, cpt->ctrl.w - CAPTION_CORNER_W, 0, |
Line 156... | Line 136... | ||
156 | CAPTION_CORNER_W, CAPTION_HEIGHT,CAPTION_CORNER_W*4); |
136 | CAPTION_CORNER_W, CAPTION_HEIGHT,CAPTION_CORNER_W*4); |
157 | 137 | ||
Line 158... | Line 138... | ||
158 | rc.l = 8; |
138 | rc.l = 8; |
Line 262... | Line 242... | ||
262 | { |
242 | { |
263 | // printf("%s w:%d h:%d stride: %d\n",__FUNCTION__, |
243 | // printf("%s w:%d h:%d stride: %d\n",__FUNCTION__, |
264 | // cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.stride); |
244 | // cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.stride); |
265 | 245 | ||
Line 266... | Line -... | ||
266 | lock_bitmap(&cpt->bitmap); |
- | |
Line 267... | Line 246... | ||
267 | 246 | ||
268 | Blit(cpt->ctx.pixmap->data, 0, 0, 0, 0, cpt->ctrl.w, cpt->ctrl.h, |
247 | Blit(cpt->ctx.pixmap_data, 0, 0, 0, 0, cpt->ctrl.w, cpt->ctrl.h, |
269 | cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.pixmap->pitch); |
248 | cpt->ctrl.w, cpt->ctrl.h, cpt->ctx.pixmap_pitch); |