From 0120b59ea51f49aaba2ea82abb5260e3504f2694 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 25 Nov 2010 10:52:15 -0700 Subject: [PATCH] fix `draw-bitmap-section-smooth' method of bitmap-dc<%> original commit: 8e8844641c63767ce0df4428051cf086ffa91e6e --- collects/tests/gracket/dc.rktl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/collects/tests/gracket/dc.rktl b/collects/tests/gracket/dc.rktl index 5e7d0f6f..afce8bc4 100644 --- a/collects/tests/gracket/dc.rktl +++ b/collects/tests/gracket/dc.rktl @@ -194,6 +194,27 @@ #"\377\377\377\377\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0"))) (test #t 'same-bits (equal? bs bs2))) +;; ---------------------------------------- +;; Test draw-bitmap-section-smooth + +(let* ([bm (make-bitmap 100 100)] + [dc (make-object bitmap-dc% bm)] + [bm2 (make-bitmap 70 70)] + [dc2 (make-object bitmap-dc% bm2)] + [bm3 (make-bitmap 70 70)] + [dc3 (make-object bitmap-dc% bm3)]) + (send dc draw-ellipse 0 0 100 100) + (send dc2 draw-bitmap-section-smooth bm + 10 10 50 50 + 0 0 100 100) + (send dc3 scale 0.5 0.5) + (send dc3 draw-bitmap bm 20 20) + (let ([s2 (make-bytes (* 4 70 70))] + [s3 (make-bytes (* 4 70 70))]) + (send bm2 get-argb-pixels 0 0 70 70 s2) + (send bm3 get-argb-pixels 0 0 70 70 s3) + (test #t 'same-scaled (equal? s2 s3)))) + ;; ---------------------------------------- (report-errs)