From 4c18e8212f0978cc98d2151163b6993e4bd8bd46 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 2 Dec 2009 04:42:35 +0000 Subject: [PATCH] PR 10635 svn: r17156 --- collects/2htdp/tests/test-image.ss | 19 +++++++++++++++++++ collects/mrlib/private/image-core-bitmap.ss | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/collects/2htdp/tests/test-image.ss b/collects/2htdp/tests/test-image.ss index 64eb05ce34..f18b6e67d2 100644 --- a/collects/2htdp/tests/test-image.ss +++ b/collects/2htdp/tests/test-image.ss @@ -954,3 +954,22 @@ 16) (check-equal? (image-height (bitmap icons/stop-16x16.png)) 16) + +(check-equal? (let () + (define bmp (make-object bitmap% 4 4)) + (define mask (make-object bitmap% 4 4)) + (define bdc (make-object bitmap-dc% bmp)) + (send bdc set-brush "black" 'solid) + (send bdc draw-rectangle 0 0 4 4) + (send bdc set-bitmap mask) + (send bdc set-brush "black" 'solid) + (send bdc clear) + (send bdc draw-rectangle 1 1 1 1) + (send bdc set-bitmap #f) + (let-values ([(bytes w h) (bitmap->bytes bmp mask)]) + bytes)) + (bytes-append #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" + #"\0\0\0\0" #"\377\0\0\0" #"\0\0\0\0" #"\0\0\0\0" + #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" + #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0")) + \ No newline at end of file diff --git a/collects/mrlib/private/image-core-bitmap.ss b/collects/mrlib/private/image-core-bitmap.ss index 7491cb4f9d..112af70085 100644 --- a/collects/mrlib/private/image-core-bitmap.ss +++ b/collects/mrlib/private/image-core-bitmap.ss @@ -59,8 +59,8 @@ instead of this scaling code, we use the dc<%>'s scaling code. [h (send bm get-height)] [bytes (make-bytes (* w h NUM-CHANNELS) 0)]) (send bm get-argb-pixels 0 0 w h bytes #f) - (when (send bm get-loaded-mask) - (send (send bm get-loaded-mask) get-argb-pixels 0 0 w h bytes #t)) + (when mask + (send mask get-argb-pixels 0 0 w h bytes #t)) (values bytes w h))) (define (bytes->bitmap bytes w h)