Skip to content

Rectangle madness #8

@vicuna

Description

@vicuna

Original bug ID: 7498
Reporter: iesvs
Assigned to: @diml
Status: assigned (set by @diml on 2017-04-21T12:43:38Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.04.0
Category: standard library

Bug description

Graphics.draw_rect and Graphics.fill_rect have strange behaviors.

I will suppose that they use the same meaning for their arguments.
I see two behaviors

  1. how I understand the documentation
    fill_rect x y z h
    means { px, py : x <= px < x + w and y <= py < y + h }

  2. what is currently implemented on Linux
    fill_rect x y z h
    means { px, py : x <= px <= x + w and y <= py <= y + h }

In any cases the behavior of windows must be the same. I use the C compiler of VS 2010 to compile ocaml.

For the case 1, Linux must be changed and Windows too
I have the fix fix1.patch

For the case 2, Windows does not do the same thing as Linux
I have the fix fix2.patch

I also add a test file (test.ml).

ocamlopt -o test graphics.cmxa test.ml && ./test 1
will test the case 1
and
ocamlopt -o test graphics.cmxa test.ml && ./test 2
will test the case 2

The documentation of get_image states that the arguments have the same meaning than fill_rect. That's why case 1 is probably the expected behavior.

By the way, there is the commit
9f20c9c8a10307f40406890352ba3fbb2e4bd735
which looks like the opposite of fix1 (for the Linux part). That's strange.

I don't have Mac OS X to test, sorry.

File attachments

Metadata

Metadata

Assignees

No one assigned

    Labels

    mantisIssues imported from Mantis (i.e. old...)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions