Subversion Repositories Kolibri OS

Rev

Rev 8449 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8449 Rev 8463
Line 1176... Line 1176...
1176
endl
1176
endl
1177
	mov ebx,[_img]
1177
	mov ebx,[_img]
1178
	mov	eax,[ebx+Image.Type]
1178
	mov	eax,[ebx+Image.Type]
1179
	cmp	eax,Image.bpp24
1179
	cmp	eax,Image.bpp24
1180
	je @f
1180
	je @f
-
 
1181
	cmp	eax,Image.bpp32
-
 
1182
	jne .error
1181
		mov	ecx,LIBIMG_ERROR_BIT_DEPTH
1183
		mov	ecx,LIBIMG_ERROR_BIT_DEPTH
1182
		jmp	.error
-
 
1183
	@@:
1184
	@@:
Line 1184... Line -...
1184
 
-
 
1185
	mov edx,ebp
1185
 
1186
	sub edx,sizeof.png_image
1186
	lea edx,[ebp-sizeof.png_image]
1187
	mov dword[edx+png_image.version],PNG_IMAGE_VERSION
1187
	mov dword[edx+png_image.version],PNG_IMAGE_VERSION
1188
	mov ecx,[ebx+Image.Width]
1188
	mov ecx,[ebx+Image.Width]
-
 
1189
	mov [edx+png_image.width],ecx ;Image width in pixels (columns)
-
 
1190
	cmp	eax,Image.bpp24
-
 
1191
	jne @f
-
 
1192
		mov dword[edx+png_image.format],PNG_FORMAT_RGB
-
 
1193
		imul ecx,3
-
 
1194
	@@:
-
 
1195
	cmp	eax,Image.bpp32
-
 
1196
	jne @f
-
 
1197
		mov dword[edx+png_image.format],PNG_FORMAT_RGBA
-
 
1198
		shl ecx,2
1189
	mov [edx+png_image.width],ecx ;Image width in pixels (columns)
1199
	@@:
1190
	mov eax,[ebx+Image.Height]
1200
	mov eax,[ebx+Image.Height]
1191
	mov [edx+png_image.height],eax ;Image height in pixels (rows)
-
 
1192
	mov dword[edx+png_image.format],PNG_COLOR_TYPE_RGB
1201
	mov [edx+png_image.height],eax ;Image height in pixels (rows)
Line 1193... Line -...
1193
	;mov dword[edx+png_image.flags],PNG_IMAGE_FLAG_???
-
 
1194
 
1202
	;mov dword[edx+png_image.flags],PNG_IMAGE_FLAG_???
1195
	imul ecx,3
1203
 
1196
	mov edi,ecx
1204
	mov edi,ecx
1197
	imul edi,[ebx+Image.Height]
1205
	imul edi,[ebx+Image.Height]
1198
	cmp edi,4096
1206
	cmp edi,4096
Line 1205... Line 1213...
1205
	jnz	@f
1213
	jnz	@f
1206
		mov	ecx,LIBIMG_ERROR_OUT_OF_MEMORY
1214
		mov	ecx,LIBIMG_ERROR_OUT_OF_MEMORY
1207
		jmp	.error
1215
		jmp	.error
1208
    @@:
1216
    @@:
1209
	mov [encoded_file],eax
1217
	mov [encoded_file],eax
1210
	mov edi,edx
1218
	lea edi,[edx-4]
1211
	sub edi,4
-
 
1212
	stdcall png_image_write_to_memory, edx,eax,edi,0,[ebx+Image.Data],ecx,0
1219
	stdcall png_image_write_to_memory, edx,eax,edi,0,[ebx+Image.Data],ecx,0
1213
	mov	eax,[encoded_file]
1220
	mov	eax,[encoded_file]
1214
	mov	ecx,[encoded_file_size]
1221
	mov	ecx,[encoded_file_size]
1215
	jmp	.quit
1222
	jmp	.quit