Some more minor changes

This commit is contained in:
Blake Thompson 2015-01-08 10:12:34 -05:00
parent cc0a27f2f0
commit 847682d783
3 changed files with 13 additions and 4 deletions

View file

@ -49,6 +49,7 @@ using cairo_surface_ptr = std::shared_ptr<cairo_surface_t>;
class MAPNIK_DECL image_32
{
using pixel_type = typename image_data_rgba8::pixel_type;
private:
unsigned width_;
unsigned height_;

View file

@ -528,7 +528,8 @@ void handle_webp_options(std::string const& type,
}
#endif
void save_to_stream(image_data_any const& image,
template <typename T>
void save_to_stream(T const& image,
std::ostream & stream,
std::string const& type,
rgba_palette_ptr const& palette)
@ -538,8 +539,9 @@ void save_to_stream(image_data_any const& image,
std::string t = type;
std::transform(t.begin(), t.end(), t.begin(), ::tolower);
if (t == "png" || boost::algorithm::starts_with(t, "png"))
{
mapnik::util::apply_visitor(png_saver(stream, t, palette), image);
{
png_saver visitor(stream, t, palette);
mapnik::util::apply_visitor(visitor, image);
}
else if (boost::algorithm::starts_with(t, "tif"))
{
@ -554,7 +556,8 @@ void save_to_stream(image_data_any const& image,
else throw ImageWriterException("Could not write to empty stream" );
}
void save_to_stream(image_data_any const& image,
template <typename T>
void save_to_stream(T const& image,
std::ostream & stream,
std::string const& type)
{

View file

@ -176,6 +176,11 @@ void handle_png_options(std::string const& type,
png_saver::png_saver(std::ostream & stream, std::string const& t, rgba_palette_ptr const& pal):
_stream(stream), _t(t), _pal(pal) {}
void png_saver::operator() (image_data_null const& image) const
{
throw ImageWriterException("null images not supported");
}
void png_saver::operator() (image_data_rgba8 const& image) const
{
#if defined(HAVE_PNG)