merge a few small 0.7 branch changes back into trunk
This commit is contained in:
parent
644843230d
commit
f87790cd5b
5 changed files with 62 additions and 29 deletions
|
@ -109,18 +109,19 @@ namespace mapnik {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void reduce_8 (T const& in, image_data_8 & out, octree<rgb> trees[], unsigned limits[], std::vector<unsigned> &alpha)
|
||||
void reduce_8 (T const& in, image_data_8 & out, octree<rgb> trees[], unsigned limits[], std::vector<unsigned> & alpha)
|
||||
{
|
||||
unsigned width = in.width();
|
||||
unsigned height = in.height();
|
||||
|
||||
unsigned alphaCount[alpha.size()];
|
||||
//unsigned alphaCount[alpha.size()];
|
||||
std::vector<unsigned> alphaCount(alpha.size());
|
||||
for(unsigned i=0; i<alpha.size(); i++)
|
||||
{
|
||||
alpha[i] = 0;
|
||||
alphaCount[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
for (unsigned y = 0; y < height; ++y)
|
||||
{
|
||||
mapnik::image_data_32::pixel_type const * row = in.getRow(y);
|
||||
|
@ -153,12 +154,13 @@ namespace mapnik {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void reduce_4 (T const& in, image_data_8 & out, octree<rgb> trees[], unsigned limits[], std::vector<unsigned> &alpha)
|
||||
void reduce_4 (T const& in, image_data_8 & out, octree<rgb> trees[], unsigned limits[], std::vector<unsigned> & alpha)
|
||||
{
|
||||
unsigned width = in.width();
|
||||
unsigned height = in.height();
|
||||
|
||||
unsigned alphaCount[alpha.size()];
|
||||
//unsigned alphaCount[alpha.size()];
|
||||
std::vector<unsigned> alphaCount(alpha.size());
|
||||
for(unsigned i=0; i<alpha.size(); i++)
|
||||
{
|
||||
alpha[i] = 0;
|
||||
|
@ -200,7 +202,7 @@ namespace mapnik {
|
|||
|
||||
// 1-bit but only one color.
|
||||
template <typename T>
|
||||
void reduce_1(T const&, image_data_8 & out, octree<rgb> trees[], unsigned limits[], std::vector<unsigned> &alpha)
|
||||
void reduce_1(T const&, image_data_8 & out, octree<rgb> trees[], unsigned limits[], std::vector<unsigned> & alpha)
|
||||
{
|
||||
out.set(0); // only one color!!!
|
||||
}
|
||||
|
@ -249,15 +251,16 @@ namespace mapnik {
|
|||
// make transparent lowest indexes, so tRNS is small
|
||||
if (alpha.size()>0)
|
||||
{
|
||||
png_byte trans[alpha.size()];
|
||||
unsigned alphaSize=0;//truncate to nonopaque values
|
||||
for(unsigned i=0; i<alpha.size(); i++){
|
||||
trans[i]=alpha[i];
|
||||
if (alpha[i]<255)
|
||||
alphaSize = i+1;
|
||||
}
|
||||
if (alphaSize>0)
|
||||
png_set_tRNS(png_ptr, info_ptr, (png_bytep)trans, alphaSize, NULL);
|
||||
std::vector<png_byte> trans(alpha.size());
|
||||
unsigned alphaSize=0;//truncate to nonopaque values
|
||||
for(unsigned i=0; i < alpha.size(); i++)
|
||||
{
|
||||
trans[i]=alpha[i];
|
||||
if (alpha[i]<255)
|
||||
alphaSize = i+1;
|
||||
}
|
||||
if (alphaSize>0)
|
||||
png_set_tRNS(png_ptr, info_ptr, (png_bytep)&trans[0], alphaSize, 0);
|
||||
}
|
||||
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
|
@ -389,8 +392,8 @@ namespace mapnik {
|
|||
//transparency values per palette index
|
||||
std::vector<unsigned> alphaTable;
|
||||
//alphaTable.resize(palette.size());//allow semitransparency also in almost opaque range
|
||||
alphaTable.resize(palette.size()-cols[TRANSPARENCY_LEVELS-1]);
|
||||
|
||||
alphaTable.resize(palette.size() - cols[TRANSPARENCY_LEVELS-1]);
|
||||
|
||||
if (palette.size() > 16 )
|
||||
{
|
||||
// >16 && <=256 colors -> write 8-bit color depth
|
||||
|
|
|
@ -71,17 +71,33 @@ std::string numeric2string(const char* buf)
|
|||
if (i <= weight && d < ndigits) {
|
||||
// All digits after the first must be padded to make the field 4 characters long
|
||||
if (d != 0) {
|
||||
switch(digits[d]) {
|
||||
case 0 ... 9:
|
||||
ss << "000"; // 0000 - 0009
|
||||
break;
|
||||
case 10 ... 99:
|
||||
ss << "00"; // 0010 - 0099
|
||||
break;
|
||||
case 100 ... 999:
|
||||
ss << "0"; // 0100 - 0999
|
||||
break;
|
||||
}
|
||||
#ifdef _WINDOWS
|
||||
int dig = digits[d];
|
||||
if (dig < 10)
|
||||
{
|
||||
ss << "000"; // 0000 - 0009
|
||||
}
|
||||
else if (dig < 100)
|
||||
{
|
||||
ss << "00"; // 0010 - 0099
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << "0"; // 0100 - 0999;
|
||||
}
|
||||
#else
|
||||
switch(digits[d]) {
|
||||
case 0 ... 9:
|
||||
ss << "000"; // 0000 - 0009
|
||||
break;
|
||||
case 10 ... 99:
|
||||
ss << "00"; // 0010 - 0099
|
||||
break;
|
||||
case 100 ... 999:
|
||||
ss << "0"; // 0100 - 0999
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ss << digits[d++];
|
||||
} else {
|
||||
|
|
|
@ -891,7 +891,18 @@ namespace mapnik
|
|||
get_attr<label_placement_e>(sym, "placement", POINT_PLACEMENT);
|
||||
text_symbol.set_label_placement( placement );
|
||||
// vertical alignment
|
||||
vertical_alignment_e valign = get_attr<vertical_alignment_e>(sym, "vertical_alignment", MIDDLE);
|
||||
|
||||
vertical_alignment_e default_vertical_alignment = MIDDLE;
|
||||
if (dy > 0.0 )
|
||||
{
|
||||
default_vertical_alignment = BOTTOM;
|
||||
}
|
||||
else if( dy < 0.0 )
|
||||
{
|
||||
default_vertical_alignment = TOP;
|
||||
}
|
||||
|
||||
vertical_alignment_e valign = get_attr<vertical_alignment_e>(sym, "vertical_alignment", default_vertical_alignment);
|
||||
text_symbol.set_vertical_alignment(valign);
|
||||
|
||||
// halo fill and radius
|
||||
|
|
3
tests/data/broken_maps/mapnik_min_version.xml
Normal file
3
tests/data/broken_maps/mapnik_min_version.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<Map bgcolor="steelblue" minimum_version="50.0.0">
|
||||
<!-- arbitrarily large version number that should throw error -->
|
||||
</Map>
|
Loading…
Reference in a new issue