From 60d6f6a57209c3b64147a1880e62344b63c42899 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 6 Mar 2020 19:34:41 -0600 Subject: [PATCH] images.loader.gdiplus: Allow writing .bmp and do a better lookup. --- basis/images/loader/gdiplus/gdiplus.factor | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/basis/images/loader/gdiplus/gdiplus.factor b/basis/images/loader/gdiplus/gdiplus.factor index c8714843f2..7e9bdc08a4 100644 --- a/basis/images/loader/gdiplus/gdiplus.factor +++ b/basis/images/loader/gdiplus/gdiplus.factor @@ -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 ; : 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>> ;