Small cleanup of ScanlineDecoder methods
Remove non-virtual ReadNextLine() which merely invoked virtual
GetNextLine() in favor of direct calls to GetNextLine().
-- remove v_ prefix from method names.
Change-Id: I53a14f6c8c84e581aad64c8195c78066825ceabd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85530
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcodec/basic/basicmodule.cpp b/core/fxcodec/basic/basicmodule.cpp
index 27341e1..f6d9bd7 100644
--- a/core/fxcodec/basic/basicmodule.cpp
+++ b/core/fxcodec/basic/basicmodule.cpp
@@ -31,8 +31,8 @@
int bpc);
// ScanlineDecoder:
- bool v_Rewind() override;
- uint8_t* v_GetNextLine() override;
+ bool Rewind() override;
+ uint8_t* GetNextLine() override;
uint32_t GetSrcOffset() override { return m_SrcOffset; }
private:
@@ -109,7 +109,7 @@
return CheckDestSize();
}
-bool RLScanlineDecoder::v_Rewind() {
+bool RLScanlineDecoder::Rewind() {
fxcrt::spanclr(pdfium::make_span(m_Scanline));
m_SrcOffset = 0;
m_bEOD = false;
@@ -117,7 +117,7 @@
return true;
}
-uint8_t* RLScanlineDecoder::v_GetNextLine() {
+uint8_t* RLScanlineDecoder::GetNextLine() {
if (m_SrcOffset == 0) {
GetNextOperator();
} else if (m_bEOD) {
diff --git a/core/fxcodec/fax/faxmodule.cpp b/core/fxcodec/fax/faxmodule.cpp
index 0439af1..5bf4d60 100644
--- a/core/fxcodec/fax/faxmodule.cpp
+++ b/core/fxcodec/fax/faxmodule.cpp
@@ -467,8 +467,8 @@
~FaxDecoder() override;
// ScanlineDecoder:
- bool v_Rewind() override;
- uint8_t* v_GetNextLine() override;
+ bool Rewind() override;
+ uint8_t* GetNextLine() override;
uint32_t GetSrcOffset() override;
private:
@@ -508,13 +508,13 @@
FaxDecoder::~FaxDecoder() = default;
-bool FaxDecoder::v_Rewind() {
+bool FaxDecoder::Rewind() {
memset(m_RefBuf.data(), 0xff, m_RefBuf.size());
m_bitpos = 0;
return true;
}
-uint8_t* FaxDecoder::v_GetNextLine() {
+uint8_t* FaxDecoder::GetNextLine() {
int bitsize = m_SrcSpan.size() * 8;
FaxSkipEOL(m_SrcSpan.data(), bitsize, &m_bitpos);
if (m_bitpos >= bitsize)
diff --git a/core/fxcodec/flate/flatemodule.cpp b/core/fxcodec/flate/flatemodule.cpp
index b51b073..8a70571 100644
--- a/core/fxcodec/flate/flatemodule.cpp
+++ b/core/fxcodec/flate/flatemodule.cpp
@@ -604,8 +604,8 @@
~FlateScanlineDecoder() override;
// ScanlineDecoder:
- bool v_Rewind() override;
- uint8_t* v_GetNextLine() override;
+ bool Rewind() override;
+ uint8_t* GetNextLine() override;
uint32_t GetSrcOffset() override;
protected:
@@ -631,7 +631,7 @@
FlateScanlineDecoder::~FlateScanlineDecoder() = default;
-bool FlateScanlineDecoder::v_Rewind() {
+bool FlateScanlineDecoder::Rewind() {
m_pFlate.reset(FlateInit());
if (!m_pFlate)
return false;
@@ -640,7 +640,7 @@
return true;
}
-uint8_t* FlateScanlineDecoder::v_GetNextLine() {
+uint8_t* FlateScanlineDecoder::GetNextLine() {
FlateOutput(m_pFlate.get(), m_pScanline.get(), m_Pitch);
return m_pScanline.get();
}
@@ -663,8 +663,8 @@
~FlatePredictorScanlineDecoder() override;
// ScanlineDecoder:
- bool v_Rewind() override;
- uint8_t* v_GetNextLine() override;
+ bool Rewind() override;
+ uint8_t* GetNextLine() override;
private:
void GetNextLineWithPredictedPitch();
@@ -711,15 +711,15 @@
FlatePredictorScanlineDecoder::~FlatePredictorScanlineDecoder() = default;
-bool FlatePredictorScanlineDecoder::v_Rewind() {
- if (!FlateScanlineDecoder::v_Rewind())
+bool FlatePredictorScanlineDecoder::Rewind() {
+ if (!FlateScanlineDecoder::Rewind())
return false;
m_LeftOver = 0;
return true;
}
-uint8_t* FlatePredictorScanlineDecoder::v_GetNextLine() {
+uint8_t* FlatePredictorScanlineDecoder::GetNextLine() {
if (m_Pitch == m_PredictPitch)
GetNextLineWithPredictedPitch();
else
diff --git a/core/fxcodec/jpeg/jpegmodule.cpp b/core/fxcodec/jpeg/jpegmodule.cpp
index 036f250..00764ba 100644
--- a/core/fxcodec/jpeg/jpegmodule.cpp
+++ b/core/fxcodec/jpeg/jpegmodule.cpp
@@ -124,8 +124,8 @@
bool ColorTransform);
// ScanlineDecoder:
- bool v_Rewind() override;
- uint8_t* v_GetNextLine() override;
+ bool Rewind() override;
+ uint8_t* GetNextLine() override;
uint32_t GetSrcOffset() override;
bool InitDecode(bool bAcceptKnownBadHeader);
@@ -269,7 +269,7 @@
return true;
}
-bool JpegDecoder::v_Rewind() {
+bool JpegDecoder::Rewind() {
if (m_bStarted) {
jpeg_destroy_decompress(&m_Cinfo);
if (!InitDecode(/*bAcceptKnownBadHeader=*/false)) {
@@ -294,7 +294,7 @@
return true;
}
-uint8_t* JpegDecoder::v_GetNextLine() {
+uint8_t* JpegDecoder::GetNextLine() {
if (setjmp(m_JmpBuf) == -1)
return nullptr;
diff --git a/core/fxcodec/scanlinedecoder.cpp b/core/fxcodec/scanlinedecoder.cpp
index 2aa4178..858fdf0 100644
--- a/core/fxcodec/scanlinedecoder.cpp
+++ b/core/fxcodec/scanlinedecoder.cpp
@@ -34,15 +34,15 @@
return m_pLastScanline;
if (m_NextLine < 0 || m_NextLine > line) {
- if (!v_Rewind())
+ if (!Rewind())
return nullptr;
m_NextLine = 0;
}
while (m_NextLine < line) {
- ReadNextLine();
+ GetNextLine();
m_NextLine++;
}
- m_pLastScanline = ReadNextLine();
+ m_pLastScanline = GetNextLine();
m_NextLine++;
return m_pLastScanline;
}
@@ -52,12 +52,12 @@
return false;
if (m_NextLine < 0 || m_NextLine > line) {
- v_Rewind();
+ Rewind();
m_NextLine = 0;
}
m_pLastScanline = nullptr;
while (m_NextLine < line) {
- m_pLastScanline = ReadNextLine();
+ m_pLastScanline = GetNextLine();
m_NextLine++;
if (pPause && pPause->NeedToPauseNow()) {
return true;
@@ -66,8 +66,4 @@
return false;
}
-uint8_t* ScanlineDecoder::ReadNextLine() {
- return v_GetNextLine();
-}
-
} // namespace fxcodec
diff --git a/core/fxcodec/scanlinedecoder.h b/core/fxcodec/scanlinedecoder.h
index 0fad633..3ced576 100644
--- a/core/fxcodec/scanlinedecoder.h
+++ b/core/fxcodec/scanlinedecoder.h
@@ -36,10 +36,8 @@
virtual uint32_t GetSrcOffset() = 0;
protected:
- virtual bool v_Rewind() = 0;
- virtual uint8_t* v_GetNextLine() = 0;
-
- uint8_t* ReadNextLine();
+ virtual bool Rewind() = 0;
+ virtual uint8_t* GetNextLine() = 0;
int m_OrigWidth;
int m_OrigHeight;