repack tiff_reader to avoid slop (saves 16 bytes)

This commit is contained in:
Dane Springmeyer 2014-12-09 08:34:13 -05:00
parent 303d625b7c
commit 93c6207153

View file

@ -123,21 +123,21 @@ class tiff_reader : public image_reader
private: private:
source_type source_; source_type source_;
input_stream stream_; input_stream stream_;
tiff_ptr tif_;
int read_method_; int read_method_;
std::size_t width_;
std::size_t height_;
int rows_per_strip_; int rows_per_strip_;
int tile_width_; int tile_width_;
int tile_height_; int tile_height_;
tiff_ptr tif_; std::size_t width_;
bool premultiplied_alpha_; std::size_t height_;
bool has_alpha_;
unsigned bps_; unsigned bps_;
unsigned photometric_; unsigned photometric_;
unsigned bands_; unsigned bands_;
bool is_tiled_;
unsigned planar_config_; unsigned planar_config_;
unsigned compression_; unsigned compression_;
bool premultiplied_alpha_;
bool has_alpha_;
bool is_tiled_;
public: public:
enum TiffType { enum TiffType {
@ -201,20 +201,21 @@ template <typename T>
tiff_reader<T>::tiff_reader(std::string const& file_name) tiff_reader<T>::tiff_reader(std::string const& file_name)
: source_(file_name, std::ios_base::in | std::ios_base::binary), : source_(file_name, std::ios_base::in | std::ios_base::binary),
stream_(source_), stream_(source_),
tif_(nullptr),
read_method_(generic), read_method_(generic),
width_(0),
height_(0),
rows_per_strip_(0), rows_per_strip_(0),
tile_width_(0), tile_width_(0),
tile_height_(0), tile_height_(0),
premultiplied_alpha_(false), width_(0),
has_alpha_(false), height_(0),
bps_(0), bps_(0),
photometric_(0), photometric_(0),
bands_(1), bands_(1),
is_tiled_(false),
planar_config_(PLANARCONFIG_CONTIG), planar_config_(PLANARCONFIG_CONTIG),
compression_(COMPRESSION_NONE) compression_(COMPRESSION_NONE),
premultiplied_alpha_(false),
has_alpha_(false),
is_tiled_(false)
{ {
if (!stream_) throw image_reader_exception("TIFF reader: cannot open file "+ file_name); if (!stream_) throw image_reader_exception("TIFF reader: cannot open file "+ file_name);
init(); init();
@ -224,20 +225,21 @@ template <typename T>
tiff_reader<T>::tiff_reader(char const* data, std::size_t size) tiff_reader<T>::tiff_reader(char const* data, std::size_t size)
: source_(data, size), : source_(data, size),
stream_(source_), stream_(source_),
tif_(nullptr),
read_method_(generic), read_method_(generic),
width_(0),
height_(0),
rows_per_strip_(0), rows_per_strip_(0),
tile_width_(0), tile_width_(0),
tile_height_(0), tile_height_(0),
premultiplied_alpha_(false), width_(0),
has_alpha_(false), height_(0),
bps_(0), bps_(0),
photometric_(0), photometric_(0),
bands_(1), bands_(1),
is_tiled_(false),
planar_config_(PLANARCONFIG_CONTIG), planar_config_(PLANARCONFIG_CONTIG),
compression_(COMPRESSION_NONE) compression_(COMPRESSION_NONE),
premultiplied_alpha_(false),
has_alpha_(false),
is_tiled_(false)
{ {
if (!stream_) throw image_reader_exception("TIFF reader: cannot open image stream "); if (!stream_) throw image_reader_exception("TIFF reader: cannot open image stream ");
stream_.seekg(0, std::ios::beg); stream_.seekg(0, std::ios::beg);