{"action":"created","issue":{"url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/1458","labels_url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/1458/labels{/name}","comments_url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/1458/comments","events_url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/1458/events","html_url":"https://github.com/GoodBoyDigital/pixi.js/issues/1458","id":58761768,"number":1458,"title":"[PIXI 2.2.5, Bug] TilingSprite#generateTilingTexture generates a stretched texture for trimmed sources.","user":{"login":"georgiee","id":1701755,"avatar_url":"https://avatars.githubusercontent.com/u/1701755?v=3","gravatar_id":"","url":"https://api.github.com/users/georgiee","html_url":"https://github.com/georgiee","followers_url":"https://api.github.com/users/georgiee/followers","following_url":"https://api.github.com/users/georgiee/following{/other_user}","gists_url":"https://api.github.com/users/georgiee/gists{/gist_id}","starred_url":"https://api.github.com/users/georgiee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgiee/subscriptions","organizations_url":"https://api.github.com/users/georgiee/orgs","repos_url":"https://api.github.com/users/georgiee/repos","events_url":"https://api.github.com/users/georgiee/events{/privacy}","received_events_url":"https://api.github.com/users/georgiee/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/labels/Canvas","name":"Canvas","color":"bfe5bf"},{"url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/labels/WebGL","name":"WebGL","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/milestones/4","html_url":"https://github.com/GoodBoyDigital/pixi.js/milestones/v2.x","labels_url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/milestones/4/labels","id":563751,"number":4,"title":"v2.x","description":"","creator":{"login":"englercj","id":944497,"avatar_url":"https://avatars.githubusercontent.com/u/944497?v=3","gravatar_id":"","url":"https://api.github.com/users/englercj","html_url":"https://github.com/englercj","followers_url":"https://api.github.com/users/englercj/followers","following_url":"https://api.github.com/users/englercj/following{/other_user}","gists_url":"https://api.github.com/users/englercj/gists{/gist_id}","starred_url":"https://api.github.com/users/englercj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/englercj/subscriptions","organizations_url":"https://api.github.com/users/englercj/orgs","repos_url":"https://api.github.com/users/englercj/repos","events_url":"https://api.github.com/users/englercj/events{/privacy}","received_events_url":"https://api.github.com/users/englercj/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":7,"state":"open","created_at":"2014-02-09T20:38:49Z","updated_at":"2015-02-24T16:28:11Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-02-24T16:18:21Z","updated_at":"2015-02-25T06:36:38Z","closed_at":null,"body":"I have a trimmed sprite\r\nUntrimmed width of the sprite is 500px, it's trimmed down to 20px. There is a lot of space to the right to generate a very wide tiling pattern.\r\n\r\nSee here:\r\nhttp://jsfiddle.net/georgie/gesz8bkr/\r\n\r\nLooks like this:\r\n![screen shot 2015-02-24 at 17 02 05](https://cloud.githubusercontent.com/assets/1701755/6353014/e774552e-bc46-11e4-9bd8-6881b16066c2.png)\r\n\r\nThis affects Canvas & WebGL.\r\n\r\nYou can see the same trimmed frame is used in a sprite and in a tiling sprite.  The single sprite is fine.\r\nThe tiled texture is strechted to the full untrimmed size when tiled. I found that TilingSprite#generateTilingTexture is not acting correctly. See here: \r\nhttps://github.com/GoodBoyDigital/pixi.js/blob/2a5afb857328b1e28152499bce8e8560a6563caf/src/pixi/extras/TilingSprite.js#L439\r\n\r\n```\r\n//targetWidth & targetHeight will hold the frame size not the cropped size for trimmed textures- this will stretch the image\r\ncanvasBuffer.context.drawImage(texture.baseTexture.source,\r\n                               texture.crop.x,\r\n                               texture.crop.y,\r\n                               texture.crop.width,\r\n                               texture.crop.height,\r\n                               0,\r\n                               0,\r\n                               targetWidth, \r\n                               targetHeight);\r\n```\r\n\r\nIn my fiddle the targetWidth should be 20px not 500px (the untrimmed size).\r\nI tried to monkey patch pixi with a version of generateTilingTexture which uses the trimmed dimensions of a sprite. This worked, but the scaling of the sprite was not incorporated correctly. So I dropped my idea and posting this issue instead of a solution :)\r\n\r\nI found that rich sponsored these changes some time ago-  see https://github.com/GoodBoyDigital/pixi.js/pull/579\r\nand I wonder if this bug is present since then ?\r\n\r\nThanks George"},"comment":{"url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/comments/75912929","html_url":"https://github.com/GoodBoyDigital/pixi.js/issues/1458#issuecomment-75912929","issue_url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/1458","id":75912929,"user":{"login":"georgiee","id":1701755,"avatar_url":"https://avatars.githubusercontent.com/u/1701755?v=3","gravatar_id":"","url":"https://api.github.com/users/georgiee","html_url":"https://github.com/georgiee","followers_url":"https://api.github.com/users/georgiee/followers","following_url":"https://api.github.com/users/georgiee/following{/other_user}","gists_url":"https://api.github.com/users/georgiee/gists{/gist_id}","starred_url":"https://api.github.com/users/georgiee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgiee/subscriptions","organizations_url":"https://api.github.com/users/georgiee/orgs","repos_url":"https://api.github.com/users/georgiee/repos","events_url":"https://api.github.com/users/georgiee/events{/privacy}","received_events_url":"https://api.github.com/users/georgiee/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T06:36:38Z","updated_at":"2015-02-25T06:36:38Z","body":"Sorry Rich, you're right. I assumed that it worked back in the days and just wondered what happend to it in the meanwhile. Anyway, I'm glad that this should be easy to fix now it's pointed out.\r\n\r\nIn the meanwhile I looked at the working commit https://github.com/GoodBoyDigital/pixi.js/commit/661c5bc13727314c7a46b831dda317437cf76eab and it's parent https://github.com/GoodBoyDigital/pixi.js/commit/49c2ce1ca09cb92354a6a37b1b3adc0850665263.\r\nto find where it disappeared but there wasn't any related commit in the current file history of https://github.com/GoodBoyDigital/pixi.js/commits/master/src/pixi/extras/TilingSprite.js.\r\n\r\nMight this regression be caused by a failed manual merge? I'm just curious as this is one of my fears when I have to tidy up a failed merge."}}