racket/snip: fix image-snip% to convert to 'png@2x-bytes

An `image-snip%` converts to 'png@2x-bytes when its bitmap
has a backing scale of 2.
This commit is contained in:
Matthew Flatt 2014-01-06 21:37:07 -07:00
parent bfa5e72816
commit 3cecb753a9

View File

@ -897,10 +897,13 @@
(interface* ()
([prop:convertible
(lambda (img format default)
(case format
[(png-bytes)
(cond
[(or (eq? format 'png-bytes)
(and (eq? format 'png@2x-bytes)
(= 2 (send (send img get-bitmap) get-backing-scale))))
(let ([s (open-output-bytes)])
(send (send img get-bitmap) save-file s 'png)
(send (send img get-bitmap) save-file s 'png
#:unscaled? (eq? format 'png@2x-bytes))
(get-output-bytes s))]
[else default]))])))