merge a few small 0.7 branch changes back into trunk

This commit is contained in:
Dane Springmeyer 2010-01-11 00:36:51 +00:00
parent 644843230d
commit f87790cd5b
5 changed files with 62 additions and 29 deletions

View file

@ -109,12 +109,13 @@ 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;
@ -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()];
std::vector<png_byte> 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)
alphaSize = i+1;
}
if (alphaSize>0)
png_set_tRNS(png_ptr, info_ptr, (png_bytep)trans, alphaSize, NULL);
png_set_tRNS(png_ptr, info_ptr, (png_bytep)&trans[0], alphaSize, 0);
}
png_write_info(png_ptr, info_ptr);
@ -389,7 +392,7 @@ 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 )
{

View file

@ -71,6 +71,21 @@ 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) {
#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
@ -82,6 +97,7 @@ std::string numeric2string(const char* buf)
ss << "0"; // 0100 - 0999
break;
}
#endif
}
ss << digits[d++];
} else {

View file

@ -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

View file

@ -0,0 +1,3 @@
<Map bgcolor="steelblue" minimum_version="50.0.0">
<!-- arbitrarily large version number that should throw error -->
</Map>