Subversion Repositories Kolibri OS

Rev

Rev 3068 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3068 Rev 3248
Line 1... Line 1...
1
#include "system.h"
1
#include "system.h"
2
#include 
2
#include 
3
#include 
3
#include 
4
#include 
4
#include 
-
 
5
#include 
5
#include "winlib.h"
6
#include "winlib.h"
Line 6... Line 7...
6
 
7
 
7
extern int res_level[];
8
extern int res_level[];
8
extern int res_slider[];
9
extern int res_slider[];
Line 118... Line 119...
118
#endif
119
#endif
119
 
120
 
Line 120... Line 121...
120
int draw_button_cairo(button_t *btn)
121
int draw_button_cairo(button_t *btn)
121
{
122
{
122
    int *pixmap, *src;
123
    int *src;
123
    ctx_t *ctx;
124
    ctx_t *ctx;
124
    int i, j;
-
 
125
    int x, y;
125
    int x, y;
Line 126... Line 126...
126
 
126
 
Line 127... Line 127...
127
    ctx = btn->ctrl.ctx;
127
    ctx = btn->ctrl.ctx;
128
 
128
 
Line 129... Line -...
129
    x = btn->ctrl.rc.l - ctx->offset_x;
-
 
130
    y = btn->ctrl.rc.t - ctx->offset_y;
-
 
131
 
-
 
132
    pixmap = ctx->pixmap;
-
 
133
 
129
    x = btn->ctrl.rc.l - ctx->offset_x;
Line 134... Line 130...
134
    pixmap+=  y*ctx->stride/4 + x;
130
    y = btn->ctrl.rc.t - ctx->offset_y;
135
 
131
 
136
    src = btn->img_default;
132
    src = btn->img_default;
137
 
133
 
Line 138... Line -...
138
    if(btn->state & bPressed)
-
 
139
        src = btn->img_pressed;
-
 
140
    else if(btn->state & bHighlight)
134
    if(btn->state & bPressed)
141
        src = btn->img_hilite;
-
 
142
 
-
 
143
    for(i=0; i < btn->ctrl.h ;i++)
-
 
144
    {
-
 
Line 145... Line 135...
145
        for(j = 0; j < btn->ctrl.w; j++)
135
        src = btn->img_pressed;
146
            pixmap[j] = src[j];
136
    else if(btn->state & bHighlight)
Line 260... Line 250...
260
    int *pixmap, *src;
250
    int *pixmap, *src;
261
    ctx_t *ctx;
251
    ctx_t *ctx;
262
    int i, j;
252
    int i, j;
263
    int x, y;
253
    int x, y;
264
 
254
    rect_t rc = prg->ctrl.rc;
-
 
255
 
Line 265... Line 256...
265
    int len = prg->ctrl.w;
256
    int len = prg->ctrl.w;
Line 266... Line 257...
266
 
257
 
Line 272... Line 263...
272
    if( background )
263
    if( background )
273
    {
264
    {
274
        src = res_progress_bar;
265
        src = res_progress_bar;
Line 275... Line 266...
275
 
266
 
276
        pixmap = ctx->pixmap;
267
        pixmap = (int*)ctx->pixmap->data;
Line 277... Line 268...
277
        pixmap+= y * ctx->stride/4 + x;
268
        pixmap+= y * ctx->pixmap->pitch/4 + x;
278
 
269
 
279
        for(i=0; i < 10; i++)
270
        for(i=0; i < 10; i++)
280
        {
271
        {
Line 281... Line 272...
281
            for(j = 0; j < len; j++)
272
            for(j = 0; j < len; j++)
282
                pixmap[j] = *src;
273
                pixmap[j] = *src;
283
 
274
 
284
            pixmap+= ctx->stride/4;
275
            pixmap+= ctx->pixmap->pitch/4;
Line 285... Line 276...
285
            src++;
276
            src++;
Line 286... Line 277...
286
        };
277
        };
Line 287... Line 278...
287
    };
278
    };
288
 
279
 
Line 289... Line 280...
289
 
280
 
290
    len = prg->current*prg->ctrl.w/(prg->max - prg->min);
281
    len = prg->current*prg->ctrl.w/(prg->max - prg->min);
291
 
282
 
292
    src = res_prg_level;
283
    src = res_prg_level;
293
 
284
 
294
    pixmap = ctx->pixmap;
285
    pixmap = (int*)ctx->pixmap->data;
295
    pixmap+= y*ctx->stride/4 + x;
286
    pixmap+= y*ctx->pixmap->pitch/4 + x;
Line 296... Line 287...
296
 
287
 
297
    for(i=0; i < prg->ctrl.h ;i++)
288
    for(i=0; i < prg->ctrl.h ;i++)
Line 357... Line 348...
357
};
348
};
358
 
349
 
Line 359... Line 350...
359
int draw_level(level_t *lvl)
350
int draw_level(level_t *lvl)
360
{
351
{
361
    int *pixmap, *src;
352
    int *pixmap;
362
    ctx_t *ctx;
353
    ctx_t *ctx;
363
    int i, j;
354
    int i, j;
364
    int x, y;
355
    int x, y;
Line 365... Line 356...
365
 
356
 
Line 379... Line 370...
379
        len = 0;
370
        len = 0;
380
    if(len > 96)
371
    if(len > 96)
381
        len = 96;
372
        len = 96;
382
 
373
 
Line 383... Line 374...
383
    pixmap = ctx->pixmap;
374
    pixmap = (int*)ctx->pixmap->data;
Line 384... Line 375...
384
 
375
 
385
    pixmap+=  y*ctx->stride/4 + x;
-
 
386
 
-
 
387
//    for(i=0; i < prg->ctrl.h ;i++)
-
 
388
//    {
-
 
389
//        for(j=0; j < len; j++)
-
 
390
//            pixmap[j] = src;
-
 
391
//        pixmap+= ctx->stride/4;
-
 
392
//    };
-
 
393
 
-
 
Line 394... Line 376...
394
    src = lvl->img_level;
376
    pixmap+=  y*ctx->pixmap->pitch/4 + x;
395
 
377
 
396
    for(i=0; i < 10; i++)
378
    for(i=0; i < 10; i++)
397
    {
379
    {
398
        for(j = 0; j < 96; j++)
380
        for(j = 0; j < 96; j++)
399
           pixmap[j] = 0xFF1C1C1C;
381
           pixmap[j] = 0xFF1C1C1C;
Line 400... Line -...
400
           pixmap+= ctx->stride/4;
-
 
401
    };
-
 
402
 
-
 
403
    pixmap = ctx->pixmap;
-
 
404
    pixmap+= y*ctx->stride/4 + x;
-
 
405
 
382
           pixmap+= ctx->pixmap->pitch/4;
406
    for(i=0; i < 10; i++)
-
 
407
    {
-
 
408
        for(j = 0; j < len; j++)
-
 
409
            pixmap[j] = src[j];
-
 
Line 410... Line 383...
410
        pixmap+= ctx->stride/4;
383
    };
411
        src+= 96;
384
 
Line 464... Line 437...
464
 
437
 
Line 465... Line 438...
465
 
438
 
466
int draw_slider(slider_t *sld)
439
int draw_slider(slider_t *sld)
467
{
440
{
468
    int *pixmap, *src;
441
    int *pixmap;
469
    ctx_t *ctx;
442
    ctx_t *ctx;
470
    int i, j;
443
    int i, j;
Line 471... Line 444...
471
    int x, y;
444
    int x, y;
Line 477... Line 450...
477
 
450
 
Line 478... Line 451...
478
    x = sld->ctrl.rc.l - ctx->offset_x;
451
    x = sld->ctrl.rc.l - ctx->offset_x;
479
    y = sld->ctrl.rc.t - ctx->offset_y;
452
    y = sld->ctrl.rc.t - ctx->offset_y;
Line 480... Line -...
480
 
-
 
481
 
453
 
Line 482... Line 454...
482
    len = 96 + 12;
454
    len = 96 + 12;
483
 
455
 
Line 484... Line 456...
484
    pixmap = ctx->pixmap;
456
    pixmap = (int*)ctx->pixmap->data;
485
    pixmap+=  y*ctx->stride/4 + x;
457
    pixmap+=  y*ctx->pixmap->pitch/4 + x;
486
 
458
 
487
    for(i=0; i < 11; i++)
459
    for(i=0; i < 11; i++)
488
    {
460
    {
489
        for(j = 0; j < len; j++)
461
        for(j = 0; j < len; j++)
Line 490... Line -...
490
           pixmap[j] = 0xFF1C1C1C;
-
 
491
           pixmap+= ctx->stride/4;
-
 
492
    };
-
 
493
 
462
           pixmap[j] = 0xFF1C1C1C;
Line 494... Line -...
494
    pixmap = ctx->pixmap;
-
 
495
    pixmap+=  (y+4)*ctx->stride/4 + x + 6;
-
 
496
 
-
 
497
    src = sld->img_vol_slider;
-
 
498
 
-
 
499
    for(i = 0; i < 4; i++)
-
 
500
    {
-
 
501
        for(j = 0; j < 96; j++)
-
 
502
            pixmap[j] = src[j];
-
 
503
        pixmap+= ctx->stride/4;
463
           pixmap+= ctx->pixmap->pitch/4;
504
        src+= 96;
-
 
505
    };
-
 
506
 
-
 
507
    pixmap = ctx->pixmap;
-
 
508
    pixmap+=  y*ctx->stride/4 + x + sld->pos;
-
 
509
 
-
 
510
    src = res_slider;
-
 
511
 
-
 
512
    for(i = 0; i < 11; i++)
-
 
513
    {
-
 
Line 514... Line 464...
514
        for(j = 0; j < 12; j++)
464
    };
515
            pixmap[j] = src[j];
465