summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fxbarcode/BC_Writer.cpp33
-rw-r--r--fxbarcode/BC_Writer.h18
-rw-r--r--fxbarcode/cbc_codabar.cpp4
-rw-r--r--fxbarcode/cbc_codabar.h1
-rw-r--r--fxbarcode/cbc_code128.cpp4
-rw-r--r--fxbarcode/cbc_code128.h1
-rw-r--r--fxbarcode/cbc_code39.cpp4
-rw-r--r--fxbarcode/cbc_code39.h1
-rw-r--r--fxbarcode/cbc_codebase.cpp2
-rw-r--r--fxbarcode/cbc_codebase.h2
-rw-r--r--fxbarcode/oned/BC_OnedCodaBarWriter.h2
-rw-r--r--fxbarcode/oned/BC_OnedCode128Writer.h3
-rw-r--r--fxbarcode/oned/BC_OnedCode39Writer.h2
-rw-r--r--fxbarcode/oned/BC_OnedEAN8Writer.h2
14 files changed, 34 insertions, 45 deletions
diff --git a/fxbarcode/BC_Writer.cpp b/fxbarcode/BC_Writer.cpp
index 5c8e0cf3b7..8d639d3f01 100644
--- a/fxbarcode/BC_Writer.cpp
+++ b/fxbarcode/BC_Writer.cpp
@@ -6,50 +6,53 @@
#include "fxbarcode/BC_Writer.h"
-CBC_Writer::CBC_Writer() {
- m_CharEncoding = 0;
- m_ModuleHeight = 1;
- m_ModuleWidth = 1;
- m_Height = 320;
- m_Width = 640;
- m_colorSpace = FXDIB_Argb;
- m_barColor = 0xff000000;
- m_backgroundColor = 0xffffffff;
-}
-CBC_Writer::~CBC_Writer() {}
+CBC_Writer::CBC_Writer() = default;
+
+CBC_Writer::~CBC_Writer() = default;
+
bool CBC_Writer::SetCharEncoding(int32_t encoding) {
m_CharEncoding = encoding;
return true;
}
+
bool CBC_Writer::SetModuleHeight(int32_t moduleHeight) {
- if (moduleHeight > 10 || moduleHeight < 1) {
+ if (moduleHeight > 10 || moduleHeight < 1)
return false;
- }
+
m_ModuleHeight = moduleHeight;
return true;
}
+
bool CBC_Writer::SetModuleWidth(int32_t moduleWidth) {
- if (moduleWidth > 10 || moduleWidth < 1) {
+ if (moduleWidth > 10 || moduleWidth < 1)
return false;
- }
+
m_ModuleWidth = moduleWidth;
return true;
}
+
bool CBC_Writer::SetHeight(int32_t height) {
m_Height = height;
return true;
}
+
bool CBC_Writer::SetWidth(int32_t width) {
m_Width = width;
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;
+}
+
RetainPtr<CFX_DIBitmap> CBC_Writer::CreateDIBitmap(int32_t width,
int32_t height) {
auto pDIBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
diff --git a/fxbarcode/BC_Writer.h b/fxbarcode/BC_Writer.h
index 565c03f1a5..3751b93457 100644
--- a/fxbarcode/BC_Writer.h
+++ b/fxbarcode/BC_Writer.h
@@ -10,6 +10,7 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
+#include "fxbarcode/BC_Library.h"
#include "fxbarcode/utils.h"
class CBC_Writer {
@@ -23,17 +24,18 @@ class CBC_Writer {
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);
protected:
RetainPtr<CFX_DIBitmap> CreateDIBitmap(int32_t width, int32_t height);
- int32_t m_CharEncoding;
- int32_t m_ModuleHeight;
- int32_t m_ModuleWidth;
- int32_t m_Height;
- int32_t m_Width;
- FXDIB_Format m_colorSpace;
- FX_ARGB m_barColor;
- FX_ARGB m_backgroundColor;
+ 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_codabar.cpp b/fxbarcode/cbc_codabar.cpp
index b32eafc376..f3a3a62dac 100644
--- a/fxbarcode/cbc_codabar.cpp
+++ b/fxbarcode/cbc_codabar.cpp
@@ -39,10 +39,6 @@ bool CBC_Codabar::SetEndChar(char end) {
return GetOnedCodaBarWriter()->SetEndChar(end);
}
-bool CBC_Codabar::SetTextLocation(BC_TEXT_LOC location) {
- return GetOnedCodaBarWriter()->SetTextLocation(location);
-}
-
bool CBC_Codabar::SetWideNarrowRatio(int8_t ratio) {
return GetOnedCodaBarWriter()->SetWideNarrowRatio(ratio);
}
diff --git a/fxbarcode/cbc_codabar.h b/fxbarcode/cbc_codabar.h
index 7fc518b80f..bf8a21e42e 100644
--- a/fxbarcode/cbc_codabar.h
+++ b/fxbarcode/cbc_codabar.h
@@ -24,7 +24,6 @@ class CBC_Codabar final : public CBC_OneCode {
bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
- bool SetTextLocation(BC_TEXT_LOC location) override;
bool SetWideNarrowRatio(int8_t ratio) override;
bool SetStartChar(char start) override;
bool SetEndChar(char end) override;
diff --git a/fxbarcode/cbc_code128.cpp b/fxbarcode/cbc_code128.cpp
index 8e83e2251c..7a825c4150 100644
--- a/fxbarcode/cbc_code128.cpp
+++ b/fxbarcode/cbc_code128.cpp
@@ -31,10 +31,6 @@ CBC_Code128::CBC_Code128(BC_TYPE type)
CBC_Code128::~CBC_Code128() {}
-bool CBC_Code128::SetTextLocation(BC_TEXT_LOC location) {
- return GetOnedCode128Writer()->SetTextLocation(location);
-}
-
bool CBC_Code128::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
diff --git a/fxbarcode/cbc_code128.h b/fxbarcode/cbc_code128.h
index ccd5a38243..16e30de9b9 100644
--- a/fxbarcode/cbc_code128.h
+++ b/fxbarcode/cbc_code128.h
@@ -24,7 +24,6 @@ class CBC_Code128 final : public CBC_OneCode {
bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
- bool SetTextLocation(BC_TEXT_LOC location) override;
private:
CBC_OnedCode128Writer* GetOnedCode128Writer();
diff --git a/fxbarcode/cbc_code39.cpp b/fxbarcode/cbc_code39.cpp
index 52859e14c5..6aa3646e97 100644
--- a/fxbarcode/cbc_code39.cpp
+++ b/fxbarcode/cbc_code39.cpp
@@ -61,10 +61,6 @@ BC_TYPE CBC_Code39::GetType() {
return BC_CODE39;
}
-bool CBC_Code39::SetTextLocation(BC_TEXT_LOC location) {
- return GetOnedCode39Writer()->SetTextLocation(location);
-}
-
bool CBC_Code39::SetWideNarrowRatio(int8_t ratio) {
return GetOnedCode39Writer()->SetWideNarrowRatio(ratio);
}
diff --git a/fxbarcode/cbc_code39.h b/fxbarcode/cbc_code39.h
index 4e240b7f89..4f87ba774a 100644
--- a/fxbarcode/cbc_code39.h
+++ b/fxbarcode/cbc_code39.h
@@ -25,7 +25,6 @@ class CBC_Code39 final : public CBC_OneCode {
bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
- bool SetTextLocation(BC_TEXT_LOC location) override;
bool SetWideNarrowRatio(int8_t ratio) override;
private:
diff --git a/fxbarcode/cbc_codebase.cpp b/fxbarcode/cbc_codebase.cpp
index b723f551d5..6a04a25bda 100644
--- a/fxbarcode/cbc_codebase.cpp
+++ b/fxbarcode/cbc_codebase.cpp
@@ -31,7 +31,7 @@ CBC_CodeBase::CBC_CodeBase(std::unique_ptr<CBC_Writer> pWriter)
CBC_CodeBase::~CBC_CodeBase() {}
bool CBC_CodeBase::SetTextLocation(BC_TEXT_LOC location) {
- return false;
+ return m_pBCWriter->SetTextLocation(location);
}
bool CBC_CodeBase::SetWideNarrowRatio(int8_t ratio) {
diff --git a/fxbarcode/cbc_codebase.h b/fxbarcode/cbc_codebase.h
index e0f402d91c..be49f8a0e7 100644
--- a/fxbarcode/cbc_codebase.h
+++ b/fxbarcode/cbc_codebase.h
@@ -29,12 +29,12 @@ class CBC_CodeBase {
virtual bool Encode(const WideStringView& contents) = 0;
virtual bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) = 0;
- virtual bool SetTextLocation(BC_TEXT_LOC location);
virtual bool SetWideNarrowRatio(int8_t ratio);
virtual bool SetStartChar(char start);
virtual bool SetEndChar(char end);
virtual bool SetErrorCorrectionLevel(int32_t level);
+ bool SetTextLocation(BC_TEXT_LOC location);
bool SetCharEncoding(int32_t encoding);
bool SetModuleHeight(int32_t moduleHeight);
bool SetModuleWidth(int32_t moduleWidth);
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.h b/fxbarcode/oned/BC_OnedCodaBarWriter.h
index 4b4f066ad4..ff30ab64d9 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.h
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.h
@@ -30,10 +30,10 @@ class CBC_OnedCodaBarWriter final : public CBC_OneDimWriter {
bool CheckContentValidity(const WideStringView& contents) override;
WideString FilterContents(const WideStringView& contents) override;
void SetDataLength(int32_t length) override;
+ bool SetTextLocation(BC_TEXT_LOC location) override;
virtual bool SetStartChar(char start);
virtual bool SetEndChar(char end);
- virtual bool SetTextLocation(BC_TEXT_LOC location);
virtual bool SetWideNarrowRatio(int8_t ratio);
virtual bool FindChar(wchar_t ch, bool isContent);
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.h b/fxbarcode/oned/BC_OnedCode128Writer.h
index f91874ce14..3a834e8c98 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer.h
+++ b/fxbarcode/oned/BC_OnedCode128Writer.h
@@ -33,8 +33,7 @@ class CBC_OnedCode128Writer final : public CBC_OneDimWriter {
uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
bool CheckContentValidity(const WideStringView& contents) override;
WideString FilterContents(const WideStringView& contents) override;
-
- bool SetTextLocation(BC_TEXT_LOC location);
+ bool SetTextLocation(BC_TEXT_LOC location) override;
BC_TYPE GetType() const { return m_codeFormat; }
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.h b/fxbarcode/oned/BC_OnedCode39Writer.h
index 97ef7a22b5..e136073209 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.h
+++ b/fxbarcode/oned/BC_OnedCode39Writer.h
@@ -28,8 +28,8 @@ class CBC_OnedCode39Writer final : public CBC_OneDimWriter {
bool CheckContentValidity(const WideStringView& contents) override;
WideString FilterContents(const WideStringView& contents) override;
WideString RenderTextContents(const WideStringView& contents) override;
+ bool SetTextLocation(BC_TEXT_LOC location) override;
- virtual bool SetTextLocation(BC_TEXT_LOC location);
virtual bool SetWideNarrowRatio(int8_t ratio);
bool encodedContents(const WideStringView& contents, WideString* result);
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.h b/fxbarcode/oned/BC_OnedEAN8Writer.h
index 853d4dace8..6295c4eb58 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.h
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.h
@@ -30,8 +30,8 @@ class CBC_OnedEAN8Writer final : public CBC_OneDimWriter {
bool CheckContentValidity(const WideStringView& contents) override;
WideString FilterContents(const WideStringView& contents) override;
void SetDataLength(int32_t length) override;
+ bool SetTextLocation(BC_TEXT_LOC location) override;
- bool SetTextLocation(BC_TEXT_LOC location);
int32_t CalcChecksum(const ByteString& contents);
private: