File tree 4 files changed +19
-2
lines changed
4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -163,8 +163,17 @@ if find codecs 'gif [
163
163
if find codecs 'bmp [
164
164
extend codecs/bmp 'size? function ["Return BMP image size or none" img [file! url! binary! ]][
165
165
unless binary? img [img: read /binary/part img 32 ]
166
- unless find/tail img #{ 424D } [return none]
166
+ unless find/match img #{ 424D } [return none]
167
167
try [return to pair! binary/read img [SKIP 18 UI32LE UI32LE]]
168
168
none
169
169
]
170
170
]
171
+
172
+ if find codecs 'dds [
173
+ extend codecs/dds 'size? function ["Return DDS image size or none" img [file! url! binary! ]][
174
+ unless binary? img [img: read /binary/part img 32 ]
175
+ unless find/match img #{ 444453207C000000 } [return none]
176
+ try [return to pair! reverse binary/read img [SKIP 12 UI32LE UI32LE]]
177
+ none
178
+ ]
179
+ ]
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ register-codec [
29
29
30
30
decode : func [ data [binary! ]] [lib/image/load/as data 'DDS]
31
31
encode : func [ data [image! ]] [lib/image/save/as none data 'DDS]
32
- identify : func [ data [binary! ]] [parse data [#{ 444453 } to end]]
32
+ identify : func [ data [binary! ]] [parse data [#{ 444453207C000000 } to end]]
33
33
]
34
34
35
35
register-codec [
Original file line number Diff line number Diff line change @@ -430,6 +430,14 @@ if find codecs 'BMP [
430
430
===end-group===
431
431
]
432
432
433
+ if find codecs 'DDS [
434
+ ===start-group=== "DDS codec"
435
+ --test-- "dds/size?"
436
+ --assert 256x256 = codecs/dds/size? %units/files/flower.dds
437
+ --assert none? codecs/dds/size? %units/files/test.aar
438
+ ===end-group===
439
+ ]
440
+
433
441
if find codecs 'XML [
434
442
===start-group=== "XML codec"
435
443
--test-- "XML decode test1"
You can’t perform that action at this time.
0 commit comments