Intentation fix

Removed tabs and space at the end of line.

Signed-off-by: Celelibi <celelibi@gmail.com>
Failed to create the two rasterize functions

- draw .c/h rasterize functions are coded but there's a core dump
- main.c old code is commented, try to call drawing_rasterize
Added debug symbols when building

Added -ggdb in CFLAGS in the Makefile.

Signed-off-by: Celelibi <celelibi@gmail.com>
Allocated the default drawing

Instead of making the global drawing a pointer, it's now a struct.

Signed-off-by: Celelibi <celelibi@gmail.com>
Don't crash when the polygon list is empty

Test the first pointer instead of the next one, so that the empty get
drawn correctly (not drawing anything).

Signed-off-by: Celelibi <celelibi@gmail.com>
New function for allocating a new polygon

This function append the new polygon to the list and set it as the
active polygon. The active polygon is the one the user is working on.

Signed-off-by: Celelibi <celelibi@gmail.com>
Use the active polygon

The active polygon is the one the user is working on. It's not
necessarily the first polygon in the list.

Signed-off-by: Celelibi <celelibi@gmail.com>
Don't remove the polygons rasterized

We need to keep them around since they will be rasterized a lot if time.

Signed-off-by: Celelibi <celelibi@gmail.com>
Merge branch 'rasterize'

Signed-off-by: Celelibi <celelibi@gmail.com>

Conflicts:
	draw.h
Don't close the vertex list if the polygon isn't

Make the vertex list reflect better the choice of closing (or not) the
polygon. There are two new functions: polygon_toggle_close and
polygon_is_closed to deal with that.

Signed-off-by: Celelibi <celelibi@gmail.com>
Polygon functions should take a struct polygon *

Polygon functions act on polygons. Thus they should take a polygon as
argument, and not a struct vertex*. Moreover, the function
polygon_remove_vertex can be greatly simplied with the double linked
list.

Signed-off-by: Celelibi <celelibi@gmail.com>
Leave glut main loop cleanly

Don't call exit(), this provoke an error and a "pure virtual method
call". Call glutLeaveMainLoop to return to the main.

Signed-off-by: Celelibi <celelibi@gmail.com>
Remove useless commented code

This code has been moved to draw.h and draw.c and is no longer needed
here.

Signed-off-by: Celelibi <celelibi@gmail.com>
Toggle the filling indicator

Toggle is_filled boolean as needed. Especially, it is set to false when
the polygon is reopened and never set to true when the polygon is
already open.

Signed-off-by: Celelibi <celelibi@gmail.com>
Corrected a few warnings

Some function arguments are mandatory because they are OpenGL callback
functions. Now they won't be warned by gcc.

Signed-off-by: Celelibi <celelibi@gmail.com>
polygon_get_last_vertex wasn't used

This function was declared static and wasn't used at all. If needed,
it's still in the git history.

Signed-off-by: Celelibi <celelibi@gmail.com>
Ppm.c: Commented out useless function

There were two static functions in Ppm.c that weren't used and produced
warnings.

Signed-off-by: Celelibi <celelibi@gmail.com>
scanline filling almost work

It works with concave and self-intersecting polygons. However, with
enough segments, it crash for some reasons. The case of horizontal
segments may not be handled right now and may produce unexpected
results.

The Bresenham-like algorithm used for following the edges is not exactly
the same as the one in segment_rasterize, hence a thin black like on the
edges.

It could also be optimized by sorting the active edge list with an
algorithm optimized for almost-already-sorted lists.

Signed-off-by: Celelibi <celelibi@gmail.com>