fix build with libpng-1.5 and newer

patch from "laloch <lalochcz@gmail.com>"