cyang1 / depixelize

A C++ implementation of the SIGGRAPH 2011 paper Depixelizing Pixel Art, by Johannes Kopf and Dani Lischinski
53 stars 13 forks source link

squash some compiler warnings, just in case #2

Closed bsl closed 9 years ago

bsl commented 9 years ago

In spline_optimizer.cpp, I think I'm just silencing a warning that had no practical negative consequence. But the code looked a little alarming, because there was no confirmation that the thing being searched for was actually found.

In bspline.hpp, I got rid of a worrisome floating point comparison. I think it may also fix a memory leak. Please double-check.

cyang1 commented 9 years ago

Correct, in spline_optimizer.cpp, on lines 321-326, it is guaranteed that there will be exactly 3 adjacent edges to the common point, so last_edge will always be assigned to a value, but silencing a compiler warning is nice.

The fix in bspline.hpp is solid.

I believe the original idea behind the floating point equality comparison in the Point class was to return true if two points were exactly the same (a common endpoint of two line segments is an example), so the floating point representation should be exactly the same as well, but I see no harm in correcting the comparison.

I've added just one comment to this pull request in the code, everything else looks good!