297chrisc / playn

Automatically exported from code.google.com/p/playn
0 stars 0 forks source link

fillRect doesn't seem to fill the entire Rectange #249

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

See 
http://stackoverflow.com/questions/21716269/fillrect-doesnt-seem-to-fill-the-ent
ire-rectange

What is the expected output? What do you see instead?

Same behaviour between 1.7 and 1.8.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Code:

    private static final int SKY_COLOR = Color.rgb(161, 210, 241);
    private static final int GROUND_COLOR = Color.rgb(171, 131, 35);

    @Override
    public void init() {

        /* Draw the sky */
        SurfaceImage backgroundTopImage = graphics().createSurface(graphics().width(), graphics().height() / 2);
        backgroundTopImage.surface().setFillColor(SKY_COLOR);
        backgroundTopImage.surface().fillRect(0, 0, backgroundTopImage.width(), backgroundTopImage.height());

        ImageLayer backgroundTop = graphics().createImageLayer(backgroundTopImage);
        graphics().rootLayer().addAt(backgroundTop, 0, 0);

        /*Draw the ground */
        SurfaceImage groundBottomImage = graphics().createSurface(graphics().width(), graphics().height() / 4);
        groundBottomImage.surface().setFillColor(GROUND_COLOR);
        PlayN.log().debug("groundBottomImage.height()=" + groundBottomImage.height());
        groundBottomImage.surface().fillRect(0, 0, groundBottomImage.width(), groundBottomImage.height());

        ImageLayer groundBottom = graphics().createImageLayer(groundBottomImage);
        PlayN.log().debug("graphics().height() * (3 / 4)=" + graphics().height() * (3f / 4f));
        graphics().rootLayer().addAt(groundBottom, 0, graphics().height() * (3f / 4f));

    }

Original issue reported on code.google.com by torlb...@gmail.com on 12 Feb 2014 at 1:13

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in trunk. I'll ship a 1.8.1 release to get that (and a few other fixes) 
out.

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