Skip to content

Commit 2d1ab1a

Browse files
committed
Merge branch 'dev' of https://github.com/photonstorm/phaser into dev
2 parents 7b66a78 + 609b38c commit 2d1ab1a

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
279279
### Bug Fixes
280280

281281
* Buttons (or any Sprites) that don't have a texture, but have children, would incorrectly render the children under WebGL due to the baseTexture.skipRender property (thanks @puzzud #2141)
282+
* TilemapParser accidentally redeclared `i` when parsing the ImageCollections which would cause an infinite loop (thanks DanHett)
283+
* BitmapData.update causes a snowballing memory leak under WebGL due to a Context.getImageData call. BitmapData.clear used to call update automatically but no longer does. This resolves the issue of the Debug class causing excessive memory build-up in Chrome. Firefox and IE were unaffected (thanks @kingjerod #2208)
282284

283285
### Pixi Updates
284286

src/gameobjects/BitmapData.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ Phaser.BitmapData.prototype = {
441441
* You can optionally define the area to clear.
442442
* If the arguments are left empty it will clear the entire canvas.
443443
*
444+
* You may need to call BitmapData.update after this in order to clear out the pixel data,
445+
* but Phaser will not do this automatically for you.
446+
*
444447
* @method Phaser.BitmapData#clear
445448
* @param {number} [x=0] - The x coordinate of the top-left of the area to clear.
446449
* @param {number} [y=0] - The y coordinate of the top-left of the area to clear.
@@ -457,8 +460,6 @@ Phaser.BitmapData.prototype = {
457460

458461
this.context.clearRect(x, y, width, height);
459462

460-
this.update();
461-
462463
this.dirty = true;
463464

464465
return this;
@@ -567,6 +568,8 @@ Phaser.BitmapData.prototype = {
567568
* It then re-builds the ArrayBuffer, the data Uint8ClampedArray reference and the pixels Int32Array.
568569
* If not given the dimensions defaults to the full size of the context.
569570
*
571+
* Warning: This is a very expensive operation, so use it sparingly.
572+
*
570573
* @method Phaser.BitmapData#update
571574
* @param {number} [x=0] - The x coordinate of the top-left of the image data area to grab from.
572575
* @param {number} [y=0] - The y coordinate of the top-left of the image data area to grab from.

src/tilemap/TilemapParser.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Phaser.TilemapParser = {
7878
* Parses a CSV file into valid map data.
7979
*
8080
* @method Phaser.TilemapParser.parseCSV
81+
* @param {string} key - The name you want to give the map data.
8182
* @param {string} data - The CSV file data.
8283
* @param {number} [tileWidth=32] - The pixel width of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.
8384
* @param {number} [tileHeight=32] - The pixel height of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.
@@ -446,10 +447,10 @@ Phaser.TilemapParser = {
446447
{
447448
var newCollection = new Phaser.ImageCollection(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing, set.properties);
448449

449-
for (var i in set.tiles)
450+
for (var ti in set.tiles)
450451
{
451-
var image = set.tiles[i].image;
452-
var gid = set.firstgid + parseInt(i, 10);
452+
var image = set.tiles[ti].image;
453+
var gid = set.firstgid + parseInt(ti, 10);
453454
newCollection.addImage(gid, image);
454455
}
455456

0 commit comments

Comments
 (0)