Subversion Repositories Kolibri OS

Rev

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

Rev 1954 Rev 1958
1
;*****************************************************************************
1
;*****************************************************************************
2
; Scaling RAW image plugin - for zSea image viewer
2
; Scaling RAW image plugin - for zSea image viewer
3
; Copyright (c) 2009 - 2011, Marat Zakiyanov aka Mario79, aka Mario
3
; Copyright (c) 2009 - 2011, Marat Zakiyanov aka Mario79, aka Mario
4
; All rights reserved.
4
; All rights reserved.
5
;
5
;
6
; Redistribution and use in source and binary forms, with or without
6
; Redistribution and use in source and binary forms, with or without
7
; modification, are permitted provided that the following conditions are met:
7
; modification, are permitted provided that the following conditions are met:
8
;	 * Redistributions of source code must retain the above copyright
8
;	 * Redistributions of source code must retain the above copyright
9
;	   notice, this list of conditions and the following disclaimer.
9
;	   notice, this list of conditions and the following disclaimer.
10
;	 * Redistributions in binary form must reproduce the above copyright
10
;	 * Redistributions in binary form must reproduce the above copyright
11
;	   notice, this list of conditions and the following disclaimer in the
11
;	   notice, this list of conditions and the following disclaimer in the
12
;	   documentation and/or other materials provided with the distribution.
12
;	   documentation and/or other materials provided with the distribution.
13
;	 * Neither the name of the  nor the
13
;	 * Neither the name of the  nor the
14
;	   names of its contributors may be used to endorse or promote products
14
;	   names of its contributors may be used to endorse or promote products
15
;	   derived from this software without specific prior written permission.
15
;	   derived from this software without specific prior written permission.
16
;
16
;
17
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
17
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
18
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
21
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
;*****************************************************************************
27
;*****************************************************************************
28
; Scaling 32b, 24b, 16b, 8b
28
; Scaling 32b, 24b, 16b, 8b
29
 
29
 
30
format MS COFF
30
format MS COFF
31
 
31
 
32
public EXPORTS
32
public EXPORTS
33
 
33
 
34
section '.flat' code readable align 16
34
section '.flat' code readable align 16
35
 
35
 
36
;include	'macros.inc'
36
;include	'macros.inc'
37
include	'../../../../macros.inc'
37
include	'../../../../macros.inc'
38
;---------------------------------------------------------------------
38
;---------------------------------------------------------------------
39
START:
39
START:
40
	pushad
40
	pushad
-
 
41
	mov	edi,dword [esp+56]
-
 
42
	mov	esi,dword [esp+52]
-
 
43
	mov	edx,dword [esp+48]
-
 
44
	mov	ecx,dword [esp+44]
-
 
45
	mov	ebx,dword [esp+40]
-
 
46
	mov	eax,dword [esp+36]	
41
	mov [pointer],eax
47
	mov [pointer],eax
42
	test bx,bx
48
	test bx,bx
43
	jnz  @f
49
	jnz  @f
44
	inc  bx
50
	inc  bx
45
@@:
51
@@:
46
	ror ebx,16
52
	ror ebx,16
47
	test bx,bx
53
	test bx,bx
48
	jnz  @f
54
	jnz  @f
49
	inc  bx
55
	inc  bx
50
@@:
56
@@:
51
	rol ebx,16
57
	rol ebx,16
52
	mov [new_size],ebx
58
	mov [new_size],ebx
53
	mov [start_coordinates],ecx
59
	mov [start_coordinates],ecx
54
	mov [scaling_mode],edx
60
	mov [scaling_mode],edx
55
	mov [filtering],esi
61
	mov [filtering],esi
56
	mov [background_color],edi
62
	mov [background_color],edi
57
	mov eax,[eax+4]
63
	mov eax,[eax+4]
58
	mov [image_file],eax
64
	mov [image_file],eax
59
 
65
 
60
	mov  esi,[eax+28]
66
	mov  esi,[eax+28]
61
    add  esi,eax
67
    add  esi,eax
62
	
68
	
63
	mov  ebx,[eax+20]
69
	mov  ebx,[eax+20]
64
	add  ebx,eax
70
	add  ebx,eax
65
	mov  [palette],ebx
71
	mov  [palette],ebx
66
	
72
	
67
	mov ebx,[eax+12]
73
	mov ebx,[eax+12]
68
	mov [resolution],ebx
74
	mov [resolution],ebx
69
	cmp  ebx,32
75
	cmp  ebx,32
70
	jne  @f
76
	jne  @f
71
	mov  ebp,dword START.32
77
	mov  ebp,dword START.32
72
	jmp  .1
78
	jmp  .1
73
@@:
79
@@:
74
	cmp  ebx,24
80
	cmp  ebx,24
75
	jne  @f
81
	jne  @f
76
	mov  ebp,dword START.24
82
	mov  ebp,dword START.24
77
	jmp  .1
83
	jmp  .1
78
@@:
84
@@:
79
	cmp  ebx,16
85
	cmp  ebx,16
80
	jne  @f
86
	jne  @f
81
	mov  ebp,dword START.16
87
	mov  ebp,dword START.16
82
	jmp  .1
88
	jmp  .1
83
@@:
89
@@:
84
	cmp  ebx,15
90
	cmp  ebx,15
85
	jne  @f
91
	jne  @f
86
	inc  ebx
92
	inc  ebx
87
	mov  ebp,dword START.16
93
	mov  ebp,dword START.16
88
	jmp  .1
94
	jmp  .1
89
@@:
95
@@:
90
	cmp  ebx,8
96
	cmp  ebx,8
91
	jne  @f
97
	jne  @f
92
	mov  ebp,dword START.8
98
	mov  ebp,dword START.8
93
@@:
99
@@:
94
.1:
100
.1:
95
	shr  ebx,3
101
	shr  ebx,3
96
	mov  [bytes_to_pixel],ebx
102
	mov  [bytes_to_pixel],ebx
97
	
103
	
98
	mov  ebx,[eax+8]
104
	mov  ebx,[eax+8]
99
	mov  [y],ebx
105
	mov  [y],ebx
100
	mov  ebx,[eax+4]
106
	mov  ebx,[eax+4]
101
	mov  [x],ebx
107
	mov  [x],ebx
102
	imul ebx,[bytes_to_pixel]
108
	imul ebx,[bytes_to_pixel]
103
	mov  [size_x],ebx
109
	mov  [size_x],ebx
104
	
110
	
105
	mov  eax,100
111
	mov  eax,100
106
	shl  eax,12
112
	shl  eax,12
107
	mov  ebx,[scaling_mode]
113
	mov  ebx,[scaling_mode]
108
	test ebx,ebx
114
	test ebx,ebx
109
	jnz  @f
115
	jnz  @f
110
	inc  ebx
116
	inc  ebx
111
@@:
117
@@:
112
	xor  edx,edx
118
	xor  edx,edx
113
	div  ebx
119
	div  ebx
114
	mov  [scaling_delta],eax
120
	mov  [scaling_delta],eax
115
	
121
	
116
	call .get_memory
122
	call .get_memory
117
	cmp  [scaling_mode],0
123
	cmp  [scaling_mode],0
118
	jne  @f
124
	jne  @f
119
	call .scaling
125
	call .scaling
120
	jmp  .ret_ok
126
	jmp  .ret_ok
121
@@:
127
@@:
122
	call .scaling_2	
128
	call .scaling_2	
123
	
129
	
124
;---------------------------------------------------------------------
130
;---------------------------------------------------------------------
125
.ret_ok:
131
.ret_ok:
126
	mcall 68,13,[area_for_x]
132
	mcall 68,13,[area_for_x]
127
	mov ebx,[pointer]
133
	mov ebx,[pointer]
128
	mov  eax,[raw_area]
134
	mov  eax,[raw_area]
129
	mov  [ebx+20],eax  ; store RAW pointer
135
	mov  [ebx+20],eax  ; store RAW pointer
130
;	movzx eax,word [new_size.x1]
136
;	movzx eax,word [new_size.x1]
131
;	mov [ebx+24],esi  ;eax
137
;	mov [ebx+24],esi  ;eax
132
;	movzx eax,word [new_size.y1]
138
;	movzx eax,word [new_size.y1]
133
;	mov [ebx+28],eax
139
;	mov [ebx+28],eax
134
;	mov eax,[size_x]
140
;	mov eax,[size_x]
135
;	mov [ebx+32],eax
141
;	mov [ebx+32],eax
136
;	mov eax,[bytes_to_pixel]
142
;	mov eax,[bytes_to_pixel]
137
;	mov [ebx+36],eax
143
;	mov [ebx+36],eax
138
;	mov eax,[x]
144
;	mov eax,[x]
139
;	mov [ebx+40],eax
145
;	mov [ebx+40],eax
140
;	mov eax,[y]
146
;	mov eax,[y]
141
;	mov [ebx+44],eax
147
;	mov [ebx+44],eax
142
.exit:
148
.exit:
143
	popad
149
	popad
144
	ret
150
	ret	24
145
;---------------------------------------------------------------------
151
;---------------------------------------------------------------------
146
align 4
152
align 4
147
.scaling:
153
.scaling:
148
	xor ecx,ecx
154
	xor ecx,ecx
149
.y:
155
.y:
150
	xor ebx,ebx
156
	xor ebx,ebx
151
;-------------------------
157
;-------------------------
152
.x:
158
.x:
153
	call ebp
159
	call ebp
154
	inc  ebx
160
	inc  ebx
155
	cmp  bx,[new_size.x1]
161
	cmp  bx,[new_size.x1]
156
	jb   .x
162
	jb   .x
157
;-------------------------
163
;-------------------------
158
	inc  ecx
164
	inc  ecx
159
	cmp  cx,[new_size.y1]
165
	cmp  cx,[new_size.y1]
160
	jb   .y
166
	jb   .y
161
	ret
167
	ret
162
;---------------------------------------------------------------------
168
;---------------------------------------------------------------------
163
align 4
169
align 4
164
.scaling_2:
170
.scaling_2:
165
	xor  eax,eax
171
	xor  eax,eax
166
	mov  ax,[start_coordinates.y]
172
	mov  ax,[start_coordinates.y]
167
	imul eax,[size_x]
173
	imul eax,[size_x]
168
	add  esi,eax
174
	add  esi,eax
169
	xor  eax,eax
175
	xor  eax,eax
170
	mov  ax,[start_coordinates.x]
176
	mov  ax,[start_coordinates.x]
171
	imul eax,[bytes_to_pixel]
177
	imul eax,[bytes_to_pixel]
172
	add  esi,eax
178
	add  esi,eax
173
	
179
	
174
	xor  eax,eax
180
	xor  eax,eax
175
	dec  eax
181
	dec  eax
176
	mov [temp_y],eax
182
	mov [temp_y],eax
177
	
183
	
178
	xor ecx,ecx
184
	xor ecx,ecx
179
align 4
185
align 4
180
.y_2:
186
.y_2:
181
	xor ebx,ebx
187
	xor ebx,ebx
182
;-------------------------
188
;-------------------------
183
align 4
189
align 4
184
.x_2:
190
.x_2:
185
	call ebp
191
	call ebp
186
	inc  ebx
192
	inc  ebx
187
	cmp  bx,[new_size.x1]
193
	cmp  bx,[new_size.x1]
188
	jb   .x_2
194
	jb   .x_2
189
;-------------------------
195
;-------------------------
190
	inc  ecx
196
	inc  ecx
191
	cmp  cx,[new_size.y1]
197
	cmp  cx,[new_size.y1]
192
	jb   .y_2
198
	jb   .y_2
193
	ret
199
	ret
194
;---------------------------------------------------------------------
200
;---------------------------------------------------------------------
195
align 4
201
align 4
196
.32:
202
.32:
197
	push ecx ebx
203
	push ecx ebx
198
	call .calculate_pixel
204
	call .calculate_pixel
199
	mov  eax,[ecx]
205
	mov  eax,[ecx]
200
	call .check_filtering_32
206
	call .check_filtering_32
201
	pop  ebx ecx
207
	pop  ebx ecx
202
	cld 
208
	cld 
203
	stosd
209
	stosd
204
	ret
210
	ret
205
;---------------------------------------------------------------------
211
;---------------------------------------------------------------------
206
align 4
212
align 4
207
.24:
213
.24:
208
	push ecx ebx
214
	push ecx ebx
209
	call .calculate_pixel
215
	call .calculate_pixel
210
	mov  eax,[ecx]	
216
	mov  eax,[ecx]	
211
	call .check_filtering_24
217
	call .check_filtering_24
212
	cld
218
	cld
213
	stosw
219
	stosw
214
	shr  eax,16	
220
	shr  eax,16	
215
	pop  ebx ecx
221
	pop  ebx ecx
216
	cld
222
	cld
217
	stosb
223
	stosb
218
	ret
224
	ret
219
;---------------------------------------------------------------------
225
;---------------------------------------------------------------------
220
align 4
226
align 4
221
.16:
227
.16:
222
	push ecx ebx
228
	push ecx ebx
223
	call .calculate_pixel
229
	call .calculate_pixel
224
	xor  eax,eax
230
	xor  eax,eax
225
	mov  ax,[ecx]
231
	mov  ax,[ecx]
226
	call .check_filtering_16
232
	call .check_filtering_16
227
	pop  ebx ecx
233
	pop  ebx ecx
228
	cld 
234
	cld 
229
	stosw
235
	stosw
230
	ret
236
	ret
231
;---------------------------------------------------------------------
237
;---------------------------------------------------------------------
232
align 4
238
align 4
233
.8:
239
.8:
234
	push ecx ebx
240
	push ecx ebx
235
	call .calculate_pixel
241
	call .calculate_pixel
236
	cmp  [filtering],0
242
	cmp  [filtering],0
237
	jne   @f
243
	jne   @f
238
	mov  al,[ecx]
244
	mov  al,[ecx]
239
	pop  ebx ecx
245
	pop  ebx ecx
240
	cld
246
	cld
241
	stosb
247
	stosb
242
	ret
248
	ret
243
@@:
249
@@:
244
	call .check_filtering_8
250
	call .check_filtering_8
245
	cld
251
	cld
246
	stosw
252
	stosw
247
	shr  eax,16	
253
	shr  eax,16	
248
	pop  ebx ecx
254
	pop  ebx ecx
249
	cld
255
	cld
250
	stosb
256
	stosb
251
	ret	
257
	ret	
252
	
258
	
253
;---------------------------------------------------------------------
259
;---------------------------------------------------------------------
254
align 4
260
align 4
255
.calculate_pixel:
261
.calculate_pixel:
256
	test ecx,ecx
262
	test ecx,ecx
257
	jz   .offset_x
263
	jz   .offset_x
258
;.offset_y:
264
;.offset_y:
259
	mov  eax,ecx
265
	mov  eax,ecx
260
	
266
	
261
	mov  ecx,[temp_y]
267
	mov  ecx,[temp_y]
262
	cmp  eax,ecx
268
	cmp  eax,ecx
263
	jne  .new_y
269
	jne  .new_y
264
	mov  eax,[temp_y_offset]
270
	mov  eax,[temp_y_offset]
265
	mov  ecx,eax
271
	mov  ecx,eax
266
	jmp  .offset_x
272
	jmp  .offset_x
267
;--------------------------------
273
;--------------------------------
268
align 4
274
align 4
269
.new_y:
275
.new_y:
270
	mov  [temp_y],eax
276
	mov  [temp_y],eax
271
 
277
 
272
	mov  ebx,[scaling_mode]
278
	mov  ebx,[scaling_mode]
273
	test ebx,ebx
279
	test ebx,ebx
274
	jz  @f
280
	jz  @f
275
	imul eax,[scaling_delta]
281
	imul eax,[scaling_delta]
276
;--------------------------------
282
;--------------------------------
277
	push ebx
283
	push ebx
278
	mov  ebx,eax
284
	mov  ebx,eax
279
	shr  eax,12
285
	shr  eax,12
280
	and  ebx,0xFFF
286
	and  ebx,0xFFF
281
	shl  ebx,7  ;multiply 128
287
	shl  ebx,7  ;multiply 128
282
	shr  ebx,12
288
	shr  ebx,12
283
	mov  [next_pixel_y],ebx
289
	mov  [next_pixel_y],ebx
284
	pop  ebx
290
	pop  ebx
285
;--------------------------------
291
;--------------------------------
286
	jmp  .ex_1
292
	jmp  .ex_1
287
align 4
293
align 4
288
@@:
294
@@:
289
;--------------------------------
295
;--------------------------------
290
	imul eax,dword [y]
296
	imul eax,dword [y]
291
	mov bx,word [new_size.y1]
297
	mov bx,word [new_size.y1]
292
;--------------------------------
298
;--------------------------------
293
align 4
299
align 4
294
.y_div:
300
.y_div:
295
	test ebx,ebx
301
	test ebx,ebx
296
	jnz  @f
302
	jnz  @f
297
	inc  ebx
303
	inc  ebx
298
align 4
304
align 4
299
@@:
305
@@:
300
	xor  edx,edx
306
	xor  edx,edx
301
	div  ebx
307
	div  ebx
302
;--------------------------------
308
;--------------------------------
303
	push eax
309
	push eax
304
	mov  eax,edx
310
	mov  eax,edx
305
	shl  eax,7  ;multiply 128
311
	shl  eax,7  ;multiply 128
306
	xor  edx,edx
312
	xor  edx,edx
307
	div  ebx
313
	div  ebx
308
	mov  [next_pixel_y],eax
314
	mov  [next_pixel_y],eax
309
	pop  eax
315
	pop  eax
310
;--------------------------------
316
;--------------------------------
311
align 4
317
align 4
312
.ex_1:
318
.ex_1:
313
	mov  [temp_y1],eax
319
	mov  [temp_y1],eax
314
	imul eax,[size_x]
320
	imul eax,[size_x]
315
 
321
 
316
	mov  [temp_y_offset],eax
322
	mov  [temp_y_offset],eax
317
	mov  ecx,eax
323
	mov  ecx,eax
318
align 4
324
align 4
319
.offset_x:
325
.offset_x:
320
	test ebx,ebx
326
	test ebx,ebx
321
	jz   .finish
327
	jz   .finish
322
	mov  eax,[esp+4]   ;ebx
328
	mov  eax,[esp+4]   ;ebx
323
	
329
	
324
	mov edx,[esp+8]
330
	mov edx,[esp+8]
325
	test edx,edx
331
	test edx,edx
326
	jz  .continue
332
	jz  .continue
327
	shl eax,3
333
	shl eax,3
328
	add eax,[area_for_x]
334
	add eax,[area_for_x]
329
	mov edx,[eax+4]
335
	mov edx,[eax+4]
330
	mov [next_pixel_x],edx
336
	mov [next_pixel_x],edx
331
	mov eax,[eax]
337
	mov eax,[eax]
332
	jmp .ex_3
338
	jmp .ex_3
333
;--------------------------------
339
;--------------------------------
334
align 4
340
align 4
335
.continue:
341
.continue:
336
	mov  ebx,[scaling_mode]
342
	mov  ebx,[scaling_mode]
337
	test ebx,ebx
343
	test ebx,ebx
338
	jz  @f
344
	jz  @f
339
	imul eax,[scaling_delta]
345
	imul eax,[scaling_delta]
340
;--------------------------------
346
;--------------------------------
341
	mov  ebx,eax
347
	mov  ebx,eax
342
	shr  eax,12
348
	shr  eax,12
343
	and  ebx,0xFFF
349
	and  ebx,0xFFF
344
	shl  ebx,7  ;multiply 128
350
	shl  ebx,7  ;multiply 128
345
	shr  ebx,12
351
	shr  ebx,12
346
	mov  [next_pixel_x],ebx
352
	mov  [next_pixel_x],ebx
347
;--------------------------------
353
;--------------------------------
348
	jmp  .ex_2
354
	jmp  .ex_2
349
;--------------------------------
355
;--------------------------------
350
align 4
356
align 4
351
@@:
357
@@:
352
	imul eax,dword [x]
358
	imul eax,dword [x]
353
	mov  bx,word [new_size.x1]
359
	mov  bx,word [new_size.x1]
354
;--------------------------------
360
;--------------------------------
355
align 4
361
align 4
356
.x_div:
362
.x_div:
357
	test ebx,ebx
363
	test ebx,ebx
358
	jnz  @f
364
	jnz  @f
359
	inc  ebx
365
	inc  ebx
360
align 4
366
align 4
361
@@:
367
@@:
362
	xor  edx,edx
368
	xor  edx,edx
363
	div  ebx
369
	div  ebx
364
;--------------------------------
370
;--------------------------------
365
	push eax
371
	push eax
366
	mov  eax,edx
372
	mov  eax,edx
367
	shl  eax,7  ;multiply 128
373
	shl  eax,7  ;multiply 128
368
	xor  edx,edx
374
	xor  edx,edx
369
	div  ebx
375
	div  ebx
370
	mov  [next_pixel_x],eax
376
	mov  [next_pixel_x],eax
371
	pop  eax
377
	pop  eax
372
;--------------------------------
378
;--------------------------------
373
align 4
379
align 4
374
.ex_2:
380
.ex_2:
375
	mov  edx,[bytes_to_pixel]
381
	mov  edx,[bytes_to_pixel]
376
	mov  ebx,eax
382
	mov  ebx,eax
377
	xor  eax,eax
383
	xor  eax,eax
378
align 4
384
align 4
379
@@:
385
@@:
380
	add eax,ebx
386
	add eax,ebx
381
	dec  edx
387
	dec  edx
382
	jnz   @r
388
	jnz   @r
383
	
389
	
384
	mov ebx,[esp+4]
390
	mov ebx,[esp+4]
385
	shl ebx,3
391
	shl ebx,3
386
	add ebx,[area_for_x]
392
	add ebx,[area_for_x]
387
	mov [ebx],eax
393
	mov [ebx],eax
388
	mov edx,[next_pixel_x]
394
	mov edx,[next_pixel_x]
389
	mov [ebx+4],edx
395
	mov [ebx+4],edx
390
align 4
396
align 4
391
.ex_3:
397
.ex_3:
392
	mov [temp_x1],eax
398
	mov [temp_x1],eax
393
	add  ecx,eax
399
	add  ecx,eax
394
align 4
400
align 4
395
.finish:
401
.finish:
396
	add  ecx,esi
402
	add  ecx,esi
397
	ret
403
	ret
398
;---------------------------------------------------------------------
404
;---------------------------------------------------------------------
399
align 4
405
align 4
400
.get_memory:
406
.get_memory:
401
 
407
 
402
	xor  ecx,ecx
408
	xor  ecx,ecx
403
	mov  cx,[new_size.x1]
409
	mov  cx,[new_size.x1]
404
	shl  ecx,3
410
	shl  ecx,3
405
	mcall 68,12
411
	mcall 68,12
406
	mov  [area_for_x],eax
412
	mov  [area_for_x],eax
407
	
413
	
408
	xor   ecx,ecx
414
	xor   ecx,ecx
409
	mov   ebx,[new_size]
415
	mov   ebx,[new_size]
410
	mov   cx,bx
416
	mov   cx,bx
411
	shr   ebx,16
417
	shr   ebx,16
412
	imul ecx,ebx  ;[eax+8]
418
	imul ecx,ebx  ;[eax+8]
413
	mov  eax,[bytes_to_pixel]
419
	mov  eax,[bytes_to_pixel]
414
	cmp  eax,1
420
	cmp  eax,1
415
	jne  @f
421
	jne  @f
416
	mov  eax,3
422
	mov  eax,3
417
@@:
423
@@:
418
	imul ecx,eax
424
	imul ecx,eax
419
	mcall 68,12
425
	mcall 68,12
420
	mov  [raw_area],eax
426
	mov  [raw_area],eax
421
	mov  edi,eax
427
	mov  edi,eax
422
	ret
428
	ret
423
;---------------------------------------------------------------------
429
;---------------------------------------------------------------------
424
include 'b_filter.inc'
430
include 'b_filter.inc'
425
;---------------------------------------------------------------------
431
;---------------------------------------------------------------------
426
align 4
432
align 4
427
EXPORTS:
433
EXPORTS:
428
	dd      szStart,	START
434
	dd      szStart,	START
429
	dd      szVersion,	0x00010001
435
	dd      szVersion,	0x00010002
430
	dd      0
436
	dd      0
431
 
437
 
432
szStart		db 'START',0
438
szStart		db 'START',0
433
szVersion	db 'version',0
439
szVersion	db 'version',0
434
 
440
 
435
align 4
441
align 4
436
pointer		dd 0
442
pointer		dd 0
437
image_file	dd 0
443
image_file	dd 0
438
new_size:
444
new_size:
439
.y1:			dw 0
445
.y1:			dw 0
440
.x1:			dw 0
446
.x1:			dw 0
441
 
447
 
442
x:  dd 0
448
x:  dd 0
443
y:  dd 0
449
y:  dd 0
444
 
450
 
445
size_x		dd 0
451
size_x		dd 0
446
bytes_to_pixel dd 0
452
bytes_to_pixel dd 0
447
 
453
 
448
start_coordinates:
454
start_coordinates:
449
.y	dw 0
455
.y	dw 0
450
.x	dw 0
456
.x	dw 0
451
 
457
 
452
scaling_mode	dd 0
458
scaling_mode	dd 0
453
raw_area	dd 0
459
raw_area	dd 0
454
scaling_delta dd 0
460
scaling_delta dd 0
455
 
461
 
456
area_for_x dd 0
462
area_for_x dd 0
457
 
463
 
458
temp_y dd 0
464
temp_y dd 0
459
temp_y_offset dd 0
465
temp_y_offset dd 0
460
 
466
 
461
resolution dd 0
467
resolution dd 0
462
 
468
 
463
filtering dd 0
469
filtering dd 0
464
 
470
 
465
next_pixel_y dd 0
471
next_pixel_y dd 0
466
next_pixel_x dd 0
472
next_pixel_x dd 0
467
 
473
 
468
temp_y1 dd 0
474
temp_y1 dd 0
469
temp_x1 dd 0
475
temp_x1 dd 0
470
 
476
 
471
B_sample dd 0
477
B_sample dd 0
472
G_sample dd 0
478
G_sample dd 0
473
R_sample dd 0
479
R_sample dd 0
474
 
480
 
475
B_sample_1 dd 0
481
B_sample_1 dd 0
476
G_sample_1 dd 0
482
G_sample_1 dd 0
477
R_sample_1 dd 0
483
R_sample_1 dd 0
478
 
484
 
479
palette dd 0
485
palette dd 0
480
 
486
 
481
background_color dd 0
487
background_color dd 0