Subversion Repositories Kolibri OS

Rev

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

Rev 1106 Rev 1107
Line 54... Line 54...
54
;;
54
;;
55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 56... Line 56...
56
 
56
 
Line 57... Line 57...
57
include 'macros.inc'
57
include 'macros.inc'
Line 58... Line 58...
58
 
58
 
Line 59... Line 59...
59
$Revision: 1106 $
59
$Revision: 1107 $
Line 547... Line 547...
547
        xor  eax,eax
547
        xor  eax,eax
548
        inc  eax
548
        inc  eax
549
        mov   [BgrDrawMode],eax
549
        mov   [BgrDrawMode],eax
550
        mov   [BgrDataWidth],eax
550
        mov   [BgrDataWidth],eax
551
        mov   [BgrDataHeight],eax
551
        mov   [BgrDataHeight],eax
552
        mov    [mem_BACKGROUND],4095
552
        mov    [mem_BACKGROUND], 4
553
        stdcall kernel_alloc, [mem_BACKGROUND]
-
 
554
        mov [img_background], eax
553
        mov [img_background], static_background_data
Line 555... Line 554...
555
 
554
 
Line 556... Line 555...
556
        mov     [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
555
        mov     [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
Line 2278... Line 2277...
2278
    mov   [BgrDataHeight],edx
2277
    mov   [BgrDataHeight],edx
2279
;    mov   [bgrchanged],1
2278
;    mov   [bgrchanged],1
Line 2280... Line 2279...
2280
 
2279
 
2281
    pushad
2280
    pushad
2282
; return memory for old background
2281
; return memory for old background
-
 
2282
        mov     eax, [img_background]
-
 
2283
        cmp     eax, static_background_data
-
 
2284
        jz      @f
-
 
2285
        stdcall kernel_free, eax
2283
    stdcall kernel_free, [img_background]
2286
@@:
2284
; calculate RAW size
2287
; calculate RAW size
2285
    xor  eax,eax
2288
    xor  eax,eax
2286
    inc  eax
2289
    inc  eax
2287
    cmp  [BgrDataWidth],eax
2290
    cmp  [BgrDataWidth],eax
Line 2297... Line 2300...
2297
    lea  eax,[eax*3]
2300
    lea  eax,[eax*3]
2298
    mov  [mem_BACKGROUND],eax
2301
    mov  [mem_BACKGROUND],eax
2299
; get memory for new background
2302
; get memory for new background
2300
    stdcall kernel_alloc, eax
2303
    stdcall kernel_alloc, eax
2301
    test eax, eax
2304
    test eax, eax
2302
    jz .exit_mem
2305
    jz .memfailed
2303
    mov [img_background], eax
2306
    mov [img_background], eax
-
 
2307
    jmp .exit
-
 
2308
.memfailed:
-
 
2309
; revert to static monotone data
-
 
2310
        mov     [img_background], static_background_data
-
 
2311
        xor     eax, eax
-
 
2312
        inc     eax
-
 
2313
        mov     [BgrDataWidth], eax
-
 
2314
        mov     [BgrDataHeight], eax
-
 
2315
        mov     [mem_BACKGROUND], 4
2304
.exit_mem:
2316
.exit:
2305
    popad
2317
    popad
2306
        mov     [bgrlock], 0
2318
        mov     [bgrlock], 0
Line 2307... Line 2319...
2307
 
2319
 
2308
  sbgrr:
2320
  sbgrr:
Line 2311... Line 2323...
2311
nosb1:
2323
nosb1:
Line 2312... Line 2324...
2312
 
2324
 
2313
    cmp   ebx,2                            ; SET PIXEL
2325
    cmp   ebx,2                            ; SET PIXEL
Line -... Line 2326...
-
 
2326
    jnz   nosb2
-
 
2327
 
-
 
2328
    mov   eax, [img_background]
-
 
2329
    test  ecx, ecx
-
 
2330
    jz    @f
-
 
2331
    cmp   eax, static_background_data
2314
    jnz   nosb2
2332
    jz    .ret
2315
 
2333
@@:
2316
    mov ebx, [mem_BACKGROUND]
2334
    mov ebx, [mem_BACKGROUND]
2317
    add ebx, 4095
2335
    add ebx, 4095
2318
    and ebx, -4096
2336
    and ebx, -4096
2319
    sub ebx, 4
2337
    sub ebx, 4
Line 2320... Line -...
2320
    cmp   ecx, ebx
-
 
2321
    ja   @F
2338
    cmp   ecx, ebx
2322
 
2339
    ja   .ret
2323
    mov   eax,[img_background]
2340
 
2324
    mov   ebx,[eax+ecx]
2341
    mov   ebx,[eax+ecx]
2325
    and   ebx,0xFF000000 ;255*256*256*256
2342
    and   ebx,0xFF000000 ;255*256*256*256
2326
    and   edx,0x00FFFFFF ;255*256*256+255*256+255
2343
    and   edx,0x00FFFFFF ;255*256*256+255*256+255
2327
    add   edx,ebx
2344
    add   edx,ebx
2328
    mov   [eax+ecx],edx
2345
    mov   [eax+ecx],edx
Line 2329... Line 2346...
2329
@@:
2346
.ret:
2330
    ret
2347
    ret
Line 2354... Line 2371...
2354
    ret
2371
    ret
2355
  nosb4:
2372
  nosb4:
Line 2356... Line 2373...
2356
 
2373
 
2357
    cmp   ebx,5                            ; BLOCK MOVE TO BGR
2374
    cmp   ebx,5                            ; BLOCK MOVE TO BGR
-
 
2375
    jnz   nosb5
-
 
2376
    cmp   [img_background], static_background_data
-
 
2377
    jnz   @f
-
 
2378
    test  edx, edx
-
 
2379
    jnz   .fin
-
 
2380
    cmp   esi, 4
-
 
2381
    ja    .fin
2358
    jnz   nosb5
2382
  @@:
2359
  ; bughere
2383
  ; bughere
2360
    mov   eax, ecx
2384
    mov   eax, ecx
2361
    mov   ebx, edx
2385
    mov   ebx, edx
2362
    add   ebx, [img_background]   ;IMG_BACKGROUND
2386
    add   ebx, [img_background]   ;IMG_BACKGROUND
Line 2375... Line 2399...
2375
        call    change_task
2399
        call    change_task
2376
        jmp     @b
2400
        jmp     @b
2377
@@:
2401
@@:
2378
        mov     eax, [CURRENT_TASK]
2402
        mov     eax, [CURRENT_TASK]
2379
        mov     [bgrlockpid], eax
2403
        mov     [bgrlockpid], eax
-
 
2404
        cmp     [img_background], static_background_data
-
 
2405
        jz      .nomem
2380
        stdcall user_alloc, [mem_BACKGROUND]
2406
        stdcall user_alloc, [mem_BACKGROUND]
2381
        mov     [esp+32], eax
2407
        mov     [esp+32], eax
2382
        test    eax, eax
2408
        test    eax, eax
2383
        jz      .nomem
2409
        jz      .nomem
2384
        mov     ebx, eax
2410
        mov     ebx, eax
Line 2475... Line 2501...
2475
nogb1:
2501
nogb1:
Line 2476... Line 2502...
2476
 
2502
 
2477
    cmp   eax,2                                  ; PIXEL
2503
    cmp   eax,2                                  ; PIXEL
Line -... Line 2504...
-
 
2504
    jnz   nogb2
-
 
2505
 
-
 
2506
        mov     eax, [img_background]
-
 
2507
        test    ebx, ebx
-
 
2508
        jz      @f
-
 
2509
        cmp     eax, static_background_data
2478
    jnz   nogb2
2510
        jz      .ret
2479
 
2511
@@:
2480
    mov ecx, [mem_BACKGROUND]
2512
    mov ecx, [mem_BACKGROUND]
2481
    add ecx, 4095
2513
    add ecx, 4095
2482
    and ecx, -4096
2514
    and ecx, -4096
2483
    sub ecx, 4
2515
    sub ecx, 4
Line 2484... Line -...
2484
    cmp ebx, ecx
-
 
2485
    ja  @F
2516
    cmp ebx, ecx
Line 2486... Line 2517...
2486
 
2517
    ja  .ret
2487
    mov   eax,[img_background]
2518
 
2488
    mov   eax,[ebx+eax]
2519
    mov   eax,[ebx+eax]
2489
 
2520
 
2490
    and   eax, 0xFFFFFF
2521
    and   eax, 0xFFFFFF
Line 2491... Line 2522...
2491
    mov   [esp+36],eax
2522
    mov   [esp+36],eax
2492
@@:
2523
.ret:
Line 3639... Line 3670...
3639
 
3670
 
Line 3640... Line 3671...
3640
         ret
3671
         ret
Line 3641... Line -...
3641
 
-
 
3642
calculatebackground:   ; background
-
 
3643
 
-
 
3644
        ; all black
-
 
3645
 
-
 
3646
        mov   edi, [img_background]  ;IMG_BACKGROUND                 ; set background to black
-
 
3647
        xor   eax, eax
-
 
3648
        mov   ecx, 1023    ;0x0fff00 / 4
-
 
3649
        cld
3672
 
3650
        rep   stosd
3673
calculatebackground:   ; background
3651
 
3674
 
3652
        mov   edi,display_data              ; set os to use all pixels
3675
        mov   edi,display_data              ; set os to use all pixels