Mark ProgressiveDecoder nested classes as private.
They aren't used outside the enclosing ProgressiveDecoder class. Then
remove the CFXCODEC_ prefix since they are already qualified by the
enclosing class.
Change-Id: Ida9e16c38562c59330e4eea903c79be87c011d2d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79930
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcodec/progressive_decoder.cpp b/core/fxcodec/progressive_decoder.cpp
index 39e5f83..1fa2107 100644
--- a/core/fxcodec/progressive_decoder.cpp
+++ b/core/fxcodec/progressive_decoder.cpp
@@ -63,11 +63,11 @@
} // namespace
-ProgressiveDecoder::CFXCODEC_WeightTable::CFXCODEC_WeightTable() = default;
+ProgressiveDecoder::WeightTable::WeightTable() = default;
-ProgressiveDecoder::CFXCODEC_WeightTable::~CFXCODEC_WeightTable() = default;
+ProgressiveDecoder::WeightTable::~WeightTable() = default;
-void ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len, int src_len) {
+void ProgressiveDecoder::WeightTable::Calc(int dest_len, int src_len) {
double scale = static_cast<double>(src_len) / dest_len;
double base = dest_len < 0 ? src_len : 0.0;
m_ItemSize = (int)(sizeof(int) * 2 + sizeof(int) * (ceil(fabs(scale)) + 1));
@@ -137,11 +137,11 @@
}
}
-ProgressiveDecoder::CFXCODEC_HorzTable::CFXCODEC_HorzTable() = default;
+ProgressiveDecoder::HorzTable::HorzTable() = default;
-ProgressiveDecoder::CFXCODEC_HorzTable::~CFXCODEC_HorzTable() = default;
+ProgressiveDecoder::HorzTable::~HorzTable() = default;
-void ProgressiveDecoder::CFXCODEC_HorzTable::Calc(int dest_len, int src_len) {
+void ProgressiveDecoder::HorzTable::Calc(int dest_len, int src_len) {
double scale = (double)dest_len / (double)src_len;
m_ItemSize = sizeof(int) * 4;
int size = dest_len * m_ItemSize + 4;
@@ -190,11 +190,11 @@
}
}
-ProgressiveDecoder::CFXCODEC_VertTable::CFXCODEC_VertTable() = default;
+ProgressiveDecoder::VertTable::VertTable() = default;
-ProgressiveDecoder::CFXCODEC_VertTable::~CFXCODEC_VertTable() = default;
+ProgressiveDecoder::VertTable::~VertTable() = default;
-void ProgressiveDecoder::CFXCODEC_VertTable::Calc(int dest_len, int src_len) {
+void ProgressiveDecoder::VertTable::Calc(int dest_len, int src_len) {
double scale = (double)dest_len / (double)src_len;
m_ItemSize = sizeof(int) * 4;
int size = dest_len * m_ItemSize + 4;
diff --git a/core/fxcodec/progressive_decoder.h b/core/fxcodec/progressive_decoder.h
index 561660a..22f1793 100644
--- a/core/fxcodec/progressive_decoder.h
+++ b/core/fxcodec/progressive_decoder.h
@@ -88,51 +88,6 @@
FXCODEC_STATUS ContinueDecode();
- class CFXCODEC_WeightTable {
- public:
- CFXCODEC_WeightTable();
- ~CFXCODEC_WeightTable();
-
- void Calc(int dest_len, int src_len);
- PixelWeight* GetPixelWeight(int pixel) {
- return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() +
- (pixel - m_DestMin) * m_ItemSize);
- }
-
- int m_DestMin;
- int m_ItemSize;
- std::vector<uint8_t, FxAllocAllocator<uint8_t>> m_pWeightTables;
- };
-
- class CFXCODEC_HorzTable {
- public:
- CFXCODEC_HorzTable();
- ~CFXCODEC_HorzTable();
-
- void Calc(int dest_len, int src_len);
- PixelWeight* GetPixelWeight(int pixel) {
- return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() +
- pixel * m_ItemSize);
- }
-
- int m_ItemSize;
- std::vector<uint8_t, FxAllocAllocator<uint8_t>> m_pWeightTables;
- };
-
- class CFXCODEC_VertTable {
- public:
- CFXCODEC_VertTable();
- ~CFXCODEC_VertTable();
-
- void Calc(int dest_len, int src_len);
- PixelWeight* GetPixelWeight(int pixel) {
- return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() +
- pixel * m_ItemSize);
- }
- int m_ItemSize;
- std::vector<uint8_t, FxAllocAllocator<uint8_t>> m_pWeightTables;
- };
-
#ifdef PDF_ENABLE_XFA_PNG
// PngDecoder::Delegate
bool PngReadHeader(int width,
@@ -168,6 +123,51 @@
#endif // PDF_ENABLE_XFA_BMP
private:
+ class WeightTable {
+ public:
+ WeightTable();
+ ~WeightTable();
+
+ void Calc(int dest_len, int src_len);
+ PixelWeight* GetPixelWeight(int pixel) {
+ return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() +
+ (pixel - m_DestMin) * m_ItemSize);
+ }
+
+ int m_DestMin;
+ int m_ItemSize;
+ std::vector<uint8_t, FxAllocAllocator<uint8_t>> m_pWeightTables;
+ };
+
+ class HorzTable {
+ public:
+ HorzTable();
+ ~HorzTable();
+
+ void Calc(int dest_len, int src_len);
+ PixelWeight* GetPixelWeight(int pixel) {
+ return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() +
+ pixel * m_ItemSize);
+ }
+
+ int m_ItemSize;
+ std::vector<uint8_t, FxAllocAllocator<uint8_t>> m_pWeightTables;
+ };
+
+ class VertTable {
+ public:
+ VertTable();
+ ~VertTable();
+
+ void Calc(int dest_len, int src_len);
+ PixelWeight* GetPixelWeight(int pixel) {
+ return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() +
+ pixel * m_ItemSize);
+ }
+ int m_ItemSize;
+ std::vector<uint8_t, FxAllocAllocator<uint8_t>> m_pWeightTables;
+ };
+
#ifdef PDF_ENABLE_XFA_BMP
bool BmpReadMoreData(ProgressiveDecoderIface::Context* pBmpContext,
FXCODEC_STATUS* err_status);
@@ -253,9 +253,9 @@
#endif // PDF_ENABLE_XFA_TIFF
uint32_t m_offSet = 0;
int m_ScanlineSize = 0;
- CFXCODEC_WeightTable m_WeightHorz;
- CFXCODEC_VertTable m_WeightVert;
- CFXCODEC_HorzTable m_WeightHorzOO;
+ WeightTable m_WeightHorz;
+ VertTable m_WeightVert;
+ HorzTable m_WeightHorzOO;
int m_SrcWidth = 0;
int m_SrcHeight = 0;
int m_SrcComponents = 0;