Rev 205 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 205 | Rev 307 | ||
---|---|---|---|
1 | macro use_gp |
- | |
2 | { |
- | |
3 | ;esi - screen size |
1 | ;esi - screen size |
4 | ;edi - pointer to image |
2 | ;edi - pointer to image |
5 | csi_width equ [esi+2] |
3 | csi_width equ [esi+2] |
6 | csi_height equ [esi] |
4 | csi_height equ [esi] |
7 | csi_bitspp equ [esi+4] |
5 | csi_bitspp equ [esi+4] |
8 | csi_bytesps equ [esi+6] |
6 | csi_bytesps equ [esi+6] |
- | 7 | ||
- | 8 | ||
9 | copy_screen_to_image: |
9 | copy_screen_to_image: |
10 | pusha |
10 | pusha |
11 | xor edx,edx |
11 | xor edx,edx |
12 | xor ecx,ecx |
12 | xor ecx,ecx |
13 | xor ebx,ebx |
13 | xor ebx,ebx |
- | 14 | ||
- | 15 | bt dword [use_rect.flags],1 |
|
- | 16 | jc copy_area |
|
14 | 17 | ||
15 | cmp csi_bitspp,word 24 |
18 | cmp csi_bitspp,word 24 |
16 | je .next_str_24 |
19 | je .next_str_24 |
17 | 20 | ||
18 | .next_str_32: |
21 | .next_str_32: |
19 | push edx ebx |
22 | push edx ebx |
20 | xor ebx,ebx |
23 | xor ebx,ebx |
21 | @@: |
24 | @@: |
22 | ;push eax |
25 | ;push eax |
23 | mov eax,[gs:edx] |
26 | mov eax,[gs:edx] |
24 | mov [edi+ecx],ax |
27 | mov [edi+ecx],ax |
25 | shr eax,8 |
28 | shr eax,8 |
26 | mov [edi+ecx+2],ah |
29 | mov [edi+ecx+2],ah |
27 | ;pop eax |
30 | ;pop eax |
28 | add ecx,3 |
31 | add ecx,3 |
29 | add edx,4;eax |
32 | add edx,4;eax |
30 | inc bx |
33 | inc bx |
31 | cmp bx,csi_width |
34 | cmp bx,csi_width |
32 | jl @b |
35 | jl @b |
33 | pop ebx edx |
36 | pop ebx edx |
34 | add edx,csi_bytesps |
37 | add edx,csi_bytesps |
35 | inc bx |
38 | inc bx |
36 | cmp bx,csi_height |
39 | cmp bx,csi_height |
37 | jl .next_str_32 |
40 | jl .next_str_32 |
38 | popa |
41 | popa |
39 | ret |
42 | ret |
40 | 43 | ||
41 | .next_str_24: |
44 | .next_str_24: |
42 | push edx ebx |
45 | push edx ebx |
43 | xor ebx,ebx |
46 | xor ebx,ebx |
44 | @@: |
47 | @@: |
45 | ;push eax |
48 | ;push eax |
46 | mov eax,[gs:edx] |
49 | mov eax,[gs:edx] |
47 | mov [edi+ecx],ax |
50 | mov [edi+ecx],ax |
48 | shr eax,8 |
51 | shr eax,8 |
49 | mov [edi+ecx+2],ah |
52 | mov [edi+ecx+2],ah |
50 | ;pop eax |
53 | ;pop eax |
51 | add ecx,3 |
54 | add ecx,3 |
52 | add edx,3;eax |
55 | add edx,3;eax |
53 | inc bx |
56 | inc bx |
54 | cmp bx,csi_width |
57 | cmp bx,csi_width |
55 | jl @b |
58 | jl @b |
56 | pop ebx edx |
59 | pop ebx edx |
57 | add edx,csi_bytesps |
60 | add edx,csi_bytesps |
58 | inc bx |
61 | inc bx |
59 | cmp bx,csi_height |
62 | cmp bx,csi_height |
60 | jl .next_str_24 |
63 | jl .next_str_24 |
61 | popa |
64 | popa |
62 | ret |
65 | ret |
63 | } |
- | |
64 | 66 | ||
- | 67 | copy_area: |
|
- | 68 | mov eax,[scr.bytesps] |
|
- | 69 | mov ebx,eax |
|
- | 70 | movzx ecx,word [rect.top] |
|
- | 71 | mul ecx |
|
- | 72 | movzx ecx,word [rect.width] |
|
- | 73 | shl ecx,2 |
|
- | 74 | sub ebx,ecx |
|
- | 75 | movzx ecx,word [rect.left] |
|
- | 76 | shl ecx,2 |
|
- | 77 | add eax,ecx |
|
- | 78 | movzx ecx,word [rect.height] |
|
- | 79 | mov edx,eax |
|
- | 80 | .next_str: |
|
- | 81 | movzx esi,word [rect.width] |
|
- | 82 | .next_pixel: |
|
- | 83 | mov eax,[gs:edx] |
|
- | 84 | mov [edi],ax |
|
- | 85 | shr eax,8 |
|
- | 86 | mov [edi+2],ah |
|
- | 87 | add edx,4 |
|
- | 88 | add edi,3 |
|
- | 89 | dec esi |
|
- | 90 | jnz .next_pixel |
|
- | 91 | add edx,ebx |
|
- | 92 | loop .next_str |
|
- | 93 | popa |
|
- | 94 | ret |
|
- | 95 | ||
65 | 96 |