Subversion Repositories Kolibri OS

Rev

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

Rev 9279 Rev 9458
Line 75... Line 75...
75
format binary as "mnt"
75
format binary as "mnt"
Line 76... Line 76...
76
 
76
 
77
include 'macros.inc'
77
include 'macros.inc'
Line 78... Line 78...
78
include 'struct.inc'
78
include 'struct.inc'
Line 79... Line 79...
79
 
79
 
80
$Revision: 9279 $
80
$Revision: 9458 $
Line 3051... Line 3051...
3051
        inc     [REDRAW_BACKGROUND]
3051
        inc     [REDRAW_BACKGROUND]
3052
        call    wakeup_osloop
3052
        call    wakeup_osloop
3053
        ret
3053
        ret
3054
;------------------------------------------------------------------------------
3054
;------------------------------------------------------------------------------
3055
align 4
3055
align 4
3056
sys_getbackground:
3056
sys_getbackground: ; sysfn 39
3057
;    cmp   eax,1                                  ; SIZE
-
 
3058
        dec     ebx
3057
        dec     ebx
3059
        jnz     nogb1
3058
        jnz     .nogb1
-
 
3059
        ; sysfn 39.1:
3060
        mov     eax, [BgrDataWidth]
3060
        mov     eax, [BgrDataWidth]
3061
        shl     eax, 16
3061
        shl     eax, 16
3062
        mov     ax, word [BgrDataHeight]
3062
        mov     ax, word [BgrDataHeight]
3063
        mov     [esp+32], eax
3063
        mov     [esp+32], eax
3064
        ret
3064
        ret
3065
;------------------------------------------------------------------------------
3065
;------------------------------------------------------------------------------
3066
align 4
3066
align 4
3067
nogb1:
3067
.nogb1:
3068
;    cmp   eax,2                                  ; PIXEL
-
 
3069
        dec     ebx
3068
        dec     ebx
3070
        jnz     nogb2
3069
        jnz     .nogb2
3071
 
-
 
-
 
3070
        ; sysfn 39.2:
3072
        mov     eax, [img_background]
3071
        mov     eax, [img_background]
3073
        test    ecx, ecx
3072
        test    ecx, ecx
3074
        jz      @f
3073
        jz      @f
3075
        cmp     eax, static_background_data
3074
        cmp     eax, static_background_data
3076
        jz      .ret
3075
        jz      .ret
3077
;--------------------------------------
-
 
3078
align 4
3076
align 4
3079
@@:
3077
@@:
3080
        mov     ebx, [mem_BACKGROUND]
3078
        mov     ebx, [mem_BACKGROUND]
3081
        add     ebx, 4095
3079
        add     ebx, 4095
3082
        and     ebx, -4096
3080
        and     ebx, -4096
Line 3086... Line 3084...
3086
 
3084
 
Line 3087... Line 3085...
3087
        mov     eax, [ecx+eax]
3085
        mov     eax, [ecx+eax]
3088
 
3086
 
3089
        and     eax, 0xFFFFFF
-
 
3090
        mov     [esp+32], eax
3087
        and     eax, 0xFFFFFF
3091
;--------------------------------------
3088
        mov     [esp+32], eax
3092
align 4
3089
align 4
3093
.ret:
3090
.ret:
3094
        ret
3091
        ret
-
 
3092
;------------------------------------------------------------------------------
-
 
3093
align 4
-
 
3094
        .x      dd ?
-
 
3095
        .y      dd ?
-
 
3096
        .w      dd ?
-
 
3097
        .h      dd ?
-
 
3098
        .subrect_startptr dd ?
3095
;------------------------------------------------------------------------------
3099
        .subrect_bytes dd ?
3096
align 4
-
 
3097
nogb2:
-
 
3098
 
3100
align 4
-
 
3101
.nogb2:
-
 
3102
        dec     ebx
-
 
3103
        jnz     .nogb3
-
 
3104
        ; sysfn 39.3 read background subrect to buffer
-
 
3105
        ; ecx - 
-
 
3106
        ; edx - 
-
 
3107
        ; esi - buffer of 0x00RRGGBB
-
 
3108
        mov     eax, [img_background]
-
 
3109
        cmp     eax, static_background_data
-
 
3110
        jz      .ret_39_3
-
 
3111
align 4
-
 
3112
@@:
-
 
3113
        movzx   eax, cx ; store y in eax
-
 
3114
        mov     [.y], eax
-
 
3115
 
-
 
3116
        shr     ecx, 16 ; ecx = x
-
 
3117
        mov     [.x], ecx
-
 
3118
 
-
 
3119
        imul    eax, [BgrDataWidth]
-
 
3120
        add     eax, ecx
-
 
3121
        imul    eax, 3
-
 
3122
        mov     [.subrect_startptr], eax
-
 
3123
 
-
 
3124
        movzx   eax, dx ; store h in eax
-
 
3125
        mov     [.h], eax
-
 
3126
 
-
 
3127
        shr     edx, 16 ; edx = w
-
 
3128
        mov     [.w], edx
-
 
3129
 
-
 
3130
        imul    eax, edx
-
 
3131
        mov     [.subrect_bytes], eax
-
 
3132
 
-
 
3133
        ; check bounds
-
 
3134
        mov     ebx, [mem_BACKGROUND]
-
 
3135
        add     ebx, 4095
-
 
3136
        and     ebx, -4096
-
 
3137
        sub     ebx, 4
-
 
3138
        add     eax, [.subrect_startptr]
-
 
3139
        cmp     eax, ebx
-
 
3140
        ja      .fail_39_3
-
 
3141
 
-
 
3142
        ; copy contents
-
 
3143
        mov     edi, [img_background]
-
 
3144
        xor     ecx, ecx ; ecx - row index
-
 
3145
.copy_rect:
-
 
3146
        cmp     ecx, [.h]
-
 
3147
        jae     .end_copy_rect
-
 
3148
        
-
 
3149
        xor     edx, edx ; edx - column index
-
 
3150
.copy_row:
-
 
3151
        cmp     edx, [.w]
-
 
3152
        jae     .end_copy_row
-
 
3153
 
-
 
3154
        mov     ebx, ecx
-
 
3155
        imul    ebx, [BgrDataWidth]
-
 
3156
        add     ebx, edx
-
 
3157
        imul    ebx, 3
-
 
3158
        add     ebx, [.subrect_startptr]
-
 
3159
        mov     eax, [edi + ebx]
-
 
3160
        mov     ebx, ecx
-
 
3161
        imul    ebx, [.w]
-
 
3162
        add     ebx, edx
-
 
3163
        and     eax, 0xFFFFFF
-
 
3164
        mov     [esi + ebx*4], eax       
-
 
3165
 
-
 
3166
        inc     edx
-
 
3167
        jmp     .copy_row
-
 
3168
.end_copy_row:        
-
 
3169
 
-
 
3170
        inc     ecx
-
 
3171
        jmp     .copy_rect
-
 
3172
.end_copy_rect:
-
 
3173
        xor     eax, eax
-
 
3174
        mov     [esp+32], eax
-
 
3175
;--------------------------------------
-
 
3176
align 4
-
 
3177
.fail_39_3:
-
 
3178
        mov     eax, -1
-
 
3179
align 4
-
 
3180
.ret_39_3:
-
 
3181
        ret
-
 
3182
;--------------------------------------
3099
;    cmp   eax,4                                  ; TILED / STRETCHED
3183
align 4
3100
        dec     ebx
3184
.nogb3:
-
 
3185
        dec     ebx
3101
        dec     ebx
3186
        jnz     .nogb4
3102
        jnz     nogb4
3187
        ; sysfn 39.4:
3103
        mov     eax, [BgrDrawMode]
3188
        mov     eax, [BgrDrawMode]
3104
;--------------------------------------
3189
;--------------------------------------
3105
align 4
3190
align 4
3106
nogb4:
3191
.nogb4:
3107
        mov     [esp+32], eax
3192
        mov     [esp+32], eax
3108
        ret
3193
        ret
3109
;------------------------------------------------------------------------------
3194
;------------------------------------------------------------------------------