Remove CBC_Writer::Set{Background,Barcode}Color().
These are only called from the same-named methods in CBC_CodeBase,
which are themselves not called. Replace the members formerly set
with static constants.
Change-Id: Ic75409924d9502bfedf8018b757d824b09a2bcf1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/62030
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fxbarcode/BC_TwoDimWriter.cpp b/fxbarcode/BC_TwoDimWriter.cpp
index 09ae8c7..d31c59c 100644
--- a/fxbarcode/BC_TwoDimWriter.cpp
+++ b/fxbarcode/BC_TwoDimWriter.cpp
@@ -89,8 +89,8 @@
CFX_GraphStateData stateData;
CFX_PathData path;
path.AppendRect(0, 0, m_Width, m_Height);
- device->DrawPath(&path, matrix, &stateData, m_backgroundColor,
- m_backgroundColor, FXFILL_ALTERNATE);
+ device->DrawPath(&path, matrix, &stateData, kBackgroundColor,
+ kBackgroundColor, FXFILL_ALTERNATE);
int32_t leftPos = m_leftPadding;
int32_t topPos = m_topPadding;
@@ -119,7 +119,7 @@
topPos + start_y_output * m_multiY,
leftPos + end_x_output * m_multiX,
topPos + end_y_output * m_multiY);
- device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING);
+ device->DrawPath(&rect, &matri, &data, kBarColor, 0, FXFILL_WINDING);
}
}
}
diff --git a/fxbarcode/BC_Writer.cpp b/fxbarcode/BC_Writer.cpp
index 911d90c..9f77ffb 100644
--- a/fxbarcode/BC_Writer.cpp
+++ b/fxbarcode/BC_Writer.cpp
@@ -41,14 +41,6 @@
return true;
}
-void CBC_Writer::SetBackgroundColor(FX_ARGB backgroundColor) {
- m_backgroundColor = backgroundColor;
-}
-
-void CBC_Writer::SetBarcodeColor(FX_ARGB foregroundColor) {
- m_barColor = foregroundColor;
-}
-
bool CBC_Writer::SetTextLocation(BC_TEXT_LOC location) {
return false;
}
diff --git a/fxbarcode/BC_Writer.h b/fxbarcode/BC_Writer.h
index c358599..cf7f43b 100644
--- a/fxbarcode/BC_Writer.h
+++ b/fxbarcode/BC_Writer.h
@@ -10,8 +10,6 @@
#include "core/fxge/fx_dib.h"
#include "fxbarcode/BC_Library.h"
-class CFX_DIBitmap;
-
class CBC_Writer {
public:
CBC_Writer();
@@ -21,8 +19,6 @@
virtual bool SetModuleWidth(int32_t moduleWidth);
virtual bool SetHeight(int32_t height);
virtual bool SetWidth(int32_t width);
- virtual void SetBackgroundColor(FX_ARGB backgroundColor);
- virtual void SetBarcodeColor(FX_ARGB foregroundColor);
virtual bool SetTextLocation(BC_TEXT_LOC location);
virtual bool SetWideNarrowRatio(int8_t ratio);
virtual bool SetStartChar(char start);
@@ -30,14 +26,15 @@
virtual bool SetErrorCorrectionLevel(int32_t level);
protected:
+ static const FX_ARGB kBarColor = 0xff000000;
+ static const FX_ARGB kBackgroundColor = 0xffffffff;
+
int32_t m_CharEncoding = 0;
int32_t m_ModuleHeight = 1;
int32_t m_ModuleWidth = 1;
int32_t m_Height = 320;
int32_t m_Width = 640;
FXDIB_Format m_colorSpace = FXDIB_Argb;
- FX_ARGB m_barColor = 0xff000000;
- FX_ARGB m_backgroundColor = 0xffffffff;
};
#endif // FXBARCODE_BC_WRITER_H_
diff --git a/fxbarcode/cbc_codebase.cpp b/fxbarcode/cbc_codebase.cpp
index c31ee6c..305d09b 100644
--- a/fxbarcode/cbc_codebase.cpp
+++ b/fxbarcode/cbc_codebase.cpp
@@ -69,11 +69,3 @@
bool CBC_CodeBase::SetWidth(int32_t width) {
return m_pBCWriter->SetWidth(width);
}
-
-void CBC_CodeBase::SetBackgroundColor(FX_ARGB backgroundColor) {
- m_pBCWriter->SetBackgroundColor(backgroundColor);
-}
-
-void CBC_CodeBase::SetBarcodeColor(FX_ARGB foregroundColor) {
- m_pBCWriter->SetBarcodeColor(foregroundColor);
-}
diff --git a/fxbarcode/cbc_codebase.h b/fxbarcode/cbc_codebase.h
index 75070fa..d3e21dc 100644
--- a/fxbarcode/cbc_codebase.h
+++ b/fxbarcode/cbc_codebase.h
@@ -40,8 +40,6 @@
bool SetModuleWidth(int32_t moduleWidth);
bool SetHeight(int32_t height);
bool SetWidth(int32_t width);
- void SetBackgroundColor(FX_ARGB backgroundColor);
- void SetBarcodeColor(FX_ARGB foregroundColor);
protected:
std::unique_ptr<CBC_Writer> m_pBCWriter;
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index 0accc51..7cd06ec 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -166,7 +166,7 @@
rect.right -= 1;
}
FX_RECT re = matrix->TransformRect(rect).GetOuterRect();
- device->FillRect(re, m_backgroundColor);
+ device->FillRect(re, kBackgroundColor);
CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (float)locX,
(float)(locY + iFontSize));
if (matrix) {
@@ -243,15 +243,14 @@
CFX_PathData path;
path.AppendRect(0, 0, static_cast<float>(m_Width),
static_cast<float>(m_Height));
- device->DrawPath(&path, matrix, &stateData, m_backgroundColor,
- m_backgroundColor, FXFILL_ALTERNATE);
+ device->DrawPath(&path, matrix, &stateData, kBackgroundColor,
+ kBackgroundColor, FXFILL_ALTERNATE);
CFX_Matrix scaledMatrix(m_outputHScale, 0.0, 0.0,
static_cast<float>(m_Height), 0.0, 0.0);
scaledMatrix.Concat(*matrix);
for (const auto& rect : m_output) {
CFX_GraphStateData data;
- device->DrawPath(&rect, &scaledMatrix, &data, m_barColor, 0,
- FXFILL_WINDING);
+ device->DrawPath(&rect, &scaledMatrix, &data, kBarColor, 0, FXFILL_WINDING);
}
return m_locTextLoc == BC_TEXT_LOC_NONE || !contents.Contains(' ') ||
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 23a6c60..5c297e3 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -148,21 +148,21 @@
(float)(leftPosition + strWidth - 0.5), (float)m_Height);
matr.Concat(*matrix);
FX_RECT re = matr.TransformRect(rect).GetOuterRect();
- device->FillRect(re, m_backgroundColor);
+ device->FillRect(re, kBackgroundColor);
CFX_FloatRect rect1(
(float)(leftPosition + 47 * multiple), (float)(m_Height - iTextHeight),
(float)(leftPosition + 47 * multiple + strWidth - 0.5), (float)m_Height);
CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
matr1.Concat(*matrix);
re = matr1.TransformRect(rect1).GetOuterRect();
- device->FillRect(re, m_backgroundColor);
+ device->FillRect(re, kBackgroundColor);
int32_t strWidth1 = multiple * 7;
CFX_Matrix matr2(m_outputHScale, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
CFX_FloatRect rect2(0.0f, (float)(m_Height - iTextHeight),
(float)strWidth1 - 0.5f, (float)m_Height);
matr2.Concat(*matrix);
re = matr2.TransformRect(rect2).GetOuterRect();
- device->FillRect(re, m_backgroundColor);
+ device->FillRect(re, kBackgroundColor);
float blank = 0.0;
length = tempStr.GetLength();
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index f0e8bb2..d1d9677 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -150,14 +150,14 @@
(float)(leftPosition + strWidth - 0.5), (float)m_Height);
matr.Concat(*matrix);
FX_RECT re = matr.TransformRect(rect).GetOuterRect();
- device->FillRect(re, m_backgroundColor);
+ device->FillRect(re, kBackgroundColor);
CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect1(
(float)(leftPosition + 33 * multiple), (float)(m_Height - iTextHeight),
(float)(leftPosition + 33 * multiple + strWidth - 0.5), (float)m_Height);
matr1.Concat(*matrix);
re = matr1.TransformRect(rect1).GetOuterRect();
- device->FillRect(re, m_backgroundColor);
+ device->FillRect(re, kBackgroundColor);
strWidth = (int32_t)(strWidth * m_outputHScale);
CalcTextInfo(tempStr, charpos.data(), m_pFont.Get(), (float)strWidth,
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index e807ca3..f897e48 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -129,7 +129,7 @@
(float)(leftPosition + strWidth - 0.5), (float)m_Height);
matr.Concat(*matrix);
FX_RECT re = matr.TransformRect(rect).GetOuterRect();
- device->FillRect(re, m_backgroundColor);
+ device->FillRect(re, kBackgroundColor);
CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect1((float)(leftPosition + 40 * multiple),
(float)(m_Height - iTextHeight),
@@ -137,14 +137,14 @@
(float)m_Height);
matr1.Concat(*matrix);
re = matr1.TransformRect(rect1).GetOuterRect();
- device->FillRect(re, m_backgroundColor);
+ device->FillRect(re, kBackgroundColor);
float strWidth1 = (float)multiple * 7;
CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect2(0.0, (float)(m_Height - iTextHeight),
(float)strWidth1 - 1, (float)m_Height);
matr2.Concat(*matrix);
re = matr2.TransformRect(rect2).GetOuterRect();
- device->FillRect(re, m_backgroundColor);
+ device->FillRect(re, kBackgroundColor);
CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect3((float)(leftPosition + 85 * multiple),
(float)(m_Height - iTextHeight),
@@ -152,7 +152,7 @@
(float)m_Height);
matr3.Concat(*matrix);
re = matr3.TransformRect(rect3).GetOuterRect();
- device->FillRect(re, m_backgroundColor);
+ device->FillRect(re, kBackgroundColor);
strWidth = strWidth * m_outputHScale;
CalcTextInfo(tempStr, &charpos[1], m_pFont.Get(), strWidth, iFontSize, blank);