2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-30 17:00:51 +00:00
qpdf/libqpdf/qpdf/Pl_PNGFilter.hh
Jay Berkenbilt a68703b07e Replace PointerHolder with std::shared_ptr in library sources only
(patrepl and cleanpatch are my own utilities)

patrepl s/PointerHolder/std::shared_ptr/g {include,libqpdf}/qpdf/*.hh
patrepl s/PointerHolder/std::shared_ptr/g libqpdf/*.cc
patrepl s/make_pointer_holder/std::make_shared/g libqpdf/*.cc
patrepl s/make_array_pointer_holder/QUtil::make_shared_array/g libqpdf/*.cc
patrepl s,qpdf/std::shared_ptr,qpdf/PointerHolder, **/*.cc **/*.hh
git restore include/qpdf/PointerHolder.hh
cleanpatch
./format-code
2022-04-09 17:33:29 -04:00

56 lines
1.4 KiB
C++

#ifndef PL_PNGFILTER_HH
#define PL_PNGFILTER_HH
// This pipeline applies or reverses the application of a PNG filter
// as described in the PNG specification.
// NOTE: In its current implementation, this filter always encodes
// using the "up" filter, but it decodes all the filters.
#include <qpdf/Pipeline.hh>
class Pl_PNGFilter: public Pipeline
{
public:
// Encoding is only partially supported
enum action_e { a_encode, a_decode };
QPDF_DLL
Pl_PNGFilter(
char const* identifier,
Pipeline* next,
action_e action,
unsigned int columns,
unsigned int samples_per_pixel = 1,
unsigned int bits_per_sample = 8);
QPDF_DLL
virtual ~Pl_PNGFilter();
QPDF_DLL
virtual void write(unsigned char* data, size_t len);
QPDF_DLL
virtual void finish();
private:
void decodeSub();
void decodeUp();
void decodeAverage();
void decodePaeth();
void processRow();
void encodeRow();
void decodeRow();
int PaethPredictor(int a, int b, int c);
action_e action;
unsigned int bytes_per_row;
unsigned int bytes_per_pixel;
unsigned char* cur_row; // points to buf1 or buf2
unsigned char* prev_row; // points to buf1 or buf2
std::shared_ptr<unsigned char> buf1;
std::shared_ptr<unsigned char> buf2;
size_t pos;
size_t incoming;
};
#endif // PL_PNGFILTER_HH