From 1d0ebeae62bce8ec43dde86a772d62f587b4c7f1 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 14 Oct 2010 14:04:22 -0500 Subject: [PATCH] added a check to avoid creating a new bitmap struct (so caching works better when you flip images that are not scaled) --- collects/mrlib/image-core.rkt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/collects/mrlib/image-core.rkt b/collects/mrlib/image-core.rkt index 5088b25205..92d5a325e7 100644 --- a/collects/mrlib/image-core.rkt +++ b/collects/mrlib/image-core.rkt @@ -557,14 +557,18 @@ has been moved out). (text-weight shape) (text-underline shape))] [(flip? shape) - (let ([bitmap (flip-shape shape)]) - (make-flip (flip-flipped? shape) - (make-bitmap (bitmap-raw-bitmap bitmap) - (bitmap-raw-mask bitmap) - (bitmap-angle bitmap) - (* x-scale (bitmap-x-scale bitmap)) - (* y-scale (bitmap-y-scale bitmap)) - #f #f)))])) + (cond + [(and (= 1 x-scale) (= 1 y-scale)) + shape] + [else + (let ([bitmap (flip-shape shape)]) + (make-flip (flip-flipped? shape) + (make-bitmap (bitmap-raw-bitmap bitmap) + (bitmap-raw-mask bitmap) + (bitmap-angle bitmap) + (* x-scale (bitmap-x-scale bitmap)) + (* y-scale (bitmap-y-scale bitmap)) + #f #f)))])])) (define (scale-color color x-scale y-scale) (cond