Commit Graph

22 Commits

Author SHA1 Message Date
hugovk
6e9e4c1027 Remove unexposed and unused code 2017-05-15 22:59:25 +03:00
hugovk
2968313bb6 Remove unrunnable code: ImagingDrawWideLine is only called (in _imaging.c) when (width <= 1) is false 2017-05-15 21:17:33 +03:00
Andrew Murray
ebf2121338 Removed trailing whitespace 2016-07-01 22:05:18 +10:00
wiredfool
d0ae5bc75e added check to prevent arcs > 360 degrees 2016-06-16 01:05:41 -07:00
wiredfool
5369d8edd7 Replace SIZE_MAX with type specific _MAX 2016-06-08 06:21:38 -07:00
wiredfool
4b4ef5f1e2 Malloc check, realloc, #1715 2016-06-08 06:21:38 -07:00
wiredfool
52d60cd096 Malloc check, #1715 2016-06-08 06:21:38 -07:00
Andrew Murray
8f9b3a7372 Changed arcs, chords and pie slices to use floats 2015-12-09 00:28:52 +11:00
Andrew Murray
16261beeba Fixed polygon edge drawing 2015-06-05 11:16:33 +10:00
Andrew Murray
006229595a Remove unused variable in libImaging 2014-10-02 07:48:12 +10:00
wiredfool
98a4991762 Using local block rather than array literal 2014-07-01 10:20:15 -07:00
wiredfool
a10b91786a Fix compilation errors with C90 standard 2014-07-01 10:05:38 -07:00
Terseus
8eae39e98f Oops, added missing ';'
Now writing in the wall "don't push before compile" 100 times.
2014-04-04 19:20:29 +02:00
Terseus
2f6a4d5f1a Added missing free when xx fail 2014-04-04 18:57:08 +02:00
Terseus
696924f5ac Added missing xx pointer check 2014-04-04 14:02:36 +02:00
Terseus
dbe3db6fc5 Oops, fixed typo in comments 2014-04-03 11:15:21 +02:00
Terseus
be09da6507 Rewrite of the ImagingDrawWideLine function
The previous version of the function didn't generate correct wide lines
of even width.

The most notable changes are:
  * Make variable names far more descriptive about the process.
  * Corrected the width calculation; we should deduct one pixel from the
    width because the pixels at the center of the line doesn't count for
    the triangles.
  * Now we calculate *two* ratios, one for left/top displacement (dxmin)
    and one for right/bottom (dxmax), this fix the behavior with lines
    of even width.

It can probably be optimized.
2014-04-02 21:30:42 +02:00
Terseus
cd332fc38a Rewrite of the polygon_generic function
The (previously refactored) polygon_generic function didn't draw
consistent polygons (equilateral polygons were not equilateral nor
symmetrical).

The most notable changes are:
  * The horizontal edges are searched for when finding the polygon
    boundaries, drawn and discarded from the edge list used to detect
    intersections.
  * The intersections are now checked and calculated from the current value
    of the scan line (ymin) instead of in the middle (ymin + 0.5).
  * Because the change in the scan line behavior, we should duplicate
    the intersections in the maximum Y value of an edge or there will be
    draw errors with concave and complex polygons.
  * The rounds of the X coordinates in the hline function calls are
    switched to draw the inner pixels.
  * Removed the ugly micro-optimization of qsort at the end.

This implementation of the scan line algorithm may not be technically
correct, it's not optimized and it have problems with some edge cases,
like a wide line from (x0, y) to (x1, y + 1), therefore it should be
reviewed in the future.
2014-04-02 21:05:13 +02:00
Terseus
8739613cfb Implementation of rounds around zero
The rounds used in the library are towards positive/negative infinity.
Since we're in a cartesian plane, rounds around zero are much more
convenient, so we can use positive and negative values with consistent
results.
2014-04-01 13:08:15 +02:00
Terseus
deecd8a137 Refactored polygon functions to unify logic
The functions `polygon8`, `polygon32` and `polygon32rgba` all have exactly
the same logic in code, only changes the hline function called inside.

Now all the logic is contained in `polygon_generic` which gets a
function pointer to the hline handler, so there is no duplicated code
anymore.
2014-04-01 13:01:03 +02:00
Alex Clark
bb1b3a532c Cleanup WS, courtesy of @Arfrever
find * -type f "-(" -name "*.bdf" -o -name "*.c" -o -name "*.h" -o -name "*.py" -o -name "*.rst" -o -name "*.txt" "-)" -exec sed -e "s/[[:space:]]*$//" -i {} \;
2013-06-30 18:42:19 -04:00
Alex Clark
9a640e3157 Forking PIL 2010-07-30 22:52:47 -04:00