clipping regions now work correctly when device pixel ratio != 1

This commit is contained in:
Eric Rowell
2013-08-25 22:26:42 -07:00
parent bf39df54b0
commit 6663ec0652
5 changed files with 55 additions and 16 deletions

View File

@@ -46,6 +46,12 @@
this.context = this.element.getContext(contextType);
this.setSize(width, height);
},
/**
* reset canvas context transform
*/
reset: function() {
this.getContext().setTransform(1 * _pixelRatio, 0, 0, 1 * _pixelRatio, 0, 0);
},
/**
* get canvas element
* @method
@@ -241,7 +247,9 @@
context.beginPath();
context.rect(clipX, clipY, clipWidth, clipHeight);
context.clip();
context.setTransform(1, 0, 0, 1, 0, 0);
this.reset();
container._drawChildren(this);
context.restore();
}
};