Subversion Repositories Kolibri OS

Rev

Rev 1102 | Rev 2733 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1102 Rev 2284
1
;;================================================================================================;;
1
;;================================================================================================;;
2
;;//// ico.asm //// (c) mike.dld, 2007-2008, (c) diamond, 2009 ///////////////////////////////////;;
2
;;//// ico.asm //// (c) mike.dld, 2007-2008, (c) diamond, 2009 ///////////////////////////////////;;
3
;;================================================================================================;;
3
;;================================================================================================;;
4
;;                                                                                                ;;
4
;;                                                                                                ;;
5
;; This file is part of Common development libraries (Libs-Dev).                                  ;;
5
;; This file is part of Common development libraries (Libs-Dev).                                  ;;
6
;;                                                                                                ;;
6
;;                                                                                                ;;
7
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
7
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
8
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
8
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
9
;; of the License, or (at your option) any later version.                                         ;;
9
;; of the License, or (at your option) any later version.                                         ;;
10
;;                                                                                                ;;
10
;;                                                                                                ;;
11
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  ;;
11
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  ;;
12
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  ;;
12
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  ;;
13
;; Lesser General Public License for more details.                                                ;;
13
;; Lesser General Public License for more details.                                                ;;
14
;;                                                                                                ;;
14
;;                                                                                                ;;
15
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev.  ;;
15
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev.  ;;
16
;; If not, see .                                                    ;;
16
;; If not, see .                                                    ;;
17
;;                                                                                                ;;
17
;;                                                                                                ;;
18
;;================================================================================================;;
18
;;================================================================================================;;
19
;;                                                                                                ;;
19
;;                                                                                                ;;
20
;; References:                                                                                    ;;
20
;; References:                                                                                    ;;
21
;;   1. "Icons in Win32"                                                                          ;;
21
;;   1. "Icons in Win32"                                                                          ;;
22
;;      by John Hornick, Microsoft Corporation                                                    ;;
22
;;      by John Hornick, Microsoft Corporation                                                    ;;
23
;;      http://msdn2.microsoft.com/en-us/library/ms997538.aspx                                    ;;
23
;;      http://msdn2.microsoft.com/en-us/library/ms997538.aspx                                    ;;
24
;;                                                                                                ;;
24
;;                                                                                                ;;
25
;;================================================================================================;;
25
;;================================================================================================;;
26
 
26
 
27
include 'ico_cur.inc'
27
include 'ico_cur.inc'
28
 
28
 
29
;;================================================================================================;;
29
;;================================================================================================;;
30
;;proc img.is.ico _data, _length ;////////////////////////////////////////////////////////////////;;
30
;;proc img.is.ico _data, _length ;////////////////////////////////////////////////////////////////;;
31
img.is.ico:
31
img.is.ico:
32
	mov	edx, 0x00010000	; icon type = 1
32
	mov	edx, 0x00010000	; icon type = 1
33
	jmp	@f
33
	jmp	@f
34
img.is.cur:
34
img.is.cur:
35
	mov	edx, 0x00020000	; cursor type = 2
35
	mov	edx, 0x00020000	; cursor type = 2
36
@@:
36
@@:
37
;;------------------------------------------------------------------------------------------------;;
37
;;------------------------------------------------------------------------------------------------;;
38
;? Determine if raw data could be decoded (is in ICO format)                                      ;;
38
;? Determine if raw data could be decoded (is in ICO format)                                      ;;
39
;;------------------------------------------------------------------------------------------------;;
39
;;------------------------------------------------------------------------------------------------;;
40
;> _data = raw data as read from file/stream                                                      ;;
40
;> _data = raw data as read from file/stream                                                      ;;
41
;> _length = data length                                                                          ;;
41
;> _length = data length                                                                          ;;
42
;;------------------------------------------------------------------------------------------------;;
42
;;------------------------------------------------------------------------------------------------;;
43
;< eax = false / true                                                                             ;;
43
;< eax = false / true                                                                             ;;
44
;;================================================================================================;;
44
;;================================================================================================;;
45
; test 1 (length of data): data must contain FileHeader
45
; test 1 (length of data): data must contain FileHeader
46
	mov	ecx, [esp+8]
46
	mov	ecx, [esp+8]
47
	sub	ecx, sizeof.ico.FileHeader
47
	sub	ecx, sizeof.ico.FileHeader
48
	jb	.nope
48
	jb	.nope
49
; test 2: signature
49
; test 2: signature
50
	mov	eax, [esp+4]
50
	mov	eax, [esp+4]
51
	cmp	dword [eax], edx	; Reserved & Type
51
	cmp	dword [eax], edx	; Reserved & Type
52
	jne	.nope
52
	jne	.nope
53
; test 3: count must be non-zero
53
; test 3: count must be non-zero
54
	movzx	eax, [eax + ico.FileHeader.Count]
54
	movzx	eax, [eax + ico.FileHeader.Count]
55
	test	eax, eax
55
	test	eax, eax
56
	jz	.nope
56
	jz	.nope
57
; test 4 (length of data): data must containt Count dir entries
57
; test 4 (length of data): data must containt Count dir entries
58
	shl	eax, 4
58
	shl	eax, 4
59
	sub	ecx, eax
59
	sub	ecx, eax
60
	jae	.yep
60
	jae	.yep
61
 
61
 
62
  .nope:
62
  .nope:
63
	xor	eax, eax
63
	xor	eax, eax
64
	ret	8
64
	ret	8
65
 
65
 
66
  .yep:
66
  .yep:
67
	xor	eax, eax
67
	xor	eax, eax
68
	inc	eax
68
	inc	eax
69
	ret	8
69
	ret	8
70
;endp
70
;endp
71
 
71
 
72
;;================================================================================================;;
72
;;================================================================================================;;
73
proc img.decode.ico_cur _data, _length, _options ;////////////////////////////////////////////////;;
73
proc img.decode.ico_cur _data, _length, _options ;////////////////////////////////////////////////;;
74
;;------------------------------------------------------------------------------------------------;;
74
;;------------------------------------------------------------------------------------------------;;
75
;? Decode data into image if it contains correctly formed raw data in ICO/CUR format              ;;
75
;? Decode data into image if it contains correctly formed raw data in ICO/CUR format              ;;
76
;;------------------------------------------------------------------------------------------------;;
76
;;------------------------------------------------------------------------------------------------;;
77
;> _data = raw data as read from file/stream                                                      ;;
77
;> _data = raw data as read from file/stream                                                      ;;
78
;> _length = data length                                                                          ;;
78
;> _length = data length                                                                          ;;
79
;> _options = options for decoding (e.g. background color)                                        ;;
79
;> _options = options for decoding (e.g. background color)                                        ;;
80
;;------------------------------------------------------------------------------------------------;;
80
;;------------------------------------------------------------------------------------------------;;
81
;< eax = 0 (error) or pointer to image                                                            ;;
81
;< eax = 0 (error) or pointer to image                                                            ;;
82
;;================================================================================================;;
82
;;================================================================================================;;
83
locals
83
locals
84
  count dd ?
84
  count dd ?
85
  img dd ?
85
  img dd ?
86
  main_img dd ?
86
  main_img dd ?
87
endl
87
endl
88
 
88
 
89
	push	ebx esi edi
89
	push	ebx esi edi
90
 
90
 
91
; img.is.ico has been already called by img.decode
91
; img.is.ico has been already called by img.decode
92
;	stdcall img.is.ico, [_data], [_length]
92
;	stdcall img.is.ico, [_data], [_length]
93
;	or	eax, eax
93
;	or	eax, eax
94
;	jz	.error
94
;	jz	.error
95
 
95
 
96
	mov	ebx, [_data]
96
	mov	ebx, [_data]
97
	movzx	eax, [ebx + ico.FileHeader.Count]
97
	movzx	eax, [ebx + ico.FileHeader.Count]
98
	mov	[count], eax
98
	mov	[count], eax
99
	and	[img], 0
99
	and	[img], 0
100
	and	[main_img], 0
100
	and	[main_img], 0
101
.loop:
101
.loop:
102
	mov	ecx, [ebx + sizeof.ico.FileHeader + ico.DirEntry.ByteSize]
102
	mov	ecx, [ebx + sizeof.ico.FileHeader + ico.DirEntry.ByteSize]
103
	mov	edx, [ebx + sizeof.ico.FileHeader + ico.DirEntry.ImageOffset]
103
	mov	edx, [ebx + sizeof.ico.FileHeader + ico.DirEntry.ImageOffset]
104
	mov	eax, [_length]
104
	mov	eax, [_length]
105
	sub	eax, edx
105
	sub	eax, edx
106
	jb	.skip
106
	jb	.skip
107
	cmp	eax, ecx
107
	cmp	eax, ecx
108
	jb	.skip
108
	jb	.skip
109
	cmp	ecx, 12	; length test, see img.is.bmp
109
	cmp	ecx, 12	; length test, see img.is.bmp
110
	jb	.skip
110
	jb	.skip
111
	add	edx, [_data]
111
	add	edx, [_data]
112
	push	[_options]
112
	push	[_options]
113
	push	ecx
113
	push	ecx
114
	push	edx
114
	push	edx
115
	call	img.decode.ico._.decode_icon_data
115
	call	img.decode.ico._.decode_icon_data
116
	test	eax, eax
116
	test	eax, eax
117
	jz	.skip
117
	jz	.skip
118
	push	0xFFFFFF	; set bgr to white if no given
118
	push	0xFFFFFF	; set bgr to white if no given
119
	mov	edx, [_options]
119
	mov	edx, [_options]
120
	test	edx, edx
120
	test	edx, edx
121
	jz	@f
121
	jz	@f
122
	cmp	[edx + ImageDecodeOptions.UsedSize], ImageDecodeOptions.BackgroundColor + 4
122
	cmp	[edx + ImageDecodeOptions.UsedSize], ImageDecodeOptions.BackgroundColor + 4
123
	jb	@f
123
	jb	@f
124
	add	esp, 4
124
	add	esp, 4
125
	push	[edx + ImageDecodeOptions.BackgroundColor]
125
	push	[edx + ImageDecodeOptions.BackgroundColor]
126
@@:
126
@@:
127
	call	img.decode.ico._.decode_icon_mask
127
	call	img.decode.ico._.decode_icon_mask
128
	test	eax, eax
128
	test	eax, eax
129
	jz	.skip
129
	jz	.skip
130
	mov	edx, [img]
130
	mov	edx, [img]
131
	test	edx, edx
131
	test	edx, edx
132
	jz	.first
132
	jz	.first
133
	mov	[edx + Image.Next], eax
133
	mov	[edx + Image.Next], eax
134
	mov	[eax + Image.Previous], edx
134
	mov	[eax + Image.Previous], edx
135
	jmp	@f
135
	jmp	@f
136
.first:
136
.first:
137
	mov	[main_img], eax
137
	mov	[main_img], eax
138
@@:
138
@@:
139
	mov	[img], eax
139
	mov	[img], eax
140
.skip:
140
.skip:
141
	add	ebx, sizeof.ico.DirEntry
141
	add	ebx, sizeof.ico.DirEntry
142
	dec	[count]
142
	dec	[count]
143
	jnz	.loop
143
	jnz	.loop
144
 
144
 
145
	mov	eax, [main_img]
145
	mov	eax, [main_img]
146
	pop	edi esi ebx
146
	pop	edi esi ebx
147
	ret
147
	ret
148
endp
148
endp
149
 
149
 
150
;;================================================================================================;;
150
;;================================================================================================;;
151
img.encode.cur:
151
img.encode.cur:
152
proc img.encode.ico _img, _p_length, _options ;///////////////////////////////////////////////////;;
152
proc img.encode.ico _img, _p_length, _options ;///////////////////////////////////////////////////;;
153
;;------------------------------------------------------------------------------------------------;;
153
;;------------------------------------------------------------------------------------------------;;
154
;? Encode image into raw data in ICO format                                                       ;;
154
;? Encode image into raw data in ICO format                                                       ;;
155
;;------------------------------------------------------------------------------------------------;;
155
;;------------------------------------------------------------------------------------------------;;
156
;> _img = pointer to image                                                                        ;;
156
;> _img = pointer to image                                                                        ;;
157
;;------------------------------------------------------------------------------------------------;;
157
;;------------------------------------------------------------------------------------------------;;
158
;< eax = 0 (error) or pointer to encoded data                                                     ;;
158
;< eax = 0 (error) or pointer to encoded data                                                     ;;
159
;< _p_length = encoded data length                                                                ;;
159
;< _p_length = encoded data length                                                                ;;
160
;;================================================================================================;;
160
;;================================================================================================;;
161
	xor	eax, eax
161
	xor	eax, eax
162
	ret
162
	ret
163
endp
163
endp
164
 
164
 
165
 
165
 
166
;;================================================================================================;;
166
;;================================================================================================;;
167
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
167
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
168
;;================================================================================================;;
168
;;================================================================================================;;
169
;! Below are private procs you should never call directly from your code                          ;;
169
;! Below are private procs you should never call directly from your code                          ;;
170
;;================================================================================================;;
170
;;================================================================================================;;
171
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
171
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
172
;;================================================================================================;;
172
;;================================================================================================;;
173
 
173
 
174
img.decode.ico._.decode_icon_data:
174
img.decode.ico._.decode_icon_data:
175
; create stack frame and jump to common BMP+ICO code
175
; create stack frame and jump to common BMP+ICO code
176
	push	ebp
176
	push	ebp
177
	mov	ebp, esp
177
	mov	ebp, esp
178
	sub	esp, 12
178
	sub	esp, 12
179
	mov	byte [ebp - 3], 1	; bIsIco
179
	mov	byte [ebp - 3], 1	; bIsIco
180
	jmp	img.decode.bmp.common
180
	jmp	img.decode.bmp.common
181
 
181
 
182
img.decode.ico._.decode_icon_mask:
182
img.decode.ico._.decode_icon_mask:
183
	mov	edx, [eax + Image.Width]
183
	mov	edx, [eax + Image.Width]
184
	add	edx, 31
184
	add	edx, 31
185
	shr	edx, 3
185
	shr	edx, 3
186
	and	edx, not 3
186
	and	edx, not 3
187
	push	edx
187
	push	edx
188
	imul	edx, [eax + Image.Height]
188
	imul	edx, [eax + Image.Height]
189
	cmp	ecx, edx
189
	cmp	ecx, edx
190
	pop	edx
190
	pop	edx
191
	jb	.error.free
191
	jb	.error.free
192
	mov	edi, [eax + Image.Data]
192
	mov	edi, [eax + Image.Data]
193
	push	ebp ebx eax
193
	push	ebp ebx eax
194
	xor	ebp, ebp
194
	xor	ebp, ebp
195
	mov	ebx, [eax + Image.Extended]
195
	mov	ebx, [eax + Image.Extended]
196
	cmp	[ebx + bmp.Image.info.Height], 0
196
	cmp	[ebx + bmp.Image.info.Height], 0
197
	js	@f
197
	js	@f
198
	push	edx
198
	push	edx
199
	imul	edx, [eax + Image.Height]
199
	imul	edx, [eax + Image.Height]
200
	add	esi, edx
200
	add	esi, edx
201
	pop	edx
201
	pop	edx
202
	lea	ebp, [edx+edx]
202
	lea	ebp, [edx+edx]
203
	sub	esi, edx
203
	sub	esi, edx
204
@@:
204
@@:
205
	mov	ebx, [eax + Image.Height]
205
	mov	ebx, [eax + Image.Height]
206
	mov	ecx, [eax + Image.Width]
206
	mov	ecx, [eax + Image.Width]
207
; for now, BMP code produces only 8 and 32 bpp images
207
; for now, BMP code produces only 8 and 32 bpp images
208
	cmp	[eax + Image.Type], Image.bpp8
208
	cmp	[eax + Image.Type], Image.bpp8
209
	jz	.bpp8
209
	jz	.bpp8
210
.bpp32:
210
.bpp32:
211
	mov	edx, [esp+16]	; get background color
211
	mov	edx, [esp+16]	; get background color
212
.bpp32.extloop:
212
.bpp32.extloop:
213
	push	ecx
213
	push	ecx
214
.bpp32.innloop:
214
.bpp32.innloop:
215
	lodsd
215
	lodsd
216
	bswap	eax
216
	bswap	eax
217
	push	32
217
	push	32
218
.bpp32.dwordloop:
218
.bpp32.dwordloop:
219
	add	eax, eax
219
	add	eax, eax
220
	jnc	@f
220
	jnc	@f
221
	mov	[edi], edx
221
	mov	[edi], edx
222
@@:
222
@@:
223
	add	edi, 4
223
	add	edi, 4
224
	dec	ecx
224
	dec	ecx
225
	jz	@f
225
	jz	@f
226
	dec	dword [esp]
226
	dec	dword [esp]
227
	jnz	.bpp32.dwordloop
227
	jnz	.bpp32.dwordloop
228
@@:
228
@@:
229
	pop	eax
229
	pop	eax
230
	test	ecx, ecx
230
	test	ecx, ecx
231
	jnz	.bpp32.innloop
231
	jnz	.bpp32.innloop
232
	sub	esi, ebp
232
	sub	esi, ebp
233
	pop	ecx
233
	pop	ecx
234
	dec	ebx
234
	dec	ebx
235
	jnz	.bpp32.extloop
235
	jnz	.bpp32.extloop
236
	pop	eax ebx ebp
236
	pop	eax ebx ebp
237
	ret	4
237
	ret	4
238
.bpp8:
238
.bpp8:
239
	push	edi
239
	push	edi
240
	mov	edi, [eax + Image.Palette]
240
	mov	edi, [eax + Image.Palette]
241
	mov	eax, [esp+20]	; get background color
241
	mov	eax, [esp+20]	; get background color
242
; if palette already has index for bgr color, use it
242
; if palette already has index for bgr color, use it
243
	push	ecx
243
	push	ecx
244
	mov	ecx, 256
244
	mov	ecx, 256
245
	repnz	scasd
245
	repnz	scasd
246
	jnz	.bpp8.notfound
246
	jnz	.bpp8.notfound
247
	not	cl	; cl = index
247
	not	cl	; cl = index
248
	pop	edx
248
	pop	edx
249
	pop	edi
249
	pop	edi
250
.bpp8.extloop:
250
.bpp8.extloop:
251
	push	edx
251
	push	edx
252
.bpp8.innloop:
252
.bpp8.innloop:
253
	lodsd
253
	lodsd
254
	bswap	eax
254
	bswap	eax
255
	push	32
255
	push	32
256
.bpp8.dwordloop:
256
.bpp8.dwordloop:
257
	add	eax, eax
257
	add	eax, eax
258
	jnc	@f
258
	jnc	@f
259
	mov	[edi], cl
259
	mov	[edi], cl
260
@@:
260
@@:
261
	inc	edi
261
	inc	edi
262
	dec	edx
262
	dec	edx
263
	jz	@f
263
	jz	@f
264
	dec	dword [esp]
264
	dec	dword [esp]
265
	jnz	.bpp8.dwordloop
265
	jnz	.bpp8.dwordloop
266
@@:
266
@@:
267
	pop	eax
267
	pop	eax
268
	test	edx, edx
268
	test	edx, edx
269
	jnz	.bpp8.innloop
269
	jnz	.bpp8.innloop
270
	sub	esi, ebp
270
	sub	esi, ebp
271
	pop	edx
271
	pop	edx
272
	dec	ebx
272
	dec	ebx
273
	jnz	.bpp8.extloop
273
	jnz	.bpp8.extloop
274
	pop	eax ebx ebp
274
	pop	eax ebx ebp
275
	ret	4
275
	ret	4
276
.bpp8.notfound:
276
.bpp8.notfound:
277
; get maximum used color; if index < 255, then we can add one color to palette
277
; get maximum used color; if index < 255, then we can add one color to palette
278
	pop	ecx
278
	pop	ecx
279
	pop	edi
279
	pop	edi
280
	pop	eax
280
	pop	eax
281
	mov	edx, [eax + Image.Width]
281
	mov	edx, [eax + Image.Width]
282
	imul	edx, ebx
282
	imul	edx, ebx
283
	mov	edi, [eax + Image.Data]
283
	mov	edi, [eax + Image.Data]
284
	xor	ecx, ecx
284
	xor	ecx, ecx
285
.bpp8.scanloop:
285
.bpp8.scanloop:
286
	cmp	[edi], cl
286
	cmp	[edi], cl
287
	jb	@f
287
	jb	@f
288
	mov	cl, [edi]
288
	mov	cl, [edi]
289
@@:
289
@@:
290
	inc	edi
290
	inc	edi
291
	dec	edx
291
	dec	edx
292
	jnz	.bpp8.scanloop
292
	jnz	.bpp8.scanloop
293
	inc	cl
293
	inc	cl
294
	jz	.bpp8.nospace
294
	jz	.bpp8.nospace
295
	mov	edx, [esp+8]
295
	mov	edx, [esp+8]
296
	mov	edi, [eax + Image.Palette]
296
	mov	edi, [eax + Image.Palette]
297
	mov	[edi+ecx*4], edx	; set palette color
297
	mov	[edi+ecx*4], edx	; set palette color
298
	mov	edi, [eax + Image.Data]
298
	mov	edi, [eax + Image.Data]
299
	mov	edx, [eax + Image.Width]
299
	mov	edx, [eax + Image.Width]
300
	push	eax
300
	push	eax
301
	jmp	.bpp8.extloop
301
	jmp	.bpp8.extloop
302
.bpp8.nospace:
302
.bpp8.nospace:
303
; convert to 24 bpp
303
; convert to 24 bpp
304
	mov	edx, [eax + Image.Width]
304
	mov	edx, [eax + Image.Width]
305
	imul	edx, ebx
305
	imul	edx, ebx
306
	lea	edx, [edx*3]
306
	lea	edx, [edx*3]
307
	push	eax
307
	push	eax
308
	invoke	mem.alloc, edx
308
	invoke	mem.alloc, edx
309
	mov	edi, eax
309
	mov	edi, eax
310
	pop	eax
310
	pop	eax
311
	test	edi, edi
311
	test	edi, edi
312
	jz	.error.free2
312
	jz	.error.free2
313
	push	eax esi edi
313
	push	eax esi edi
314
	mov	esi, eax
314
	mov	esi, eax
315
	call	img._.do_rgb
315
	call	img._.do_rgb
316
	pop	edi esi eax
316
	pop	edi esi eax
317
	xchg	edi, [eax + Image.Data]
317
	xchg	edi, [eax + Image.Data]
318
	mov	byte [eax + Image.Type], Image.bpp24
318
	mov	byte [eax + Image.Type], Image.bpp24
319
	push	eax
319
	push	eax
320
	invoke	mem.free, edi
320
	invoke	mem.free, edi
321
	pop	eax
321
	pop	eax
322
	push	eax
322
	push	eax
323
	mov	ecx, [eax + Image.Width]
323
	mov	ecx, [eax + Image.Width]
-
 
324
	mov	edi, [eax + Image.Data]
324
.bpp24:
325
.bpp24:
325
	mov	edx, [esp+16]	; get background color
326
	mov	edx, [esp+16]	; get background color
326
.bpp24.extloop:
327
.bpp24.extloop:
327
	push	ecx
328
	push	ecx
328
.bpp24.innloop:
329
.bpp24.innloop:
329
	lodsd
330
	lodsd
330
	bswap	eax
331
	bswap	eax
331
	push	32
332
	push	32
332
.bpp24.dwordloop:
333
.bpp24.dwordloop:
333
	add	eax, eax
334
	add	eax, eax
334
	jnc	@f
335
	jnc	@f
335
	mov	[edi], dx
336
	mov	[edi], dx
336
	ror	edx, 16
337
	ror	edx, 16
337
	mov	[edi+2], dl
338
	mov	[edi+2], dl
338
	ror	edx, 16
339
	ror	edx, 16
339
@@:
340
@@:
340
	add	edi, 4
341
	add	edi, 3
341
	dec	ecx
342
	dec	ecx
342
	jz	@f
343
	jz	@f
343
	dec	dword [esp]
344
	dec	dword [esp]
344
	jnz	.bpp24.dwordloop
345
	jnz	.bpp24.dwordloop
345
@@:
346
@@:
346
	pop	eax
347
	pop	eax
347
	test	ecx, ecx
348
	test	ecx, ecx
348
	jnz	.bpp24.innloop
349
	jnz	.bpp24.innloop
349
	sub	esi, ebp
350
	sub	esi, ebp
350
	pop	ecx
351
	pop	ecx
351
	dec	ebx
352
	dec	ebx
352
	jnz	.bpp24.extloop
353
	jnz	.bpp24.extloop
353
	pop	eax ebx ebp
354
	pop	eax ebx ebp
354
	ret	4
355
	ret	4
355
.error.free2:
356
.error.free2:
356
	pop	ebx ebp
357
	pop	ebx ebp
357
.error.free:
358
.error.free:
358
	stdcall	img._.delete, eax
359
	stdcall	img._.delete, eax
359
	xor	eax, eax
360
	xor	eax, eax
360
	ret	4
361
	ret	4
361
 
362
 
362
;;================================================================================================;;
363
;;================================================================================================;;
363
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
364
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
364
;;================================================================================================;;
365
;;================================================================================================;;
365
;! Below is private data you should never use directly from your code                             ;;
366
;! Below is private data you should never use directly from your code                             ;;
366
;;================================================================================================;;
367
;;================================================================================================;;
367
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
368
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
368
;;================================================================================================;;
369
;;================================================================================================;;
369
 
370
 
370
 
371
 
371
;
372
;