]> git.jsancho.org Git - gacela.git/blobdiff - gacela_draw.lisp
(no commit message)
[gacela.git] / gacela_draw.lisp
index 93575a36b578178f578e4ab5ab6d425d7f875ed1..01181701575221b2b0dce1777b5e31bb32f99f56 100644 (file)
     (cond ((/= image 0)
           (let* ((width (surface-w image)) (height (surface-h image))
                  (power-2 (nearest-power-of-two (min width height)))
-                 zoomed-image)
+                 resized-image)
             (cond ((and (= width power-2) (= height power-2)) (values image width height))
-                  (t (setq zoomed-image (resize-image image power-2 power-2))
+                  (t (setq resized-image (resize-surface image power-2 power-2))
                      (SDL_FreeSurface image)
-                     (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 load-texture (filename &key (min-filter GL_LINEAR) (mag-filter GL_LINEAR) static)
   (let ((key (make-resource-texture :filename filename :min-filter min-filter :mag-filter mag-filter)))