Rev 205 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
205 | heavyiron | 1 | ;esi - screen size |
2 | ;edi - pointer to image |
||
3 | csi_width equ [esi+2] |
||
4 | csi_height equ [esi] |
||
5 | csi_bitspp equ [esi+4] |
||
6 | csi_bytesps equ [esi+6] |
||
307 | Lrz | 7 | |
8 | |||
205 | heavyiron | 9 | copy_screen_to_image: |
10 | pusha |
||
11 | xor edx,edx |
||
12 | xor ecx,ecx |
||
13 | xor ebx,ebx |
||
14 | |||
307 | Lrz | 15 | bt dword [use_rect.flags],1 |
16 | jc copy_area |
||
17 | |||
205 | heavyiron | 18 | cmp csi_bitspp,word 24 |
19 | je .next_str_24 |
||
20 | |||
21 | .next_str_32: |
||
22 | push edx ebx |
||
23 | xor ebx,ebx |
||
24 | @@: |
||
25 | ;push eax |
||
26 | mov eax,[gs:edx] |
||
27 | mov [edi+ecx],ax |
||
28 | shr eax,8 |
||
29 | mov [edi+ecx+2],ah |
||
30 | ;pop eax |
||
31 | add ecx,3 |
||
32 | add edx,4;eax |
||
33 | inc bx |
||
34 | cmp bx,csi_width |
||
35 | jl @b |
||
36 | pop ebx edx |
||
37 | add edx,csi_bytesps |
||
38 | inc bx |
||
39 | cmp bx,csi_height |
||
40 | jl .next_str_32 |
||
41 | popa |
||
42 | ret |
||
43 | |||
44 | .next_str_24: |
||
45 | push edx ebx |
||
46 | xor ebx,ebx |
||
47 | @@: |
||
48 | ;push eax |
||
49 | mov eax,[gs:edx] |
||
50 | mov [edi+ecx],ax |
||
51 | shr eax,8 |
||
52 | mov [edi+ecx+2],ah |
||
53 | ;pop eax |
||
54 | add ecx,3 |
||
55 | add edx,3;eax |
||
56 | inc bx |
||
57 | cmp bx,csi_width |
||
58 | jl @b |
||
59 | pop ebx edx |
||
60 | add edx,csi_bytesps |
||
61 | inc bx |
||
62 | cmp bx,csi_height |
||
63 | jl .next_str_24 |
||
64 | popa |
||
65 | ret |
||
307 | Lrz | 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 |