summaryrefslogtreecommitdiff
path: root/fxbarcode/oned
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-09-05 12:07:02 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-05 17:27:26 +0000
commit1eae16d3b17d6b396969ecf81f6546f5a1d72dfd (patch)
tree6819d423b15bd05d68b296c6769a6bf531850dbe /fxbarcode/oned
parente7767a0c98548395c95b9f88fc30cf7b318f1939 (diff)
downloadpdfium-1eae16d3b17d6b396969ecf81f6546f5a1d72dfd.tar.xz
Remove isDevice parameter from barcode Render().
isDevice is currently false in tests and fuzzers and true in real usage. This CL changes it all to true. Change-Id: Idea14795d7f0bb70031e04e5c58e248de72fd39e Reviewed-on: https://pdfium-review.googlesource.com/13130 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxbarcode/oned')
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.cpp20
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.h3
-rw-r--r--fxbarcode/oned/BC_OnedCodaBarWriter.cpp5
-rw-r--r--fxbarcode/oned/BC_OnedCodaBarWriter.h3
-rw-r--r--fxbarcode/oned/BC_OnedCode39Writer.cpp5
-rw-r--r--fxbarcode/oned/BC_OnedCode39Writer.h3
6 files changed, 10 insertions, 29 deletions
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index 2927dda3af..1f96c4575b 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -285,8 +285,7 @@ bool CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
bool CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents,
uint8_t* code,
- int32_t codeLength,
- bool isDevice) {
+ int32_t codeLength) {
if (codeLength < 1)
return false;
@@ -299,28 +298,15 @@ bool CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents,
m_outputHScale =
m_Width > 0 ? static_cast<float>(m_Width) / static_cast<float>(codeLength)
: 1.0;
- if (!isDevice) {
- m_outputHScale =
- std::max(m_outputHScale, static_cast<float>(m_ModuleWidth));
- }
float dataLengthScale = 1.0;
if (m_iDataLenth > 0 && contents.GetLength() != 0)
dataLengthScale = float(contents.GetLength()) / float(m_iDataLenth);
if (m_iDataLenth > 0 && contents.GetLength() == 0)
dataLengthScale = float(1) / float(m_iDataLenth);
m_multiple = 1;
- if (!isDevice) {
- m_multiple = (int32_t)ceil(m_outputHScale * dataLengthScale);
- }
- int32_t outputHeight = 1;
- if (!isDevice)
- outputHeight = m_Height ? m_Height : std::max(20, m_ModuleHeight);
- int32_t outputWidth = codeLength;
- if (!isDevice)
- outputWidth = (int32_t)(codeLength * m_multiple / dataLengthScale);
+ const int32_t outputHeight = 1;
+ const int32_t outputWidth = codeLength;
m_barWidth = m_Width;
- if (!isDevice)
- m_barWidth = codeLength * m_multiple;
m_output.clear();
for (int32_t inputX = 0, outputX = leftPadding * m_multiple;
diff --git a/fxbarcode/oned/BC_OneDimWriter.h b/fxbarcode/oned/BC_OneDimWriter.h
index c220f382ee..2d604b5b51 100644
--- a/fxbarcode/oned/BC_OneDimWriter.h
+++ b/fxbarcode/oned/BC_OneDimWriter.h
@@ -26,8 +26,7 @@ class CBC_OneDimWriter : public CBC_Writer {
virtual bool RenderResult(const CFX_WideStringC& contents,
uint8_t* code,
- int32_t codeLength,
- bool isDevice);
+ int32_t codeLength);
virtual bool CheckContentValidity(const CFX_WideStringC& contents) = 0;
virtual CFX_WideString FilterContents(const CFX_WideStringC& contents) = 0;
virtual CFX_WideString RenderTextContents(const CFX_WideStringC& contents);
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
index 5a56acb37c..03a733a8c2 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
@@ -197,8 +197,7 @@ CFX_WideString CBC_OnedCodaBarWriter::encodedContents(
bool CBC_OnedCodaBarWriter::RenderResult(const CFX_WideStringC& contents,
uint8_t* code,
- int32_t codeLength,
- bool isDevice) {
+ int32_t codeLength) {
return CBC_OneDimWriter::RenderResult(encodedContents(contents).AsStringC(),
- code, codeLength, isDevice);
+ code, codeLength);
}
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.h b/fxbarcode/oned/BC_OnedCodaBarWriter.h
index 94933612f5..6a5f315073 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.h
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.h
@@ -27,8 +27,7 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter {
int32_t hints) override;
bool RenderResult(const CFX_WideStringC& contents,
uint8_t* code,
- int32_t codeLength,
- bool isDevice) override;
+ int32_t codeLength) override;
bool CheckContentValidity(const CFX_WideStringC& contents) override;
CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
void SetDataLength(int32_t length) override;
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp
index ba8769ed95..72d7dc4df8 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp
@@ -245,11 +245,10 @@ bool CBC_OnedCode39Writer::encodedContents(const CFX_WideStringC& contents,
bool CBC_OnedCode39Writer::RenderResult(const CFX_WideStringC& contents,
uint8_t* code,
- int32_t codeLength,
- bool isDevice) {
+ int32_t codeLength) {
CFX_WideString encodedCon;
if (!encodedContents(contents, &encodedCon))
return false;
return CBC_OneDimWriter::RenderResult(encodedCon.AsStringC(), code,
- codeLength, isDevice);
+ codeLength);
}
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.h b/fxbarcode/oned/BC_OnedCode39Writer.h
index 4892a1f8d5..fe57d3ca9a 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.h
+++ b/fxbarcode/oned/BC_OnedCode39Writer.h
@@ -25,8 +25,7 @@ class CBC_OnedCode39Writer : public CBC_OneDimWriter {
int32_t& outLength) override;
bool RenderResult(const CFX_WideStringC& contents,
uint8_t* code,
- int32_t codeLength,
- bool isDevice) override;
+ int32_t codeLength) override;
bool CheckContentValidity(const CFX_WideStringC& contents) override;
CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
CFX_WideString RenderTextContents(const CFX_WideStringC& contents) override;