fredsa / playn

Cross platform game library for N≥4 platforms
0 stars 1 forks source link

Wrong assertions when accessing size of ImageLayer #247

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. creates an image layer with the desired size
2. reads the width of the image layer before showing it on the screen
3. fills the image into the layer somewhere else
4. fails to run the html version since ImageLayer.width() asserts the image is 
not null.

What is the expected output? What do you see instead?
The html version should work. 

The assertions in width() and height() of ImageLayerGL and ImageLayerCanvas 
should be evaluated when the layer image is not given.

Original issue reported on code.google.com by tan...@gmail.com on 11 Feb 2014 at 4:06

GoogleCodeExporter commented 9 years ago
Fixed in trunk. Thanks!

Original comment by m...@samskivert.com on 11 Feb 2014 at 5:44

GoogleCodeExporter commented 9 years ago
Hi,

I went over my code and found that I am using a zero width ImageLayer in a 
progress bar when the progress is 0. The render in either Java or Android 
platform works really fine.

In other words, the 0 size of ImageLayer conceptually valid. What do you think? 
Shall we change the assertions against -1?

Sorry to open this issue again :)

Original comment by tan...@gmail.com on 12 Feb 2014 at 10:49

GoogleCodeExporter commented 9 years ago
I pushed a fix for that too. No reason you shouldn't be able to set ImageLayer 
width/height to zero.

Original comment by m...@samskivert.com on 12 Feb 2014 at 7:09