mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
DisplayObject._generateCachedSprite (which is called from updateCache
or when cacheAsBitmap
is enabled) would bitwise | 1 the bounds width and height. This would often lead to incorrect rounding (heights of 4 would become 5, while heights of 5 would remain 5). This has now been removed and the width and height are passed through Mail.ceil and then checked to make sure they aren't less than 1 pixel in either direction (thanks @alesdotio #2078)
This commit is contained in:
parent
b629539176
commit
f6d273c4fc
2 changed files with 9 additions and 4 deletions
|
@ -395,6 +395,7 @@ Please note that Phaser uses a custom build of Pixi and always has done. The fol
|
|||
* If a Display Object with a mask contained a child with a Filter, then the child would not render. The WebGLFilterManager now retains state and creates a new stencil buffer as required (thanks @hightopo #1842)
|
||||
* The Filter Texture and GL Viewport are now properly resized, fixing issues with custom resolutions and filters (thanks @englercj @amadeus #2326 #2320)
|
||||
* Graphics.generateTexture has a new argument `padding` which allows you to add extra spacing onto the generated texture. This is useful for small Graphics objects where you find a few pixels getting sliced off the edges due to rounding issues (#1933)
|
||||
* DisplayObject._generateCachedSprite (which is called from `updateCache` or when `cacheAsBitmap` is enabled) would bitwise | 1 the bounds width and height. This would often lead to incorrect rounding (heights of 4 would become 5, while heights of 5 would remain 5). This has now been removed and the width and height are passed through Mail.ceil and then checked to make sure they aren't less than 1 pixel in either direction (thanks @alesdotio #2078)
|
||||
|
||||
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).
|
||||
|
||||
|
|
|
@ -641,17 +641,21 @@ PIXI.DisplayObject.prototype._generateCachedSprite = function()
|
|||
|
||||
var bounds = this.getLocalBounds();
|
||||
|
||||
// Round it off and force non-zero dimensions
|
||||
bounds.width = Math.max(1, Math.ceil(bounds.width));
|
||||
bounds.height = Math.max(1, Math.ceil(bounds.height));
|
||||
|
||||
this.updateTransform();
|
||||
|
||||
if (!this._cachedSprite)
|
||||
{
|
||||
var renderTexture = new PIXI.RenderTexture(bounds.width | 1, bounds.height | 1);
|
||||
var renderTexture = new PIXI.RenderTexture(bounds.width, bounds.height);
|
||||
this._cachedSprite = new PIXI.Sprite(renderTexture);
|
||||
this._cachedSprite.worldTransform = this.worldTransform;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._cachedSprite.texture.resize(bounds.width | 1, bounds.height | 1);
|
||||
this._cachedSprite.texture.resize(bounds.width, bounds.height);
|
||||
}
|
||||
|
||||
// Remove filters
|
||||
|
@ -664,8 +668,8 @@ PIXI.DisplayObject.prototype._generateCachedSprite = function()
|
|||
PIXI.DisplayObject._tempMatrix.ty = -bounds.y;
|
||||
|
||||
this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix, true);
|
||||
this._cachedSprite.anchor.x = -( bounds.x / bounds.width );
|
||||
this._cachedSprite.anchor.y = -( bounds.y / bounds.height );
|
||||
this._cachedSprite.anchor.x = -(bounds.x / bounds.width);
|
||||
this._cachedSprite.anchor.y = -(bounds.y / bounds.height);
|
||||
|
||||
this._filters = tempFilters;
|
||||
|
||||
|
|
Loading…
Reference in a new issue