Subversion Repositories Kolibri OS

Rev

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

Rev 3056 Rev 6807
Line 15... Line 15...
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
;;================================================================================================;;
Line -... Line 19...
-
 
19
 
-
 
20
 
19
 
21
 
20
;;================================================================================================;;
22
;;================================================================================================;;
21
proc img.convert _src, _dst, _dst_type, _flags, _param                                            ;;
23
proc img.convert _src, _dst, _dst_type, _flags, _param                                            ;;
22
;;------------------------------------------------------------------------------------------------;;
24
;;------------------------------------------------------------------------------------------------;;
-
 
25
;? convert _image                                                                                 ;;
-
 
26
;;------------------------------------------------------------------------------------------------;;
-
 
27
;> [_src]      = pointer to source image                                                          ;;
-
 
28
;> [_dst]      = pointer to destination image, or 0 to create a new one                           ;;
-
 
29
;> [_dst_type] = Image.Type of resulting image                                                    ;;
-
 
30
;> [_flags]    = see libimg.inc                                                                   ;;
-
 
31
;> [_param]    = depends on _flags fields, see libimg.inc                                         ;;
-
 
32
;;------------------------------------------------------------------------------------------------;;
-
 
33
;< eax = 0 / pointer to converted image                                                           ;;
-
 
34
;< ecx = error code / undefined                                                                   ;;
-
 
35
;;================================================================================================;;
-
 
36
        push    ebx esi edi 0 0
-
 
37
        mov     ebx, [_src]
-
 
38
    @@:
-
 
39
        mov     eax, [ebx + Image.Previous]
-
 
40
        test    eax, eax
-
 
41
        jz      .loop
-
 
42
        mov     ebx, eax
-
 
43
        jmp     @b
-
 
44
  .loop:
-
 
45
        stdcall img.convert.layer, ebx, [_dst], [_dst_type], [_flags], [_param]
-
 
46
        test    eax, eax
-
 
47
        jz      .error
-
 
48
        cmp     dword[esp + 4], 0
-
 
49
        jnz     @f
-
 
50
        mov     [esp + 4], eax
-
 
51
    @@:
-
 
52
        mov     ecx, [esp]
-
 
53
        jecxz   @f
-
 
54
        mov     [ecx + Image.Next], eax
-
 
55
    @@:
-
 
56
	push	[ebx + Image.Flags]
-
 
57
	pop	[eax + Image.Flags]
-
 
58
	push	[ebx + Image.Delay]
-
 
59
	pop	[eax + Image.Delay]
-
 
60
        mov     [eax + Image.Previous], ecx
-
 
61
        mov     [esp], eax
-
 
62
        mov     ebx, [ebx + Image.Next]
-
 
63
        test    ebx, ebx
-
 
64
        jnz     .loop
-
 
65
  .quit:
-
 
66
        pop     eax eax edi esi ebx
-
 
67
        ret
-
 
68
  .error:
-
 
69
        pop     eax eax edi esi ebx
-
 
70
        ret
-
 
71
endp
-
 
72
 
-
 
73
 
-
 
74
;;================================================================================================;;
-
 
75
proc img.convert.layer _src, _dst, _dst_type, _flags, _param                                      ;;
-
 
76
;;------------------------------------------------------------------------------------------------;;
23
;? scale _image                                                                                   ;;
77
;? convert _image layer                                                                           ;;
24
;;------------------------------------------------------------------------------------------------;;
78
;;------------------------------------------------------------------------------------------------;;
-
 
79
;> [_src]      = pointer to source image                                                          ;;
-
 
80
;> [_dst]      = pointer to destination image, or 0 to create a new one                           ;;
25
;> [_src]      = pointer to source image                                                          ;;
81
;> [_dst_type] = Image.Type of resulting image                                                    ;;
26
;> [_flags]    = see libimg.inc                                                                   ;;
-
 
27
;> [_dst_type] = the Image.Type of converted image                                                ;;
82
;> [_flags]    = see libimg.inc                                                                   ;;
28
;> [_dst]      = pointer to destination image, if any                                             ;;
83
;> [_param]    = depends on _flags fields, see libimg.inc                                         ;;
29
;;------------------------------------------------------------------------------------------------;;
84
;;------------------------------------------------------------------------------------------------;;
30
;< eax = 0 / pointer to converted image                                                           ;;
85
;< eax = 0 / pointer to converted image                                                           ;;
31
;< ecx = error code / undefined                                                                   ;;
86
;< ecx = error code / undefined                                                                   ;;
32
;;================================================================================================;;
87
;;================================================================================================;;
33
locals
88
locals
34
	width	rd 1
89
	width	rd 1
35
	height	rd 1
90
	height	rd 1
-
 
91
endl
-
 
92
        push    ebx esi edi
36
endl
93
 
37
	mov	ebx, [_src]
94
	mov	ebx, [_src]
38
	mov	eax, 1
95
	mov	eax, 1
39
	mov	ecx, [_dst_type]
96
	mov	ecx, [_dst_type]
40
	shl	eax, cl
97
	shl	eax, cl
Line 149... Line 206...
149
	dec	edx
206
	dec	edx
150
	jnz	.bpp8g_to_bpp1.line
207
	jnz	.bpp8g_to_bpp1.line
151
	mov	eax, [_dst]
208
	mov	eax, [_dst]
152
	jmp	.quit
209
	jmp	.quit
Line -... Line 210...
-
 
210
 
-
 
211
  .bpp8g_to_bpp8g:
-
 
212
	mov	ecx, [ebx + Image.Width]
-
 
213
	imul	ecx, [ebx + Image.Height]
-
 
214
	rep	movsb
-
 
215
	mov	eax, [_dst]
-
 
216
	jmp	.quit
153
 
217
 
154
  .bpp8g_to_bpp24:
218
  .bpp8g_to_bpp24:
155
	mov	ecx, [ebx + Image.Width]
219
	mov	ecx, [ebx + Image.Width]
156
	imul	ecx, [ebx + Image.Height]
220
	imul	ecx, [ebx + Image.Height]
157
    @@:
221
    @@:
Line 197... Line 261...
197
	add	edi, 1
261
	add	edi, 1
198
	sub	ecx, 1
262
	sub	ecx, 1
199
	jnz	@b
263
	jnz	@b
200
	mov	eax, [_dst]
264
	mov	eax, [_dst]
201
	jmp	.quit
265
	jmp	.quit
-
 
266
  .bpp24_to_bpp32:
-
 
267
	mov	ecx, [ebx + Image.Width]
-
 
268
	imul	ecx, [ebx + Image.Height]
-
 
269
    @@:
-
 
270
        lodsw
-
 
271
        ror     eax, 16
-
 
272
        lodsb
-
 
273
        rol     eax, 16
-
 
274
        stosd
-
 
275
        dec     ecx
-
 
276
        jnz     @b
-
 
277
	mov	eax, [_dst]
-
 
278
	jmp	.quit
Line 202... Line 279...
202
 
279
 
203
 
280
 
204
  .bpp32:
281
  .bpp32:
Line 559... Line 636...
559
 
636
 
560
 
637
 
561
  .error:
638
  .error:
-
 
639
	xor	eax, eax
562
	xor	eax, eax
640
  .quit:
563
  .quit:
641
        pop     edi esi ebx
Line 564... Line 642...
564
	ret
642
	ret
565
endp
643
endp
566
 
644
 
567
 
645
 
-
 
646
img.convert.bpp8i.table:
568
img.convert.bpp8i.table:
647
	dd Image.bpp24, img.convert.layer.bpp8i_to_bpp24
569
	dd Image.bpp24, img.convert.bpp8i_to_bpp24
648
img.convert.bpp8g.table:
570
img.convert.bpp8g.table:
649
	dd Image.bpp24, img.convert.layer.bpp8g_to_bpp24
571
	dd Image.bpp24, img.convert.bpp8g_to_bpp24
650
	dd Image.bpp8g, img.convert.layer.bpp8g_to_bpp8g
-
 
651
	dd Image.bpp1,  img.convert.layer.bpp8g_to_bpp1
572
	dd Image.bpp1,  img.convert.bpp8g_to_bpp1
652
img.convert.bpp24.table:
573
img.convert.bpp24.table:
653
	dd Image.bpp24, img.convert.layer.bpp24_to_bpp24
574
	dd Image.bpp24, img.convert.bpp24_to_bpp24
654
	dd Image.bpp8g, img.convert.layer.bpp24_to_bpp8g
575
	dd Image.bpp8g, img.convert.bpp24_to_bpp8g
655
	dd Image.bpp32, img.convert.layer.bpp24_to_bpp32
576
img.convert.bpp32.table:
656
img.convert.bpp32.table:
577
	dd Image.bpp24, img.convert.bpp32_to_bpp24
657
	dd Image.bpp24, img.convert.layer.bpp32_to_bpp24
578
img.convert.bpp15.table:
658
img.convert.bpp15.table:
579
	dd Image.bpp24, img.convert.bpp15_to_bpp24
659
	dd Image.bpp24, img.convert.layer.bpp15_to_bpp24
580
img.convert.bpp16.table:
660
img.convert.bpp16.table:
581
	dd Image.bpp24, img.convert.bpp16_to_bpp24
661
	dd Image.bpp24, img.convert.layer.bpp16_to_bpp24