summaryrefslogtreecommitdiff
path: root/js/render.js
diff options
context:
space:
mode:
authorjules <jules@okfoc.us>2014-01-31 23:40:37 -0500
committerjules <jules@okfoc.us>2014-01-31 23:40:37 -0500
commit7c6c73cd52330a165e5297ba2ae819101dac641c (patch)
treed9f8be73706ebd54b3e733c291c04f8e5cd63c69 /js/render.js
parent2a4e1b7c615a5b0a9e5819e6703992fe34a9a74c (diff)
get width/height from db
Diffstat (limited to 'js/render.js')
-rw-r--r--js/render.js26
1 files changed, 18 insertions, 8 deletions
diff --git a/js/render.js b/js/render.js
index ac26eec..68554cb 100644
--- a/js/render.js
+++ b/js/render.js
@@ -2,6 +2,7 @@ var frame, img_frame;
var timeout, raf_id, start_t = 0, old_t = 0, pause_t = 0
var paused = false, dragging = false, rendering = false, scrolling = false, deferring = false, scrollTimeout = null
var fps = 30
+var preserve_dimensions = true;
function choose (){
loading = true
@@ -24,26 +25,35 @@ function ready(){
status("")
if (window.gif) {
frame = gif.frames[0]
- actual_w = w = cc.canvas.width = frame.ctx.canvas.width
- actual_h = h = cc.canvas.height = frame.ctx.canvas.height
+ cc.canvas.width = frame.ctx.canvas.width
+ cc.canvas.height = frame.ctx.canvas.height
+ if (preserve_dimensions) {
+ actual_w = w = cc.canvas.width
+ actual_h = h = cc.canvas.height
+ }
for (var i=0, f; f=gif.frames[i]; i++){
- f.cloneData = f.ctx.getImageData(0,0,w,h)
+ f.cloneData = f.ctx.getImageData(0,0,cc.canvas.width,cc.canvas.height)
}
}
else if (window.img) {
fc = cq(img.width, img.height)
fc.drawImage(img, 0, 0)
frame = img_frame = { ctx: fc.context }
- 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)
+ cc.canvas.width = frame.ctx.canvas.width
+ cc.canvas.height = frame.ctx.canvas.height
+ if (preserve_dimensions) {
+ actual_w = w = cc.canvas.width
+ actual_h = h = cc.canvas.height
+ }
+ frame.cloneData = frame.ctx.getImageData(0,0,cc.canvas.width,cc.canvas.height)
}
else {
- cc.canvas.width = w
- cc.canvas.height = h
+ cc.canvas.width = actual_w = w
+ cc.canvas.height = actual_h = h
shader_build()
}
displayWidthHeight(w, h)
+ preserve_dimensions = false;
}
function displayWidthHeight(width, height){