Subversion Repositories Kolibri OS

Rev

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

Rev 2692 Rev 2733
Line 226... Line 226...
226
    imul    ecx, [esi + Image.Height]
226
    imul    ecx, [esi + Image.Height]
227
    mov eax, [esi + Image.Type]
227
    mov eax, [esi + Image.Type]
228
    jmp dword [.handlers + (eax-1)*4]
228
    jmp dword [.handlers + (eax-1)*4]
Line 229... Line 229...
229
 
229
 
230
align 16
230
align 16
231
.bpp8:
231
.bpp8i:
232
; 8 BPP -> 24 BPP
232
; 8 BPP WITH PALETTE -> 24 BPP
233
    push    ebx
233
    push    ebx
234
    mov ebx, [esi + Image.Palette]
234
    mov ebx, [esi + Image.Palette]
235
    mov esi, [esi + Image.Data]
235
    mov esi, [esi + Image.Data]
236
    sub ecx, 1
236
    sub ecx, 1
237
    jz  .bpp8.last
237
    jz  .bpp8i.last
238
@@:
238
@@:
239
    movzx   eax, byte [esi]
239
    movzx   eax, byte [esi]
240
    add esi, 1
240
    add esi, 1
241
    mov eax, [ebx + eax*4]
241
    mov eax, [ebx + eax*4]
242
    mov [edi], eax
242
    mov [edi], eax
243
    add edi, 3
243
    add edi, 3
244
    sub ecx, 1
244
    sub ecx, 1
245
    jnz @b
245
    jnz @b
246
.bpp8.last:
246
.bpp8i.last:
247
    movzx   eax, byte [esi]
247
    movzx   eax, byte [esi]
248
    mov eax, [ebx + eax*4]
248
    mov eax, [ebx + eax*4]
249
    mov [edi], ax
249
    mov [edi], ax
250
    shr eax, 16
250
    shr eax, 16
251
    mov [edi+2], al
251
    mov [edi+2], al
252
    pop ebx
252
    pop ebx
Line -... Line 253...
-
 
253
    ret
-
 
254
 
-
 
255
align 16
-
 
256
.bpp8g:
-
 
257
; 8 BPP GRAYSCALE -> 24 BPP
-
 
258
    mov esi, [esi + Image.Data]
-
 
259
@@:
-
 
260
    lodsb
-
 
261
    mov ah, al
-
 
262
    stosb
-
 
263
    stosw
-
 
264
    dec ecx
-
 
265
    jnz @b
-
 
266
    ret
-
 
267
;
-
 
268
;align 16
-
 
269
;.bpp8a: ; considered application layer, may be changed in the future
-
 
270
;; 8a BPP -> 24 BPP
-
 
271
;    mov esi, [esi + Image.Data]
-
 
272
;@@:
-
 
273
;    lodsw
-
 
274
;    mov ah, al
-
 
275
;    stosb
-
 
276
;    stosw
-
 
277
;    dec ecx
-
 
278
;    jnz @b
253
    ret
279
;    ret
254
 
280
 
255
; 15 BPP -> 24 BPP
281
; 15 BPP -> 24 BPP
256
.bpp15.intel:
282
.bpp15.intel:
257
    push    ebx ebp
283
    push    ebx ebp
Line 970... Line 996...
970
    add edi, [scanline_len]
996
    add edi, [scanline_len]
971
    dec ecx
997
    dec ecx
972
    jnz .next_line_horz1x
998
    jnz .next_line_horz1x
973
    jmp .exit
999
    jmp .exit
Line 974... Line 1000...
974
 
1000
 
975
.bpp8_horz:
1001
.bpp8ig_horz:
976
    dec edi
1002
    dec edi
977
  .next_line_horz8:
1003
  .next_line_horz8ig:
Line 978... Line 1004...
978
    push    ecx esi edi
1004
    push    ecx esi edi
979
 
1005
 
980
    mov ecx, [scanline_len]
1006
    mov ecx, [scanline_len]
Line 990... Line 1016...
990
 
1016
 
991
    pop edi esi ecx
1017
    pop edi esi ecx
992
    add esi, [scanline_len]
1018
    add esi, [scanline_len]
993
    add edi, [scanline_len]
1019
    add edi, [scanline_len]
994
    dec ecx
1020
    dec ecx
995
    jnz .next_line_horz8
1021
    jnz .next_line_horz8ig
Line 996... Line 1022...
996
    jmp .exit
1022
    jmp .exit
997
 
1023
 
998
.bpp24_horz:
1024
.bpp24_horz:
Line 1178... Line 1204...
1178
    add eax, [ebx + Image.Data]
1204
    add eax, [ebx + Image.Data]
1179
    mov [pixels_ptr], eax
1205
    mov [pixels_ptr], eax
Line 1180... Line 1206...
1180
 
1206
 
1181
    cmp [ebx + Image.Type], Image.bpp1
1207
    cmp [ebx + Image.Type], Image.bpp1
1182
    jz  .rotate_ccw1
1208
    jz  .rotate_ccw1
-
 
1209
    cmp [ebx + Image.Type], Image.bpp8i
-
 
1210
    jz  .rotate_ccw8ig
1183
    cmp [ebx + Image.Type], Image.bpp8
1211
    cmp [ebx + Image.Type], Image.bpp8g
1184
    jz  .rotate_ccw8
1212
    jz  .rotate_ccw8ig
1185
    cmp [ebx + Image.Type], Image.bpp24
1213
    cmp [ebx + Image.Type], Image.bpp24
1186
    jz  .rotate_ccw24
1214
    jz  .rotate_ccw24
1187
    cmp [ebx + Image.Type], Image.bpp32
1215
    cmp [ebx + Image.Type], Image.bpp32
Line 1271... Line 1299...
1271
    rep movsd
1299
    rep movsd
Line 1272... Line 1300...
1272
 
1300
 
1273
    pop ecx
1301
    pop ecx
Line 1274... Line 1302...
1274
    jmp .next_column_ccw_low
1302
    jmp .next_column_ccw_low
1275
 
1303
 
1276
.rotate_ccw8:
1304
.rotate_ccw8ig:
1277
  .next_column_ccw_low8:
1305
  .next_column_ccw_low8ig:
1278
    dec ecx
1306
    dec ecx
Line 1279... Line 1307...
1279
    js  .exchange_dims
1307
    js  .exchange_dims
Line 1317... Line 1345...
1317
    mov ecx, edx
1345
    mov ecx, edx
1318
    and ecx, 3
1346
    and ecx, 3
1319
    rep movsb
1347
    rep movsb
Line 1320... Line 1348...
1320
 
1348
 
1321
    pop ecx
1349
    pop ecx
Line 1322... Line 1350...
1322
    jmp .next_column_ccw_low8
1350
    jmp .next_column_ccw_low8ig
1323
 
1351
 
1324
.rotate_ccw24:
1352
.rotate_ccw24:
1325
  .next_column_ccw_low24:
1353
  .next_column_ccw_low24:
Line 1470... Line 1498...
1470
    add eax, [ebx + Image.Data]
1498
    add eax, [ebx + Image.Data]
1471
    mov [pixels_ptr], eax
1499
    mov [pixels_ptr], eax
Line 1472... Line 1500...
1472
 
1500
 
1473
    cmp [ebx + Image.Type], Image.bpp1
1501
    cmp [ebx + Image.Type], Image.bpp1
1474
    jz  .rotate_cw1
1502
    jz  .rotate_cw1
-
 
1503
    cmp [ebx + Image.Type], Image.bpp8i
-
 
1504
    jz  .rotate_cw8ig
1475
    cmp [ebx + Image.Type], Image.bpp8
1505
    cmp [ebx + Image.Type], Image.bpp8g
1476
    jz  .rotate_cw8
1506
    jz  .rotate_cw8ig
1477
    cmp [ebx + Image.Type], Image.bpp24
1507
    cmp [ebx + Image.Type], Image.bpp24
1478
    jz  .rotate_cw24
1508
    jz  .rotate_cw24
1479
    cmp [ebx + Image.Type], Image.bpp32
1509
    cmp [ebx + Image.Type], Image.bpp32
Line 1568... Line 1598...
1568
    rep movsd
1598
    rep movsd
Line 1569... Line 1599...
1569
 
1599
 
1570
    pop ecx
1600
    pop ecx
Line 1571... Line 1601...
1571
    jmp .next_column_cw_low
1601
    jmp .next_column_cw_low
1572
 
1602
 
1573
.rotate_cw8:
1603
.rotate_cw8ig:
1574
  .next_column_cw_low8:
1604
  .next_column_cw_low8ig:
1575
    dec ecx
1605
    dec ecx
Line 1576... Line 1606...
1576
    js  .exchange_dims
1606
    js  .exchange_dims
Line 1616... Line 1646...
1616
    mov ecx, eax
1646
    mov ecx, eax
1617
    and ecx, 3
1647
    and ecx, 3
1618
    rep movsb
1648
    rep movsb
Line 1619... Line 1649...
1619
 
1649
 
1620
    pop ecx
1650
    pop ecx
Line 1621... Line 1651...
1621
    jmp .next_column_cw_low8
1651
    jmp .next_column_cw_low8ig
1622
 
1652
 
1623
.rotate_cw24:
1653
.rotate_cw24:
1624
  .next_column_cw_low24:
1654
  .next_column_cw_low24:
Line 1887... Line 1917...
1887
  .jpg  dd LIBIMG_FORMAT_ID_JPEG, img.is.jpg,  img.decode.jpg,     img.encode.jpg, 0
1917
  .jpg  dd LIBIMG_FORMAT_ID_JPEG, img.is.jpg,  img.decode.jpg,     img.encode.jpg, 0
1888
  .tga  dd LIBIMG_FORMAT_ID_TGA,  img.is.tga,  img.decode.tga,     img.encode.tga, 0
1918
  .tga  dd LIBIMG_FORMAT_ID_TGA,  img.is.tga,  img.decode.tga,     img.encode.tga, 0
1889
  .pcx  dd LIBIMG_FORMAT_ID_PCX,  img.is.pcx,  img.decode.pcx,     img.encode.pcx, 0
1919
  .pcx  dd LIBIMG_FORMAT_ID_PCX,  img.is.pcx,  img.decode.pcx,     img.encode.pcx, 0
1890
  .xcf  dd LIBIMG_FORMAT_ID_XCF,  img.is.xcf,  img.decode.xcf,     img.encode.xcf, 0
1920
  .xcf  dd LIBIMG_FORMAT_ID_XCF,  img.is.xcf,  img.decode.xcf,     img.encode.xcf, 0
1891
  .tiff dd LIBIMG_FORMAT_ID_TIFF, img.is.tiff, img.decode.tiff,    img.encode.tiff,0
1921
  .tiff dd LIBIMG_FORMAT_ID_TIFF, img.is.tiff, img.decode.tiff,    img.encode.tiff,0
1892
  .pnm  dd LIBIMG_FORMAT_ID_PNM,  img.is.pnm,  img.decode.pnm,     img.encode.pnm, 1 + (1 SHL Image.bpp1) + (1 SHL Image.bpp8) + (1 SHL Image.bpp24)
1922
  .pnm  dd LIBIMG_FORMAT_ID_PNM,  img.is.pnm,  img.decode.pnm,     img.encode.pnm, 1 + (1 SHL Image.bpp1) + (1 SHL Image.bpp8g) + (1 SHL Image.bpp24)
1893
  .wbmp dd LIBIMG_FORMAT_ID_WBMP, img.is.wbmp, img.decode.wbmp,    img.encode.wbmp,0
1923
  .wbmp dd LIBIMG_FORMAT_ID_WBMP, img.is.wbmp, img.decode.wbmp,    img.encode.wbmp,0
1894
  .z80  dd LIBIMG_FORMAT_ID_Z80,  img.is.z80,  img.decode.z80,     img.encode.z80, 0 ;this must be the last entry as there are no signatures in z80 screens at all
1924
  .z80  dd LIBIMG_FORMAT_ID_Z80,  img.is.z80,  img.decode.z80,     img.encode.z80, 0 ;this must be the last entry as there are no signatures in z80 screens at all
1895
        dd 0
1925
        dd 0
Line 1896... Line 1926...
1896
 
1926
 
Line 1987... Line 2017...
1987
; do not allow images which require too many memory
2017
; do not allow images which require too many memory
1988
    cmp eax, 4000000h
2018
    cmp eax, 4000000h
1989
    jae .error
2019
    jae .error
1990
    cmp [ebx + Image.Type], Image.bpp1
2020
    cmp [ebx + Image.Type], Image.bpp1
1991
    jz  .bpp1
2021
    jz  .bpp1
1992
    cmp [ebx + Image.Type], Image.bpp8
2022
    cmp [ebx + Image.Type], Image.bpp8i
-
 
2023
    jz  .bpp8i
-
 
2024
    cmp [ebx + Image.Type], Image.bpp8g
-
 
2025
    jz  .bpp8g
-
 
2026
    cmp [ebx + Image.Type], Image.bpp8a
1993
    jz  .bpp8
2027
    jz  .bpp8a
1994
    cmp [ebx + Image.Type], Image.bpp24
2028
    cmp [ebx + Image.Type], Image.bpp24
1995
    jz  .bpp24
2029
    jz  .bpp24
1996
.bpp32:
2030
.bpp32:
1997
    shl eax, 2
2031
    shl eax, 2
1998
    jmp @f
2032
    jmp @f
1999
.bpp24:
2033
.bpp24:
2000
    lea eax, [eax*3]
2034
    lea eax, [eax*3]
2001
    jmp @f
2035
    jmp @f
2002
.bpp8:
2036
.bpp8i:
2003
    add eax, 256*4  ; for palette
2037
    add eax, 256*4  ; for palette
-
 
2038
.bpp8g:
-
 
2039
    jmp @f
-
 
2040
.bpp8a:
-
 
2041
    shl eax, 1
2004
    jmp @f
2042
    jmp @f
2005
.bpp1:
2043
.bpp1:
2006
    mov eax, [_width]
2044
    mov eax, [_width]
2007
    add eax, 7
2045
    add eax, 7
2008
    shr eax, 3
2046
    shr eax, 3
Line 2038... Line 2076...
2038
    mov [ebx + Image.Data], eax
2076
    mov [ebx + Image.Data], eax
2039
    push    [_width]
2077
    push    [_width]
2040
    pop [ebx + Image.Width]
2078
    pop [ebx + Image.Width]
2041
    push    [_height]
2079
    push    [_height]
2042
    pop [ebx + Image.Height]
2080
    pop [ebx + Image.Height]
2043
    cmp [ebx + Image.Type], Image.bpp8
2081
    cmp [ebx + Image.Type], Image.bpp8i
2044
    jnz @f
2082
    jnz @f
2045
    lea esi, [eax + esi - 256*4]
2083
    lea esi, [eax + esi - 256*4]
2046
    mov [ebx + Image.Palette], esi
2084
    mov [ebx + Image.Palette], esi
2047
    jmp .ret
2085
    jmp .ret
2048
@@:
2086
@@:
Line 2068... Line 2106...
2068
;;------------------------------------------------------------------------------------------------;;
2106
;;------------------------------------------------------------------------------------------------;;
2069
;< --- TBD ---                                                                                    ;;
2107
;< --- TBD ---                                                                                    ;;
2070
;;================================================================================================;;
2108
;;================================================================================================;;
2071
    cmp [ebx + Image.Type], Image.bpp1
2109
    cmp [ebx + Image.Type], Image.bpp1
2072
    jz  .bpp1.1
2110
    jz  .bpp1.1
2073
    cmp [ebx + Image.Type], Image.bpp8
2111
    cmp [ebx + Image.Type], Image.bpp8i
2074
    jz  .bpp8.1
2112
    jz  .bpp8.1
-
 
2113
    cmp [ebx + Image.Type], Image.bpp8g
-
 
2114
    jz  .bpp8.1
-
 
2115
    cmp [ebx + Image.Type], Image.bpp8a
-
 
2116
    jz  .bpp8a.1
2075
    cmp [ebx + Image.Type], Image.bpp24
2117
    cmp [ebx + Image.Type], Image.bpp24
2076
    jz  .bpp24.1
2118
    jz  .bpp24.1
2077
    add eax, eax
2119
    add eax, eax
2078
    cmp [ebx + Image.Type], Image.bpp32
2120
    cmp [ebx + Image.Type], Image.bpp32
2079
    jnz .quit
2121
    jnz .quit
Line 2083... Line 2125...
2083
    lea eax, [eax*3]
2125
    lea eax, [eax*3]
2084
    jmp .quit
2126
    jmp .quit
2085
.bpp1.1:
2127
.bpp1.1:
2086
    add eax, 7
2128
    add eax, 7
2087
    shr eax, 3
2129
    shr eax, 3
-
 
2130
    jmp .quit
-
 
2131
.bpp8a.1:
-
 
2132
    shl eax, 1
2088
.bpp8.1:
2133
.bpp8.1:
2089
.quit:
2134
.quit:
2090
    ret
2135
    ret
Line 2097... Line 2142...
2097
;;================================================================================================;;
2142
;;================================================================================================;;
2098
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
2143
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
2099
;;================================================================================================;;
2144
;;================================================================================================;;
Line 2100... Line 2145...
2100
 
2145
 
2101
align 4
2146
align 4
2102
type2bpp    dd  8, 24, 32, 15, 16, 1
2147
type2bpp    dd  8, 24, 32, 15, 16, 1, 9 ;,16
2103
img._.do_rgb.handlers:
2148
img._.do_rgb.handlers:
2104
    dd  img._.do_rgb.bpp8
2149
    dd  img._.do_rgb.bpp8i
2105
    dd  img._.do_rgb.bpp24
2150
    dd  img._.do_rgb.bpp24
2106
    dd  img._.do_rgb.bpp32
2151
    dd  img._.do_rgb.bpp32
2107
    dd  img._.do_rgb.bpp15.amd  ; can be overwritten in lib_init
2152
    dd  img._.do_rgb.bpp15.amd  ; can be overwritten in lib_init
2108
    dd  img._.do_rgb.bpp16.amd  ; can be overwritten in lib_init
2153
    dd  img._.do_rgb.bpp16.amd  ; can be overwritten in lib_init
-
 
2154
    dd  img._.do_rgb.bpp1
-
 
2155
    dd  img._.do_rgb.bpp8g
Line 2109... Line 2156...
2109
    dd  img._.do_rgb.bpp1
2156
;    dd  img._.do_rgb.bpp8a
2110
 
2157
 
2111
img.flip.layer.handlers_horz:
2158
img.flip.layer.handlers_horz:
2112
    dd  img.flip.layer.bpp8_horz
2159
    dd  img.flip.layer.bpp8ig_horz
2113
    dd  img.flip.layer.bpp24_horz
2160
    dd  img.flip.layer.bpp24_horz
2114
    dd  img.flip.layer.bpp32_horz
2161
    dd  img.flip.layer.bpp32_horz
2115
    dd  img.flip.layer.bpp1x_horz
2162
    dd  img.flip.layer.bpp1x_horz
-
 
2163
    dd  img.flip.layer.bpp1x_horz
-
 
2164
    dd  img.flip.layer.bpp1_horz
Line 2116... Line 2165...
2116
    dd  img.flip.layer.bpp1x_horz
2165
    dd  img.flip.layer.bpp8ig_horz
2117
    dd  img.flip.layer.bpp1_horz
2166
;    dd  img.flip.layer.bpp8a_horz
2118
 
2167
 
2119
;;================================================================================================;;
2168
;;================================================================================================;;