diff options
| -rw-r--r-- | js/render.js | 12 | ||||
| -rw-r--r-- | js/shader.js | 2 | ||||
| -rw-r--r-- | js/util.js | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/js/render.js b/js/render.js index 993ba0e..e379ab8 100644 --- a/js/render.js +++ b/js/render.js @@ -21,8 +21,8 @@ function ready(){ loading = false if (window.gif) { frame = gif.frames[0] - w = cc.canvas.width = frame.ctx.canvas.width - h = cc.canvas.height = frame.ctx.canvas.height + actual_w = w = cc.canvas.width = frame.ctx.canvas.width + actual_h = h = cc.canvas.height = frame.ctx.canvas.height for (var i=0, f; f=gif.frames[i]; i++){ f.cloneData = f.ctx.getImageData(0,0,w,h) } @@ -31,8 +31,8 @@ function ready(){ fc = cq(img.width, img.height) fc.drawImage(img, 0, 0) frame = img_frame = { ctx: fc.context } - w = cc.canvas.width = frame.ctx.canvas.width - h = cc.canvas.height = frame.ctx.canvas.height + actual_w = w = cc.canvas.width = frame.ctx.canvas.width + actual_h = h = cc.canvas.height = frame.ctx.canvas.height frame.cloneData = frame.ctx.getImageData(0,0,w,h) } else { @@ -66,8 +66,8 @@ function giveFrame(t){ } function empty_frame(){ - w = w || 400 - h = h || 266 + actual_w = w = w || 400 + actual_h = h = h || 266 var cx = cq(w, h).fillStyle("rgba(255,255,255,255)").fillRect(0,0,w,h) return { ctx: cx.context, cloneData: cx.getImageData(0,0,w,h) } } diff --git a/js/shader.js b/js/shader.js index 7773b89..a8559ba 100644 --- a/js/shader.js +++ b/js/shader.js @@ -18,7 +18,7 @@ var shader_build = function(){ } var r,g,b,a; - +var w, h, actual_w, actual_h; function shade_no_error_handling(frame, t){ if (! t || isNaN(t)) throw Error ("No time specified") if (! frame) throw Error ("No frame specified") @@ -43,7 +43,7 @@ function choice(a){ return a[randint(a.length)] } function deg(n){ return n*180/PI } function rad(n){ return n*PI/180 } function xor(a,b){ a=!!a; b=!!b; return (a||b) && !(a&&b) } -function pixel(x,y){ return 4*(mod(y,h)*w+mod(x,w)) } +function pixel(x,y){ return 4*(mod(y,actual_h)*actual_w+mod(x,actual_w)) } function rgbpixel(d,x,y){ var p = pixel(~~x,~~y) r = d[p] |
