Fixed issue with textureLine creating white blocks in iOS.

This commit is contained in:
photonstorm 2014-10-09 02:30:31 +01:00
parent f2aa263d0a
commit 08c6106c35
2 changed files with 21 additions and 6 deletions

View file

@ -314,8 +314,8 @@ Phaser.FlexGrid.prototype = {
this.game.debug.text(this.boundsFluid.width + ' x ' + this.boundsFluid.height, this.boundsFluid.x + 4, this.boundsFluid.y + 16);
this.game.debug.geom(this.boundsFluid, 'rgba(255,0,0,0.9', false);
this.game.debug.text(this.boundsNone.width + ' x ' + this.boundsNone.height, this.boundsNone.x + 4, this.boundsNone.y + 16);
this.game.debug.geom(this.boundsNone, 'rgba(0,255,0,0.9', false);
// this.game.debug.text(this.boundsNone.width + ' x ' + this.boundsNone.height, this.boundsNone.x + 4, this.boundsNone.y + 16);
// this.game.debug.geom(this.boundsNone, 'rgba(0,255,0,0.9', false);
// this.game.debug.text(this.boundsCustom.width + ' x ' + this.boundsCustom.height, this.boundsCustom.x + 4, this.boundsCustom.y + 16);
// this.game.debug.geom(this.boundsCustom, 'rgba(255,255,0,0.9', false);

View file

@ -1248,15 +1248,30 @@ Phaser.BitmapData.prototype = {
*
* @method Phaser.BitmapData#textureLine
* @param {Phaser.Line} line - A Phaser.Line object that will be used to plot the start and end of the line.
* @param {string} key - The key of an image in the Phaser.Cache to use as the texture for this line.
* @param {string|HTMLImage} image - The key of an image in the Phaser.Cache to use as the texture for this line, or an actual Image.
* @param {string} [repeat='repeat-x'] - The pattern repeat mode to use when drawing the line. Either `repeat`, `repeat-x` or `no-repeat`.
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
*/
textureLine: function (line, key, repeat) {
textureLine: function (line, image, repeat) {
if (typeof repeat === 'undefined') { repeat = 'repeat-x'; }
var image = this.game.cache.getImage(key);
if (typeof image === 'string')
{
image = this.game.cache.getImage(image);
if (!image)
{
return;
}
}
var width = line.length;
if (repeat === 'no-repeat' && width > image.width)
{
width = image.width;
}
this.context.fillStyle = this.context.createPattern(image, repeat);
@ -1267,7 +1282,7 @@ Phaser.BitmapData.prototype = {
this.context.save();
this.context.translate(this._pos.x, this._pos.y);
this.context.rotate(line.angle);
this.context.fillRect(0, 0, line.length, image.height);
this.context.fillRect(0, 0, width, image.height);
this.context.restore();
this.dirty = true;