aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix H. Dahlke <fhd@ubercode.de>2013-07-16 00:45:57 +0200
committerFelix H. Dahlke <fhd@ubercode.de>2013-07-16 00:45:57 +0200
commitd009ad073f29d18d0b85d846e656bf21d27a1812 (patch)
tree3c6ddb24596121b5676443d0960b23244e775c14
parent9bf755607fc7a0e7f446a5e2d6c82738d77d876f (diff)
Just zoom the surface if the angle is divisible by 360
-rw-r--r--src/library_sdl.js4
-rw-r--r--tests/sdl_rotozoom.c3
-rw-r--r--tests/sdl_rotozoom.pngbin437956 -> 431921 bytes
3 files changed, 6 insertions, 1 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js
index b7d73862..9214b87d 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -1096,7 +1096,11 @@ var LibrarySDL = {
return ret;
},
+ rotozoomSurface__deps: ['zoomSurface'],
rotozoomSurface: function(src, angle, zoom, smooth) {
+ if (angle % 360 === 0) {
+ return _zoomSurface(src, zoom, zoom, smooth);
+ }
var srcData = SDL.surfaces[src];
var w = srcData.width * zoom;
var h = srcData.height * zoom;
diff --git a/tests/sdl_rotozoom.c b/tests/sdl_rotozoom.c
index e81258d9..cdbdcc6f 100644
--- a/tests/sdl_rotozoom.c
+++ b/tests/sdl_rotozoom.c
@@ -6,7 +6,7 @@
#include "emscripten.h"
#endif
-const int numSprites = 8;
+const int numSprites = 9;
SDL_Surface *screen;
SDL_Surface *sprite[numSprites];
@@ -41,6 +41,7 @@ int main(int argc, char **argv) {
sprite[5] = rotozoomSurface(sprite[1], 45, 0.5, SMOOTHING_ON);
sprite[6] = zoomSurface(sprite[0], -0.5, 0.5, SMOOTHING_ON);
sprite[7] = zoomSurface(sprite[0], -0.5, -0.5, SMOOTHING_ON);
+ sprite[8] = rotozoomSurface(sprite[1], 0, 0.5, SMOOTHING_ON);
mainloop();
diff --git a/tests/sdl_rotozoom.png b/tests/sdl_rotozoom.png
index 5c5dec2f..288dd303 100644
--- a/tests/sdl_rotozoom.png
+++ b/tests/sdl_rotozoom.png
Binary files differ