diff --git a/include/mapnik/image_reader.hpp b/include/mapnik/image_reader.hpp index 6a6098ea9..edd96b1c3 100644 --- a/include/mapnik/image_reader.hpp +++ b/include/mapnik/image_reader.hpp @@ -60,7 +60,7 @@ struct MAPNIK_DECL image_reader : private mapnik::noncopyable virtual bool has_alpha() const = 0; virtual bool premultiplied_alpha() const = 0; virtual void read(unsigned x,unsigned y,image_data_32& image) = 0; - + virtual image_data_any read(unsigned x, unsigned y, unsigned width, unsigned height) = 0; virtual ~image_reader() {} }; diff --git a/src/jpeg_reader.cpp b/src/jpeg_reader.cpp index d32ef7792..0bbcd2b00 100644 --- a/src/jpeg_reader.cpp +++ b/src/jpeg_reader.cpp @@ -81,11 +81,12 @@ public: explicit jpeg_reader(std::string const& file_name); explicit jpeg_reader(char const* data, size_t size); ~jpeg_reader(); - unsigned width() const; - unsigned height() const; - inline bool has_alpha() const { return false; } - inline bool premultiplied_alpha() const { return true; } - void read(unsigned x,unsigned y,image_data_32& image); + unsigned width() const final; + unsigned height() const final; + inline bool has_alpha() const final { return false; } + inline bool premultiplied_alpha() const final { return true; } + void read(unsigned x,unsigned y,image_data_32& image) final; + image_data_any read(unsigned x, unsigned y, unsigned width, unsigned height) final; private: void init(); static void on_error(j_common_ptr cinfo); @@ -312,4 +313,10 @@ void jpeg_reader::read(unsigned x0, unsigned y0, image_data_32& image) jpeg_finish_decompress(&cinfo); } +template +image_data_any jpeg_reader::read(unsigned x, unsigned y, unsigned width, unsigned height) +{ + return image_data_any(); +} + } diff --git a/src/png_reader.cpp b/src/png_reader.cpp index 579b8a88f..a79c406d6 100644 --- a/src/png_reader.cpp +++ b/src/png_reader.cpp @@ -76,11 +76,12 @@ public: explicit png_reader(std::string const& file_name); png_reader(char const* data, std::size_t size); ~png_reader(); - unsigned width() const; - unsigned height() const; - inline bool has_alpha() const { return has_alpha_; } - bool premultiplied_alpha() const { return false; } //http://www.libpng.org/pub/png/spec/1.1/PNG-Rationale.html - void read(unsigned x,unsigned y,image_data_32& image); + unsigned width() const final; + unsigned height() const final; + inline bool has_alpha() const final { return has_alpha_; } + bool premultiplied_alpha() const final { return false; } //http://www.libpng.org/pub/png/spec/1.1/PNG-Rationale.html + void read(unsigned x,unsigned y,image_data_32& image) final; + image_data_any read(unsigned x, unsigned y, unsigned width, unsigned height) final; private: void init(); static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length); @@ -300,4 +301,12 @@ void png_reader::read(unsigned x0, unsigned y0,image_data_32& image) } png_read_end(png_ptr,0); } + + +template +image_data_any png_reader::read(unsigned x, unsigned y, unsigned width, unsigned height) +{ + return image_data_any(); +} + } diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index 1519b93a2..b0faa3f2d 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -141,11 +141,12 @@ public: explicit tiff_reader(std::string const& file_name); tiff_reader(char const* data, std::size_t size); virtual ~tiff_reader(); - unsigned width() const; - unsigned height() const; - inline bool has_alpha() const { return has_alpha_; } - bool premultiplied_alpha() const; - void read(unsigned x,unsigned y,image_data_32& image); + unsigned width() const final; + unsigned height() const final; + inline bool has_alpha() const final { return has_alpha_; } + bool premultiplied_alpha() const final; + void read(unsigned x,unsigned y,image_data_32& image) final; + image_data_any read(unsigned x, unsigned y, unsigned width, unsigned height) final; private: tiff_reader(const tiff_reader&); tiff_reader& operator=(const tiff_reader&); @@ -296,6 +297,12 @@ void tiff_reader::read(unsigned x,unsigned y,image_data_32& image) } } +template +image_data_any tiff_reader::read(unsigned x, unsigned y, unsigned width, unsigned height) +{ + return image_data_any(); +} + template void tiff_reader::read_generic(unsigned, unsigned, image_data_32&) { diff --git a/src/webp_reader.cpp b/src/webp_reader.cpp index 44e535716..30aff3bec 100644 --- a/src/webp_reader.cpp +++ b/src/webp_reader.cpp @@ -120,11 +120,12 @@ public: explicit webp_reader(char const* data, std::size_t size); explicit webp_reader(std::string const& filename); ~webp_reader(); - unsigned width() const; - unsigned height() const; - inline bool has_alpha() const { return has_alpha_; } - bool premultiplied_alpha() const { return false; } - void read(unsigned x,unsigned y,image_data_32& image); + unsigned width() const final; + unsigned height() const final; + inline bool has_alpha() const final { return has_alpha_; } + bool premultiplied_alpha() const final { return false; } + void read(unsigned x,unsigned y,image_data_32& image) final; + image_data_any read(unsigned x, unsigned y, unsigned width, unsigned height) final; private: void init(); }; @@ -260,4 +261,10 @@ void webp_reader::read(unsigned x0, unsigned y0,image_data_32& image) } } +template +image_data_any webp_reader::read(unsigned x, unsigned y, unsigned width, unsigned height) +{ + return image_data_any(); +} + }