integrate various minor c++ style and cast fixes into master from c++11 branch
This commit is contained in:
parent
b6040ac324
commit
d3ab601e30
19 changed files with 110 additions and 114 deletions
|
@ -139,27 +139,27 @@ inline expr_node& operator- (expr_node& expr)
|
||||||
return expr = unary_node<tags::negate>(expr);
|
return expr = unary_node<tags::negate>(expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline expr_node & operator += ( expr_node &left ,const expr_node &right)
|
inline expr_node & operator += ( expr_node &left, expr_node const& right)
|
||||||
{
|
{
|
||||||
return left = binary_node<tags::plus>(left,right);
|
return left = binary_node<tags::plus>(left,right);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline expr_node & operator -= ( expr_node &left ,const expr_node &right)
|
inline expr_node & operator -= ( expr_node &left, expr_node const& right)
|
||||||
{
|
{
|
||||||
return left = binary_node<tags::minus>(left,right);
|
return left = binary_node<tags::minus>(left,right);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline expr_node & operator *= ( expr_node &left ,const expr_node &right)
|
inline expr_node & operator *= ( expr_node &left , expr_node const& right)
|
||||||
{
|
{
|
||||||
return left = binary_node<tags::mult>(left,right);
|
return left = binary_node<tags::mult>(left,right);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline expr_node & operator /= ( expr_node &left ,const expr_node &right)
|
inline expr_node & operator /= ( expr_node &left , expr_node const& right)
|
||||||
{
|
{
|
||||||
return left = binary_node<tags::div>(left,right);
|
return left = binary_node<tags::div>(left,right);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline expr_node & operator %= ( expr_node &left ,const expr_node &right)
|
inline expr_node & operator %= ( expr_node &left , expr_node const& right)
|
||||||
{
|
{
|
||||||
return left = binary_node<tags::mod>(left,right);
|
return left = binary_node<tags::mod>(left,right);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,10 +38,10 @@ public:
|
||||||
font_set(std::string const& name);
|
font_set(std::string const& name);
|
||||||
font_set(font_set const& rhs);
|
font_set(font_set const& rhs);
|
||||||
font_set& operator=(font_set const& rhs);
|
font_set& operator=(font_set const& rhs);
|
||||||
unsigned size() const;
|
std::size_t size() const;
|
||||||
void set_name(std::string const& name);
|
void set_name(std::string const& name);
|
||||||
std::string const& get_name() const;
|
std::string const& get_name() const;
|
||||||
void add_face_name(std::string);
|
void add_face_name(std::string const& face_name);
|
||||||
std::vector<std::string> const& get_face_names() const;
|
std::vector<std::string> const& get_face_names() const;
|
||||||
~font_set();
|
~font_set();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -351,19 +351,19 @@ public:
|
||||||
pal_remap_.resize(sorted_pal_.size());
|
pal_remap_.resize(sorted_pal_.size());
|
||||||
palette.clear();
|
palette.clear();
|
||||||
palette.reserve(sorted_pal_.size());
|
palette.reserve(sorted_pal_.size());
|
||||||
for (unsigned i=0; i<sorted_pal_.size(); i++)
|
for (unsigned i=0; i<sorted_pal_.size(); ++i)
|
||||||
{
|
{
|
||||||
if (sorted_pal_[i].a<255)
|
if (sorted_pal_[i].a<255)
|
||||||
{
|
{
|
||||||
pal_remap_[i] = palette.size();
|
pal_remap_[i] = static_cast<unsigned>(palette.size());
|
||||||
palette.push_back(sorted_pal_[i]);
|
palette.push_back(sorted_pal_[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (unsigned i=0; i<sorted_pal_.size(); i++)
|
for (unsigned i=0; i<sorted_pal_.size(); ++i)
|
||||||
{
|
{
|
||||||
if (sorted_pal_[i].a==255)
|
if (sorted_pal_[i].a==255)
|
||||||
{
|
{
|
||||||
pal_remap_[i] = palette.size();
|
pal_remap_[i] = static_cast<unsigned>(palette.size());
|
||||||
palette.push_back(sorted_pal_[i]);
|
palette.push_back(sorted_pal_[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,7 @@ public:
|
||||||
palette.push_back(rgb(byte(itr->reds/float(count)),
|
palette.push_back(rgb(byte(itr->reds/float(count)),
|
||||||
byte(itr->greens/float(count)),
|
byte(itr->greens/float(count)),
|
||||||
byte(itr->blues/float(count))));
|
byte(itr->blues/float(count))));
|
||||||
itr->index = palette.size() - 1;
|
itr->index = static_cast<unsigned>(palette.size()) - 1;
|
||||||
}
|
}
|
||||||
for (unsigned i=0; i < 8 ;++i)
|
for (unsigned i=0; i < 8 ;++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,7 +88,6 @@ void save_as_png(T1 & file,
|
||||||
writer.toStream(file);
|
writer.toStream(file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_voidp error_ptr=0;
|
png_voidp error_ptr=0;
|
||||||
png_structp png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
png_structp png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||||
error_ptr,0, 0);
|
error_ptr,0, 0);
|
||||||
|
@ -275,7 +274,6 @@ void save_as_png(T & file, std::vector<mapnik::rgb> const& palette,
|
||||||
writer.toStream(file);
|
writer.toStream(file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_voidp error_ptr=0;
|
png_voidp error_ptr=0;
|
||||||
png_structp png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
png_structp png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||||
error_ptr,0, 0);
|
error_ptr,0, 0);
|
||||||
|
@ -316,7 +314,7 @@ void save_as_png(T & file, std::vector<mapnik::rgb> const& palette,
|
||||||
PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
|
PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
|
||||||
|
|
||||||
png_color* pal = const_cast<png_color*>(reinterpret_cast<const png_color*>(&palette[0]));
|
png_color* pal = const_cast<png_color*>(reinterpret_cast<const png_color*>(&palette[0]));
|
||||||
png_set_PLTE(png_ptr, info_ptr, pal, palette.size());
|
png_set_PLTE(png_ptr, info_ptr, pal, static_cast<unsigned>(palette.size()));
|
||||||
|
|
||||||
// make transparent lowest indexes, so tRNS is small
|
// make transparent lowest indexes, so tRNS is small
|
||||||
if (alpha.size()>0)
|
if (alpha.size()>0)
|
||||||
|
@ -531,15 +529,12 @@ void save_as_png8_oct(T1 & file,
|
||||||
leftovers = 0;
|
leftovers = 0;
|
||||||
}
|
}
|
||||||
std::vector<rgb> pal;
|
std::vector<rgb> pal;
|
||||||
trees[j].setOffset(palette.size());
|
trees[j].setOffset( static_cast<unsigned>(palette.size()));
|
||||||
trees[j].create_palette(pal);
|
trees[j].create_palette(pal);
|
||||||
assert(pal.size() <= max_colors);
|
assert(pal.size() <= max_colors);
|
||||||
leftovers = cols[j]-pal.size();
|
leftovers = cols[j] - static_cast<unsigned>(pal.size());
|
||||||
cols[j] = pal.size();
|
cols[j] = static_cast<unsigned>(pal.size());
|
||||||
for(unsigned i=0; i<pal.size(); i++)
|
palette.insert(palette.begin(), pal.begin(), pal.end());
|
||||||
{
|
|
||||||
palette.push_back(pal[i]);
|
|
||||||
}
|
|
||||||
assert(palette.size() <= 256);
|
assert(palette.size() <= 256);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
public:
|
public:
|
||||||
processed_text(face_manager<freetype_engine> & font_manager, double scale_factor);
|
processed_text(face_manager<freetype_engine> & font_manager, double scale_factor);
|
||||||
void push_back(char_properties const& properties, mapnik::value_unicode_string const& text);
|
void push_back(char_properties const& properties, mapnik::value_unicode_string const& text);
|
||||||
unsigned size() const { return expr_list_.size(); }
|
std::size_t size() const { return expr_list_.size(); }
|
||||||
unsigned empty() const { return expr_list_.empty(); }
|
unsigned empty() const { return expr_list_.empty(); }
|
||||||
void clear();
|
void clear();
|
||||||
typedef std::list<processed_expression> expression_list;
|
typedef std::list<processed_expression> expression_list;
|
||||||
|
|
|
@ -919,7 +919,7 @@ public:
|
||||||
return vertices_.size() ? vertices_[vertices_.size() - 1].y : 0.0;
|
return vertices_.size() ? vertices_[vertices_.size() - 1].y : 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned total_vertices() const
|
std::size_t total_vertices() const
|
||||||
{
|
{
|
||||||
return vertices_.size();
|
return vertices_.size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
text_ += text;
|
text_ += text;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned num_characters() const
|
std::size_t num_characters() const
|
||||||
{
|
{
|
||||||
return characters_.size();
|
return characters_.size();
|
||||||
}
|
}
|
||||||
|
@ -87,12 +87,12 @@ public:
|
||||||
return is_rtl;
|
return is_rtl;
|
||||||
}
|
}
|
||||||
|
|
||||||
char_info const& at(unsigned i) const
|
char_info const& at(std::size_t i) const
|
||||||
{
|
{
|
||||||
return characters_[i];
|
return characters_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
char_info const& operator[](unsigned i) const
|
char_info const& operator[](std::size_t i) const
|
||||||
{
|
{
|
||||||
return at(i);
|
return at(i);
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Number of nodes. */
|
/** Number of nodes. */
|
||||||
int num_nodes() const
|
std::size_t num_nodes() const
|
||||||
{
|
{
|
||||||
return nodes_.size();
|
return nodes_.size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ static toff_t tiff_seek_proc(thandle_t fd, toff_t off, int whence)
|
||||||
// grow std::stringstream buffer (re: libtiff/tif_stream.cxx)
|
// grow std::stringstream buffer (re: libtiff/tif_stream.cxx)
|
||||||
std::ios::pos_type pos = out->tellp();
|
std::ios::pos_type pos = out->tellp();
|
||||||
// second check needed for clang (libcxx doesn't set failbit when seeking beyond the current buffer size
|
// second check needed for clang (libcxx doesn't set failbit when seeking beyond the current buffer size
|
||||||
|
|
||||||
if( out->fail() || static_cast<std::streamoff>(off) != pos)
|
if( out->fail() || static_cast<std::streamoff>(off) != pos)
|
||||||
{
|
{
|
||||||
std::ios::iostate old_state;
|
std::ios::iostate old_state;
|
||||||
|
@ -143,7 +144,7 @@ static toff_t tiff_size_proc(thandle_t fd)
|
||||||
out->seekp(0, std::ios::end);
|
out->seekp(0, std::ios::end);
|
||||||
std::ios::pos_type len = out->tellp();
|
std::ios::pos_type len = out->tellp();
|
||||||
out->seekp(pos);
|
out->seekp(pos);
|
||||||
return (toff_t)len;
|
return static_cast<toff_t>(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static tsize_t tiff_dummy_read_proc(thandle_t , tdata_t , tsize_t)
|
static tsize_t tiff_dummy_read_proc(thandle_t , tdata_t , tsize_t)
|
||||||
|
@ -167,6 +168,7 @@ void save_as_tiff(T1 & file, T2 const& image)
|
||||||
const int height = image.height();
|
const int height = image.height();
|
||||||
const int scanline_size = sizeof(unsigned char) * width * 3;
|
const int scanline_size = sizeof(unsigned char) * width * 3;
|
||||||
|
|
||||||
|
|
||||||
TIFF* output = RealTIFFOpen("mapnik_tiff_stream",
|
TIFF* output = RealTIFFOpen("mapnik_tiff_stream",
|
||||||
"wm",
|
"wm",
|
||||||
(thandle_t)&file,
|
(thandle_t)&file,
|
||||||
|
@ -264,5 +266,4 @@ void save_as_tiff(T1 & file, T2 const& image)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // MAPNIK_TIFF_IO_HPP
|
#endif // MAPNIK_TIFF_IO_HPP
|
||||||
|
|
|
@ -57,10 +57,10 @@ bool parse_dasharray(Iterator first, Iterator last, std::vector<double>& dasharr
|
||||||
#endif
|
#endif
|
||||||
| lit("none")),
|
| lit("none")),
|
||||||
qi::ascii::space);
|
qi::ascii::space);
|
||||||
|
|
||||||
if (first != last)
|
if (first != last)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,11 @@
|
||||||
#include <boost/fusion/include/boost_tuple.hpp>
|
#include <boost/fusion/include/boost_tuple.hpp>
|
||||||
#include <boost/type_traits/remove_pointer.hpp>
|
#include <boost/type_traits/remove_pointer.hpp>
|
||||||
|
|
||||||
/*!
|
|
||||||
* adapted to conform to the concepts
|
// adapted to conform to the concepts
|
||||||
* required by Karma to be recognized as a container of
|
// required by Karma to be recognized as a container of
|
||||||
* attributes for output generation.
|
// attributes for output generation.
|
||||||
*/
|
|
||||||
namespace boost { namespace spirit { namespace traits {
|
namespace boost { namespace spirit { namespace traits {
|
||||||
|
|
||||||
// TODO - this needs to be made generic to any path type
|
// TODO - this needs to be made generic to any path type
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include <boost/fusion/include/at_c.hpp>
|
#include <boost/fusion/include/at_c.hpp>
|
||||||
#include <boost/fusion/include/make_vector.hpp>
|
#include <boost/fusion/include/make_vector.hpp>
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/array.hpp>
|
#include <boost/array.hpp>
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
|
|
@ -47,9 +47,11 @@ int webp_stream_write(const uint8_t* data, size_t data_size, const WebPPicture*
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string webp_encoding_error(WebPEncodingError error) {
|
std::string webp_encoding_error(WebPEncodingError error)
|
||||||
|
{
|
||||||
std::string os;
|
std::string os;
|
||||||
switch (error) {
|
switch (error)
|
||||||
|
{
|
||||||
case VP8_ENC_ERROR_OUT_OF_MEMORY: os = "memory error allocating objects"; break;
|
case VP8_ENC_ERROR_OUT_OF_MEMORY: os = "memory error allocating objects"; break;
|
||||||
case VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY: os = "memory error while flushing bits"; break;
|
case VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY: os = "memory error while flushing bits"; break;
|
||||||
case VP8_ENC_ERROR_NULL_PARAMETER: os = "a pointer parameter is NULL"; break;
|
case VP8_ENC_ERROR_NULL_PARAMETER: os = "a pointer parameter is NULL"; break;
|
||||||
|
@ -83,19 +85,20 @@ void save_as_webp(T1& file,
|
||||||
|
|
||||||
// Add additional tuning
|
// Add additional tuning
|
||||||
if (method >= 0) config.method = method;
|
if (method >= 0) config.method = method;
|
||||||
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
||||||
config.lossless = !!lossless;
|
config.lossless = !!lossless;
|
||||||
config.image_hint = static_cast<WebPImageHint>(image_hint);
|
config.image_hint = static_cast<WebPImageHint>(image_hint);
|
||||||
#else
|
#else
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma NOTE(compiling against webp that does not support lossless flag)
|
#pragma NOTE(compiling against webp that does not support lossless flag)
|
||||||
#else
|
#else
|
||||||
#warning "compiling against webp that does not support lossless flag"
|
#warning "compiling against webp that does not support lossless flag"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool valid = WebPValidateConfig(&config);
|
bool valid = WebPValidateConfig(&config);
|
||||||
if (!valid) {
|
if (!valid)
|
||||||
|
{
|
||||||
throw std::runtime_error("Invalid configuration");
|
throw std::runtime_error("Invalid configuration");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,9 +109,9 @@ void save_as_webp(T1& file,
|
||||||
}
|
}
|
||||||
pic.width = image.width();
|
pic.width = image.width();
|
||||||
pic.height = image.height();
|
pic.height = image.height();
|
||||||
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
||||||
pic.use_argb = !!lossless;
|
pic.use_argb = !!lossless;
|
||||||
#endif
|
#endif
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
if (alpha)
|
if (alpha)
|
||||||
{
|
{
|
||||||
|
@ -120,11 +123,11 @@ void save_as_webp(T1& file,
|
||||||
{
|
{
|
||||||
int stride = sizeof(typename T2::pixel_type) * image.width();
|
int stride = sizeof(typename T2::pixel_type) * image.width();
|
||||||
uint8_t const* bytes = reinterpret_cast<uint8_t const*>(image.getBytes());
|
uint8_t const* bytes = reinterpret_cast<uint8_t const*>(image.getBytes());
|
||||||
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
||||||
ok = WebPPictureImportRGBX(&pic, bytes, stride);
|
ok = WebPPictureImportRGBX(&pic, bytes, stride);
|
||||||
#else
|
#else
|
||||||
ok = WebPPictureImportRGBA(&pic, bytes, stride);
|
ok = WebPPictureImportRGBA(&pic, bytes, stride);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
|
|
|
@ -48,12 +48,12 @@ font_set& font_set::operator=(font_set const& other)
|
||||||
|
|
||||||
font_set::~font_set() {}
|
font_set::~font_set() {}
|
||||||
|
|
||||||
unsigned font_set::size() const
|
std::size_t font_set::size() const
|
||||||
{
|
{
|
||||||
return face_names_.size();
|
return face_names_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void font_set::add_face_name(std::string face_name)
|
void font_set::add_face_name(std::string const& face_name)
|
||||||
{
|
{
|
||||||
face_names_.push_back(face_name);
|
face_names_.push_back(face_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,8 +162,7 @@ void jpeg_reader<T>::skip(j_decompress_ptr cinfo, long count)
|
||||||
if (count <= 0) return; //A zero or negative skip count should be treated as a no-op.
|
if (count <= 0) return; //A zero or negative skip count should be treated as a no-op.
|
||||||
jpeg_stream_wrapper* wrap = reinterpret_cast<jpeg_stream_wrapper*>(cinfo->src);
|
jpeg_stream_wrapper* wrap = reinterpret_cast<jpeg_stream_wrapper*>(cinfo->src);
|
||||||
|
|
||||||
if (wrap->manager.bytes_in_buffer > 0u
|
if (wrap->manager.bytes_in_buffer > 0 && count < wrap->manager.bytes_in_buffer)
|
||||||
&& static_cast<unsigned long>(count) < wrap->manager.bytes_in_buffer)
|
|
||||||
{
|
{
|
||||||
wrap->manager.bytes_in_buffer -= count;
|
wrap->manager.bytes_in_buffer -= count;
|
||||||
wrap->manager.next_input_byte = &wrap->buffer[BUF_SIZE - wrap->manager.bytes_in_buffer];
|
wrap->manager.next_input_byte = &wrap->buffer[BUF_SIZE - wrap->manager.bytes_in_buffer];
|
||||||
|
@ -191,7 +190,7 @@ void jpeg_reader<T>::attach_stream (j_decompress_ptr cinfo, input_stream* in)
|
||||||
cinfo->src = (struct jpeg_source_mgr *)
|
cinfo->src = (struct jpeg_source_mgr *)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(jpeg_stream_wrapper));
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(jpeg_stream_wrapper));
|
||||||
}
|
}
|
||||||
typename jpeg_reader::jpeg_stream_wrapper * src = reinterpret_cast<typename jpeg_reader::jpeg_stream_wrapper*> (cinfo->src);
|
jpeg_reader::jpeg_stream_wrapper * src = reinterpret_cast<jpeg_reader::jpeg_stream_wrapper*> (cinfo->src);
|
||||||
src->manager.init_source = init_source;
|
src->manager.init_source = init_source;
|
||||||
src->manager.fill_input_buffer = fill_input_buffer;
|
src->manager.fill_input_buffer = fill_input_buffer;
|
||||||
src->manager.skip_input_data = skip;
|
src->manager.skip_input_data = skip;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
// stl
|
// stl
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
@ -81,8 +82,8 @@ bool rgba_palette::valid() const
|
||||||
|
|
||||||
std::string rgba_palette::to_string() const
|
std::string rgba_palette::to_string() const
|
||||||
{
|
{
|
||||||
unsigned length = rgb_pal_.size();
|
size_t length = rgb_pal_.size();
|
||||||
unsigned alphaLength = alpha_pal_.size();
|
size_t alphaLength = alpha_pal_.size();
|
||||||
std::ostringstream str("");
|
std::ostringstream str("");
|
||||||
str << "[Palette " << length;
|
str << "[Palette " << length;
|
||||||
if (length == 1)
|
if (length == 1)
|
||||||
|
@ -125,7 +126,7 @@ unsigned char rgba_palette::quantize(unsigned val) const
|
||||||
// find closest match based on mean of r,g,b,a
|
// find closest match based on mean of r,g,b,a
|
||||||
std::vector<rgba>::const_iterator pit =
|
std::vector<rgba>::const_iterator pit =
|
||||||
std::lower_bound(sorted_pal_.begin(), sorted_pal_.end(), c, rgba::mean_sort_cmp());
|
std::lower_bound(sorted_pal_.begin(), sorted_pal_.end(), c, rgba::mean_sort_cmp());
|
||||||
index = pit - sorted_pal_.begin();
|
index = std::distance(sorted_pal_.begin(),pit);
|
||||||
if (index == sorted_pal_.size()) index--;
|
if (index == sorted_pal_.size()) index--;
|
||||||
|
|
||||||
dr = sorted_pal_[index].r - c.r;
|
dr = sorted_pal_[index].r - c.r;
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <boost/spirit/include/phoenix_operator.hpp>
|
#include <boost/spirit/include/phoenix_operator.hpp>
|
||||||
#include <boost/fusion/include/std_pair.hpp>
|
#include <boost/fusion/include/std_pair.hpp>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -160,7 +161,7 @@ bool parse_reader(svg_parser & parser, xmlTextReaderPtr reader)
|
||||||
catch (std::exception const& ex)
|
catch (std::exception const& ex)
|
||||||
{
|
{
|
||||||
xmlFreeTextReader(reader);
|
xmlFreeTextReader(reader);
|
||||||
throw;
|
throw ex;
|
||||||
}
|
}
|
||||||
xmlFreeTextReader(reader);
|
xmlFreeTextReader(reader);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
|
@ -838,8 +839,7 @@ void parse_gradient_stop(svg_parser & parser, xmlTextReaderPtr reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
stop_color.set_alpha(opacity*255);
|
stop_color.set_alpha(static_cast<uint8_t>(opacity * 255));
|
||||||
|
|
||||||
parser.temporary_gradient_.second.add_stop(offset, stop_color);
|
parser.temporary_gradient_.second.add_stop(offset, stop_color);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -212,7 +212,8 @@ void text_symbolizer_helper<FaceManagerT, DetectorT>::initialize_geometries()
|
||||||
{
|
{
|
||||||
bool largest_box_only = false;
|
bool largest_box_only = false;
|
||||||
std::size_t num_geom = feature_.num_geometries();
|
std::size_t num_geom = feature_.num_geometries();
|
||||||
for (std::size_t i=0; i<num_geom; ++i)
|
|
||||||
|
for (std::size_t i = 0; i < num_geom; ++i)
|
||||||
{
|
{
|
||||||
geometry_type const& geom = feature_.get_geometry(i);
|
geometry_type const& geom = feature_.get_geometry(i);
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,7 @@ extern "C"
|
||||||
#include <tiffio.h>
|
#include <tiffio.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik { namespace impl {
|
||||||
{
|
|
||||||
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
static toff_t tiff_seek_proc(thandle_t fd, toff_t off, int whence)
|
static toff_t tiff_seek_proc(thandle_t fd, toff_t off, int whence)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +58,7 @@ static toff_t tiff_seek_proc(thandle_t fd, toff_t off, int whence)
|
||||||
return static_cast<toff_t>(in->tellg());
|
return static_cast<toff_t>(in->tellg());
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tiff_close_proc(thandle_t /*fd*/)
|
static int tiff_close_proc(thandle_t)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -86,16 +83,16 @@ static tsize_t tiff_read_proc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||||
return static_cast<tsize_t>(in->gcount());
|
return static_cast<tsize_t>(in->gcount());
|
||||||
}
|
}
|
||||||
|
|
||||||
static tsize_t tiff_write_proc(thandle_t /*fd*/, tdata_t /*buf*/, tsize_t /*size*/)
|
static tsize_t tiff_write_proc(thandle_t , tdata_t , tsize_t)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tiff_unmap_proc(thandle_t /*fd*/, tdata_t /*base*/, toff_t /*size*/)
|
static void tiff_unmap_proc(thandle_t, tdata_t, toff_t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tiff_map_proc(thandle_t /*fd*/, tdata_t* /*pbase*/, toff_t* /*psize*/)
|
static int tiff_map_proc(thandle_t, tdata_t* , toff_t*)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +149,7 @@ private:
|
||||||
void read_stripped(unsigned x,unsigned y,image_data_32& image);
|
void read_stripped(unsigned x,unsigned y,image_data_32& image);
|
||||||
void read_tiled(unsigned x,unsigned y,image_data_32& image);
|
void read_tiled(unsigned x,unsigned y,image_data_32& image);
|
||||||
TIFF* open(std::istream & input);
|
TIFF* open(std::istream & input);
|
||||||
static void on_error(const char* /*module*/, const char* fmt, va_list argptr);
|
static void on_error(const char* , const char* fmt, va_list argptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -207,7 +204,7 @@ tiff_reader<T>::tiff_reader(char const* data, std::size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void tiff_reader<T>::on_error(const char* /*module*/, const char* fmt, va_list argptr)
|
void tiff_reader<T>::on_error(const char* , const char* fmt, va_list argptr)
|
||||||
{
|
{
|
||||||
char msg[10240];
|
char msg[10240];
|
||||||
vsprintf(msg, fmt, argptr);
|
vsprintf(msg, fmt, argptr);
|
||||||
|
@ -303,7 +300,7 @@ void tiff_reader<T>::read(unsigned x,unsigned y,image_data_32& image)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void tiff_reader<T>::read_generic(unsigned /*x*/,unsigned /*y*/,image_data_32& /*image*/)
|
void tiff_reader<T>::read_generic(unsigned, unsigned, image_data_32&)
|
||||||
{
|
{
|
||||||
TIFF* tif = open(stream_);
|
TIFF* tif = open(stream_);
|
||||||
if (tif)
|
if (tif)
|
||||||
|
|
Loading…
Reference in a new issue