]> gitweb.factorcode.org Git - factor.git/commitdiff
images.loader.gdiplus: Allow writing .bmp and do a better lookup.
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 7 Mar 2020 01:34:41 +0000 (19:34 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 7 Mar 2020 01:35:16 +0000 (19:35 -0600)
basis/images/loader/gdiplus/gdiplus.factor

index c8714843f205f21201a258eb1de17bea2f9cec8d..7e9bdc08a4cd4236ec96e48609ff2c10a8e4cd39 100644 (file)
@@ -64,7 +64,7 @@ os windows? [
 ERROR: unsupported-pixel-format component-order ;
 
 : check-pixel-format ( component-order -- )
-    dup { BGRX BGRA } member? [ drop ] [ unsupported-pixel-format ] if ;
+    dup { BGRX BGRA RGBA } member? [ drop ] [ unsupported-pixel-format ] if ;
 
 : image>gdi+-bitmap ( image -- bitmap )
     dup component-order>> check-pixel-format
@@ -84,8 +84,7 @@ ERROR: unsupported-pixel-format component-order ;
     nip swap ImageCodecInfo <c-direct-array> ;
 
 : extension>mime-type ( extension -- mime-type )
-    ! Crashes if you let this mime through on my machine.
-    dup mime-types at dup "image/bmp" = [ unknown-image-extension ] when nip ;
+    mime-types ?at [ unknown-image-extension ] unless ;
 
 : mime-type>clsid ( mime-type -- clsid )
     image-encoders [ MimeType>> alien>native-string = ] with find nip Clsid>> ;