- (cond ((/= zoomed-image 0) (values zoomed-image width height))))))))))
-
-(defun resize-image (image width height)
- (let ((old-width (surface-w image)) (old-height (surface-h image)))
- (cond ((and (= width old-width) (= height old-height)) image)
- (t (let ((zoomx (/ width old-width)) (zoomy (/ height old-height)) zoomed-image)
- (setq zoomed-image (zoomSurface image zoomx zoomy 0))
- (let ((new-width (surface-w zoomed-image)) (new-height (surface-h zoomed-image)))
- (cond ((or (and (= width new-width) (= height new-height))
- (and (= old-width new-width) (= old-height new-height))) zoomed-image)
- (t (let (rezoomed)
- (setq rezoomed (resize-image zoomed-image width height))
- (SDL_FreeSurface zoomed-image)
- rezoomed)))))))))
+ (cond ((/= resized-image 0) (values resized-image width height))))))))))
+
+(defun resize-surface (surface width height)
+ (let ((old-width (surface-w surface)) (old-height (surface-h surface)))
+ (cond ((and (= width old-width) (= height old-height)) surface)
+ (t (let ((zoomx (/ (+ width 0.5) old-width)) (zoomy (/ (+ height 0.5) old-height)))
+ (zoomSurface surface zoomx zoomy 0))))))