Add missing ImageData relating functions to ProxyContext and fix problem where values weren't being returned.

This commit is contained in:
Jonathan Puckey 2012-03-02 12:23:32 +01:00
parent 2fff5b4f79
commit b0aa54bf56

View file

@ -42,9 +42,9 @@ var ProxyContext = new function() {
'textAlign', 'textBaseline', 'fillText(text,x,y,maxWidth)', 'textAlign', 'textBaseline', 'fillText(text,x,y,maxWidth)',
'strokeText(text,x,y,maxWidth)', 'measureText(text)', 'strokeText(text,x,y,maxWidth)', 'measureText(text)',
'drawImage(image,dx,dy)', 'drawImage(image,dx,dy,dw,dh)', 'drawImage(image,dx,dy)', 'drawImage(image,dx,dy,dw,dh)',
'drawImage(image,sx,sy,sw,sh,dx,dy,dw,dh)', 'create(sw,sh)', 'drawImage(image,sx,sy,sw,sh,dx,dy,dw,dh)', 'createImageData(sw,sh)',
'create(imagedata)', 'get(sx,sy,sw,sh)', 'createImageData(imagedata)', 'getImageData(sx,sy,sw,sh)',
'put(imagedata,dx,dy,dirtyX,dirtyY,dirtyWidth,dirtyHeight)' 'putImageData(imagedata,dx,dy,dirtyX,dirtyY,dirtyWidth,dirtyHeight)'
]; ];
var param = { var param = {
initialize: function(context) { initialize: function(context) {
@ -71,10 +71,10 @@ var ProxyContext = new function() {
var args = Array.prototype.slice.call(arguments, 0).join(', '), var args = Array.prototype.slice.call(arguments, 0).join(', '),
string = 'ctx.' + name + '(' + args + ');'; string = 'ctx.' + name + '(' + args + ');';
console.log(this.getIndentation() + string); console.log(this.getIndentation() + string);
this._ctx[name].apply(this._ctx, arguments);
if (name == 'save') { if (name == 'save') {
this._indents++; this._indents++;
} }
return this._ctx[name].apply(this._ctx, arguments);
}; };
} else { } else {
var capitalized = Base.capitalize(name); var capitalized = Base.capitalize(name);