Skip to content
Snippets Groups Projects
Commit 2893d768 authored by rswindell's avatar rswindell
Browse files

Graphic.load() now accepts an optional 'offset' parameter, so you can skip

some data to find the graphic you want to 'load'.
Also, limit the read() size (of BIN files) to the width x height x 2.
parent 0e7118fa
No related branches found
No related tags found
No related merge requests found
......@@ -507,7 +507,7 @@ Graphic.prototype.drawfx = function(xpos,ypos,width,height,xoff,yoff)
* Loads a ANS or BIN file.
* TODO: The ASC load is pretty much guaranteed to be broken.
*/
Graphic.prototype.load = function(filename)
Graphic.prototype.load = function(filename, offset)
{
var file_type=file_getext(filename).substr(1);
var f=new File(filename);
......@@ -525,7 +525,9 @@ Graphic.prototype.load = function(filename)
case "BIN":
if(!(f.open("rb",true)))
return(false);
this.BIN = f.read();
if(offset)
f.position = offset * this.height * this.width * 2;
this.BIN = f.read(this.height * this.width * 2);
f.close();
break;
case "ASC":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment