diff --git a/include/mapnik/png_io.hpp b/include/mapnik/png_io.hpp index 2e5712e24..a9e8bafac 100644 --- a/include/mapnik/png_io.hpp +++ b/include/mapnik/png_io.hpp @@ -120,7 +120,7 @@ void save_as_png(T1 & file, (opts.trans_mode == 0) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA,PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT); const std::unique_ptr row_pointers(new png_bytep[image.height()]); - for (unsigned int i = 0; i < image.height(); i++) + for (unsigned int i = 0; i < image.height(); ++i) { row_pointers[i] = const_cast(reinterpret_cast(image.get_row(i))); } @@ -141,7 +141,7 @@ void reduce_8(T const& in, unsigned height = in.height(); std::vector alphaCount(alpha.size()); - for(unsigned i=0; i0; j--) + for(int j=levels-1; j>0; --j) { if (U2ALPHA(val)>=limits[j] && trees[j].colors()>0) { @@ -166,12 +166,12 @@ void reduce_8(T const& in, if (idx>=0 && idx < static_cast(alpha.size())) { alpha[idx]+=U2ALPHA(val); - alphaCount[idx]++; + ++alphaCount[idx]; } row_out[x] = index; } } - for(unsigned i=0; i alphaCount(alpha.size()); - for(unsigned i=0; i0; j--) + for(int j=levels-1; j>0; --j) { if (U2ALPHA(val)>=limits[j] && trees[j].colors()>0) { @@ -217,7 +217,7 @@ void reduce_4(T const& in, if (idx>=0 && idx < static_cast(alpha.size())) { alpha[idx]+=U2ALPHA(val); - alphaCount[idx]++; + ++alphaCount[idx]; } if (x%2 == 0) { @@ -226,7 +226,7 @@ void reduce_4(T const& in, row_out[x>>1] |= index; } } - for(unsigned i=0; i const& palette, unsigned width, unsigned height, unsigned color_depth, - std::vector const&alpha, + std::vector const& alpha, png_options const& opts) { png_voidp error_ptr=0; @@ -302,7 +302,7 @@ void save_as_png(T & file, std::vector const& palette, { std::vector trans(alpha.size()); unsigned alphaSize=0;//truncate to nonopaque values - for(unsigned i=0; i < alpha.size(); i++) + for(unsigned i=0; i < alpha.size(); ++i) { trans[i]=alpha[i]; if (alpha[i]<255) @@ -317,7 +317,7 @@ void save_as_png(T & file, std::vector const& palette, } png_write_info(png_ptr, info_ptr); - for (unsigned i=0;i(image.get_row(i))); } @@ -346,7 +346,7 @@ void save_as_png8_oct(T1 & file, } else { - for(int i=0; i<256; i++) + for(int i=0; i<256; ++i) { alphaHist[i] = 0; } @@ -355,11 +355,11 @@ void save_as_png8_oct(T1 & file, for (unsigned x = 0; x < width; ++x) { unsigned val = U2ALPHA(static_cast(image.get_row(y)[x])); - alphaHist[val]++; + ++alphaHist[val]; meanAlpha += val; if (val>0 && val<255) { - semiCount++; + ++semiCount; } } } @@ -371,17 +371,17 @@ void save_as_png8_oct(T1 & file, limits[0] = 0; limits[1] = (opts.trans_mode!=0 && alphaHist[0]>0)?1:0; limits[TRANSPARENCY_LEVELS] = 256; - for(unsigned j=2; j12 && cols[j] trees[MAX_OCTREE_LEVELS]; - for(unsigned j=1; j0; j--) + for(unsigned j=TRANSPARENCY_LEVELS-1; j>0; --j) { if (cols[j]>0 && U2ALPHA(val)>=limits[j]) { @@ -495,7 +495,7 @@ void save_as_png8_oct(T1 & file, palette.push_back(rgb(0,0,0)); } - for(unsigned j=1; j0) {