Add palette and odd-sized PNG unit tests. Fix loading interlaced PNGs < 8x8 in size.
|
@ -13,18 +13,62 @@ IN: images.png.tests
|
|||
"basi0g08.png" decode-test
|
||||
"basi0g16.png" decode-test
|
||||
"basi2c08.png" decode-test
|
||||
"basi3p01.png" decode-test
|
||||
"basi3p02.png" decode-test
|
||||
"basi3p04.png" decode-test
|
||||
"basi3p08.png" decode-test
|
||||
"basn0g01.png" decode-test
|
||||
"basn0g02.png" decode-test
|
||||
"basn0g04.png" decode-test
|
||||
"basn0g08.png" decode-test
|
||||
"basn0g16.png" decode-test
|
||||
"basn2c08.png" decode-test
|
||||
"basn3p01.png" decode-test
|
||||
"basn3p02.png" decode-test
|
||||
"basn3p04.png" decode-test
|
||||
"basn3p08.png" decode-test
|
||||
"basn6a08.png" decode-test
|
||||
"f00n2c08.png" decode-test
|
||||
"f01n2c08.png" decode-test
|
||||
"f02n2c08.png" decode-test
|
||||
"f03n2c08.png" decode-test
|
||||
"f04n2c08.png" decode-test
|
||||
"s01i3p01.png" decode-test
|
||||
"s01n3p01.png" decode-test
|
||||
"s02i3p01.png" decode-test
|
||||
"s02n3p01.png" decode-test
|
||||
"s03i3p01.png" decode-test
|
||||
"s03n3p01.png" decode-test
|
||||
"s04i3p01.png" decode-test
|
||||
"s04n3p01.png" decode-test
|
||||
"s05i3p02.png" decode-test
|
||||
"s05n3p02.png" decode-test
|
||||
"s06i3p02.png" decode-test
|
||||
"s06n3p02.png" decode-test
|
||||
"s07i3p02.png" decode-test
|
||||
"s07n3p02.png" decode-test
|
||||
"s08i3p02.png" decode-test
|
||||
"s08n3p02.png" decode-test
|
||||
"s09i3p02.png" decode-test
|
||||
"s32n3p04.png" decode-test
|
||||
"s32i3p04.png" decode-test
|
||||
"s33n3p04.png" decode-test
|
||||
"s33i3p04.png" decode-test
|
||||
"s34n3p04.png" decode-test
|
||||
"s34i3p04.png" decode-test
|
||||
"s35n3p04.png" decode-test
|
||||
"s35i3p04.png" decode-test
|
||||
"s36n3p04.png" decode-test
|
||||
"s36i3p04.png" decode-test
|
||||
"s37n3p04.png" decode-test
|
||||
"s37i3p04.png" decode-test
|
||||
"s38n3p04.png" decode-test
|
||||
"s38i3p04.png" decode-test
|
||||
"s39n3p04.png" decode-test
|
||||
"s39i3p04.png" decode-test
|
||||
"s40n3p04.png" decode-test
|
||||
"s40i3p04.png" decode-test
|
||||
"s07n3p02.png" decode-test
|
||||
"z00n2c08.png" decode-test
|
||||
"z03n2c08.png" decode-test
|
||||
"z06n2c08.png" decode-test
|
||||
|
|
|
@ -170,22 +170,35 @@ ERROR: bad-filter n ;
|
|||
byte-array bs:<msb0-bit-reader> :> bs
|
||||
loading-png width>> :> width
|
||||
loading-png height>> :> height
|
||||
|
||||
bs loading-png width height read-scanlines ;
|
||||
|
||||
: adam7-subimage-height ( png-height pass -- subimage-height )
|
||||
[ starting-row nth + ] keep
|
||||
row-increment nth /i ;
|
||||
:: adam7-subimage-height ( png-height pass -- subimage-height )
|
||||
pass starting-row nth png-height >= [
|
||||
0
|
||||
] [
|
||||
png-height 1 -
|
||||
pass block-height nth +
|
||||
pass row-increment nth /i
|
||||
] if ;
|
||||
|
||||
: adam7-subimage-width ( png-width pass -- subimage-width )
|
||||
[ starting-col nth + ] keep
|
||||
col-increment nth /i ;
|
||||
:: adam7-subimage-width ( png-width pass -- subimage-width )
|
||||
pass starting-col nth png-width >= [
|
||||
0
|
||||
] [
|
||||
png-width 1 -
|
||||
pass block-width nth +
|
||||
pass col-increment nth /i
|
||||
] if ;
|
||||
|
||||
:: read-adam7-subimage ( bit-reader loading-png pass -- lines )
|
||||
loading-png height>> pass adam7-subimage-height :> height
|
||||
loading-png width>> pass adam7-subimage-width :> width
|
||||
|
||||
bit-reader loading-png width height read-scanlines ;
|
||||
height width * zero? [
|
||||
B{ } clone
|
||||
] [
|
||||
bit-reader loading-png width height read-scanlines
|
||||
] if ;
|
||||
|
||||
:: reverse-interlace-adam7 ( byte-array loading-png -- byte-array )
|
||||
byte-array bs:<msb0-bit-reader> :> bs
|
||||
|
|
After Width: | Height: | Size: 132 B |
After Width: | Height: | Size: 193 B |
After Width: | Height: | Size: 327 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 112 B |
After Width: | Height: | Size: 146 B |
After Width: | Height: | Size: 216 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 113 B |
After Width: | Height: | Size: 113 B |
After Width: | Height: | Size: 114 B |
After Width: | Height: | Size: 115 B |
After Width: | Height: | Size: 118 B |
After Width: | Height: | Size: 120 B |
After Width: | Height: | Size: 126 B |
After Width: | Height: | Size: 121 B |
After Width: | Height: | Size: 134 B |
After Width: | Height: | Size: 129 B |
After Width: | Height: | Size: 143 B |
After Width: | Height: | Size: 131 B |
After Width: | Height: | Size: 149 B |
After Width: | Height: | Size: 138 B |
After Width: | Height: | Size: 149 B |
After Width: | Height: | Size: 139 B |
After Width: | Height: | Size: 147 B |
After Width: | Height: | Size: 143 B |
After Width: | Height: | Size: 355 B |
After Width: | Height: | Size: 263 B |
After Width: | Height: | Size: 385 B |
After Width: | Height: | Size: 329 B |
After Width: | Height: | Size: 349 B |
After Width: | Height: | Size: 248 B |
After Width: | Height: | Size: 399 B |
After Width: | Height: | Size: 338 B |
After Width: | Height: | Size: 356 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 393 B |
After Width: | Height: | Size: 336 B |
After Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 420 B |
After Width: | Height: | Size: 352 B |
After Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 256 B |