fixed a performance bug (avoids computing the rotation of a bitmap when it isnt actually rotated...)
This commit is contained in:
parent
f272acec5f
commit
09bd56081b
|
@ -829,18 +829,23 @@ the mask bitmap and the original bitmap are all together in a single bytes!
|
||||||
(do-rotate bitmap flipped?)])))))
|
(do-rotate bitmap flipped?)])))))
|
||||||
|
|
||||||
(define (do-rotate bitmap flip?)
|
(define (do-rotate bitmap flip?)
|
||||||
(let ([θ (degrees->radians (bitmap-angle bitmap))])
|
(cond
|
||||||
(let-values ([(bytes w h) (bitmap->bytes (bitmap-rendered-bitmap bitmap)
|
[(zero? (bitmap-angle bitmap))
|
||||||
(bitmap-rendered-mask bitmap))])
|
;; don't rotate anything in this case.
|
||||||
(let-values ([(rotated-bytes rotated-w rotated-h)
|
(void)]
|
||||||
(rotate-bytes bytes w h θ)])
|
[else
|
||||||
(let* ([flipped-bytes (if flip?
|
(let ([θ (degrees->radians (bitmap-angle bitmap))])
|
||||||
(flip-bytes rotated-bytes rotated-w rotated-h)
|
(let-values ([(bytes w h) (bitmap->bytes (bitmap-rendered-bitmap bitmap)
|
||||||
rotated-bytes)]
|
(bitmap-rendered-mask bitmap))])
|
||||||
[bm (bytes->bitmap flipped-bytes rotated-w rotated-h)]
|
(let-values ([(rotated-bytes rotated-w rotated-h)
|
||||||
[mask (send bm get-loaded-mask)])
|
(rotate-bytes bytes w h θ)])
|
||||||
(set-bitmap-rendered-bitmap! bitmap bm)
|
(let* ([flipped-bytes (if flip?
|
||||||
(set-bitmap-rendered-mask! bitmap mask))))))
|
(flip-bytes rotated-bytes rotated-w rotated-h)
|
||||||
|
rotated-bytes)]
|
||||||
|
[bm (bytes->bitmap flipped-bytes rotated-w rotated-h)]
|
||||||
|
[mask (send bm get-loaded-mask)])
|
||||||
|
(set-bitmap-rendered-bitmap! bitmap bm)
|
||||||
|
(set-bitmap-rendered-mask! bitmap mask)))))]))
|
||||||
|
|
||||||
(define (do-scale bitmap)
|
(define (do-scale bitmap)
|
||||||
(let* ([bdc (make-object bitmap-dc%)]
|
(let* ([bdc (make-object bitmap-dc%)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user