summaryrefslogtreecommitdiff
path: root/fxbarcode/oned
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-16 01:30:59 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-17 21:40:45 +0000
commit080dfd89269a95713d31d66829016d4885afe76b (patch)
tree7858d204a9e166f3a51be9bef5e1104514d54ac2 /fxbarcode/oned
parent8f0bf890b4b15148a149bf9bbeead4eed6675e8a (diff)
downloadpdfium-080dfd89269a95713d31d66829016d4885afe76b.tar.xz
Remove dead barcode bitmap rendering code.
Change-Id: Idb5ef2aed456e84e0781c374b211560ab7d4fa3d Reviewed-on: https://pdfium-review.googlesource.com/4257 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxbarcode/oned')
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.cpp73
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.h11
-rw-r--r--fxbarcode/oned/BC_OnedEAN13Writer.cpp104
-rw-r--r--fxbarcode/oned/BC_OnedEAN13Writer.h1
-rw-r--r--fxbarcode/oned/BC_OnedEAN8Writer.cpp66
-rw-r--r--fxbarcode/oned/BC_OnedEAN8Writer.h1
-rw-r--r--fxbarcode/oned/BC_OnedUPCAWriter.cpp132
-rw-r--r--fxbarcode/oned/BC_OnedUPCAWriter.h1
8 files changed, 105 insertions, 284 deletions
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index f6b33f37a9..57b6c22a93 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -223,38 +223,13 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
m_fontColor, FXTEXT_CLEARTYPE);
}
-void CBC_OneDimWriter::ShowBitmapChars(
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- const CFX_ByteString str,
- float geWidth,
- FXTEXT_CHARPOS* pCharPos,
- float locX,
- float locY,
- int32_t barWidth) {
- int32_t iFontSize = (int32_t)fabs(m_fFontSize);
- int32_t iTextHeight = iFontSize + 1;
- CFX_FxgeDevice ge;
- ge.Create((int)geWidth, iTextHeight, m_colorSpace, nullptr);
- FX_RECT geRect(0, 0, (int)geWidth, iTextHeight);
- ge.FillRect(&geRect, m_backgroundColor);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0,
- static_cast<float>(iFontSize));
- ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont,
- static_cast<float>(iFontSize), &affine_matrix, m_fontColor,
- FXTEXT_CLEARTYPE);
- CFX_FxgeDevice geBitmap;
- geBitmap.Attach(pOutBitmap, false, nullptr, false);
- geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY);
-}
-
void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
int32_t multiple,
int32_t& e) {
- if (!device && !pOutBitmap) {
+ if (!device) {
e = BCExceptionIllegalArgument;
return;
}
@@ -306,51 +281,11 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
geWidth = (float)barWidth;
break;
}
- if (device) {
- ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (float)locX,
- (float)locY, barWidth);
- } else {
- ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (float)locX,
- (float)locY, barWidth);
- }
+ ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (float)locX,
+ (float)locY, barWidth);
FX_Free(pCharPos);
}
-void CBC_OneDimWriter::RenderBitmapResult(
- CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- const CFX_WideStringC& contents,
- int32_t& e) {
- if (!m_output)
- if (e != BCExceptionNO)
- return;
-
- pOutBitmap = CreateDIBitmap(m_output->GetWidth(), m_output->GetHeight());
- pOutBitmap->Clear(m_backgroundColor);
- if (!pOutBitmap) {
- e = BCExceptionFailToCreateBitmap;
- return;
- }
- for (int32_t x = 0; x < m_output->GetWidth(); x++) {
- for (int32_t y = 0; y < m_output->GetHeight(); y++) {
- if (m_output->Get(x, y)) {
- pOutBitmap->SetPixel(x, y, m_barColor);
- }
- }
- }
- int32_t i = 0;
- for (; i < contents.GetLength(); i++) {
- if (contents.GetAt(i) != ' ')
- break;
- }
- if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) {
- ShowChars(contents, pOutBitmap, nullptr, nullptr, m_barWidth, m_multiple,
- e);
- if (e != BCExceptionNO)
- return;
- }
- pOutBitmap = pOutBitmap->StretchTo(m_Width, m_Height);
-}
-
void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
const CFX_WideStringC& contents,
@@ -382,7 +317,7 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
break;
}
if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) {
- ShowChars(contents, nullptr, device, matrix, m_barWidth, m_multiple, e);
+ ShowChars(contents, device, matrix, m_barWidth, m_multiple, e);
if (e != BCExceptionNO)
return;
}
diff --git a/fxbarcode/oned/BC_OneDimWriter.h b/fxbarcode/oned/BC_OneDimWriter.h
index 11a1ed4fdf..15ae8e7bc8 100644
--- a/fxbarcode/oned/BC_OneDimWriter.h
+++ b/fxbarcode/oned/BC_OneDimWriter.h
@@ -42,9 +42,6 @@ class CBC_OneDimWriter : public CBC_Writer {
int32_t codeLength,
bool isDevice,
int32_t& e);
- virtual void RenderBitmapResult(CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- const CFX_WideStringC& contents,
- int32_t& e);
virtual void RenderDeviceResult(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
const CFX_WideStringC& contents,
@@ -68,19 +65,11 @@ class CBC_OneDimWriter : public CBC_Writer {
int32_t fontSize,
float& charsLen);
virtual void ShowChars(const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
int32_t multiple,
int32_t& e);
- virtual void ShowBitmapChars(const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
- const CFX_ByteString str,
- float geWidth,
- FXTEXT_CHARPOS* pCharPos,
- float locX,
- float locY,
- int32_t barWidth);
virtual void ShowDeviceChars(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
const CFX_ByteString str,
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 21b0f9a63f..a11938a4d9 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -169,13 +169,12 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents,
void CBC_OnedEAN13Writer::ShowChars(
const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
int32_t multiple,
int32_t& e) {
- if (!device && !pOutBitmap) {
+ if (!device) {
e = BCExceptionIllegalArgument;
return;
}
@@ -185,64 +184,48 @@ void CBC_OnedEAN13Writer::ShowChars(
int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
- CFX_FxgeDevice geBitmap;
- if (pOutBitmap)
- geBitmap.Attach(pOutBitmap, false, nullptr, false);
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
int32_t iTextHeight = iFontSize + 1;
CFX_ByteString tempStr = str.Mid(1, 6);
int32_t strWidth = multiple * 42;
- if (!pOutBitmap) {
- CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
- (float)(leftPosition + strWidth - 0.5), (float)m_Height);
- matr.Concat(*matrix);
- matr.TransformRect(rect);
- FX_RECT re = rect.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- 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);
- matr1.TransformRect(rect1);
- re = rect1.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- 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);
- matr2.TransformRect(rect2);
- re = rect2.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- }
+
+ CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
+ (float)(leftPosition + strWidth - 0.5), (float)m_Height);
+ matr.Concat(*matrix);
+ matr.TransformRect(rect);
+ FX_RECT re = rect.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ 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);
+ matr1.TransformRect(rect1);
+ re = rect1.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ 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);
+ matr2.TransformRect(rect2);
+ re = rect2.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+
float blank = 0.0;
iLen = tempStr.GetLength();
- if (!pOutBitmap) {
- strWidth = (int32_t)(strWidth * m_outputHScale);
- }
+ strWidth = (int32_t)(strWidth * m_outputHScale);
+
CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (float)strWidth, iFontSize,
blank);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize);
- CFX_FxgeDevice ge;
- if (pOutBitmap) {
- ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
- FX_RECT rect(0, 0, strWidth, iTextHeight);
- ge.FillRect(&rect, m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
- static_cast<float>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
(float)leftPosition * m_outputHScale,
(float)(m_Height - iTextHeight) + iFontSize);
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
@@ -251,22 +234,13 @@ void CBC_OnedEAN13Writer::ShowChars(
iLen = tempStr.GetLength();
CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (float)strWidth, iFontSize,
blank);
- if (pOutBitmap) {
- FX_RECT rect1(0, 0, strWidth, iTextHeight);
- ge.FillRect(&rect1, m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 7, m_pFont,
- static_cast<float>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 47 * multiple,
- m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(
1.0, 0.0, 0.0, -1.0,
(float)(leftPosition + 47 * multiple) * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos + 7, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
@@ -274,22 +248,14 @@ void CBC_OnedEAN13Writer::ShowChars(
tempStr = str.Mid(0, 1);
iLen = tempStr.GetLength();
strWidth = multiple * 7;
- if (!pOutBitmap)
- strWidth = (int32_t)(strWidth * m_outputHScale);
+ strWidth = (int32_t)(strWidth * m_outputHScale);
CalcTextInfo(tempStr, pCharPos, m_pFont, (float)strWidth, iFontSize, blank);
- if (pOutBitmap) {
- ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0.0,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.h b/fxbarcode/oned/BC_OnedEAN13Writer.h
index 1e99159132..377d18a916 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.h
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.h
@@ -46,7 +46,6 @@ class CBC_OnedEAN13Writer : public CBC_OneDimWriter {
protected:
void ShowChars(const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 5aea9f3c89..5ebc699c2c 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -167,13 +167,12 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents,
void CBC_OnedEAN8Writer::ShowChars(
const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
int32_t multiple,
int32_t& e) {
- if (!device && !pOutBitmap) {
+ if (!device) {
e = BCExceptionIllegalArgument;
return;
}
@@ -187,43 +186,29 @@ void CBC_OnedEAN8Writer::ShowChars(
int32_t iLen = tempStr.GetLength();
int32_t strWidth = 7 * multiple * 4;
float blank = 0.0;
- CFX_FxgeDevice geBitmap;
- if (pOutBitmap)
- geBitmap.Attach(pOutBitmap, false, nullptr, false);
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
int32_t iTextHeight = iFontSize + 1;
- if (!pOutBitmap) {
- CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
- (float)(leftPosition + strWidth - 0.5), (float)m_Height);
- matr.Concat(*matrix);
- matr.TransformRect(rect);
- FX_RECT re = rect.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- 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);
- matr1.TransformRect(rect1);
- re = rect1.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- }
- if (!pOutBitmap)
- strWidth = (int32_t)(strWidth * m_outputHScale);
+
+ CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
+ (float)(leftPosition + strWidth - 0.5), (float)m_Height);
+ matr.Concat(*matrix);
+ matr.TransformRect(rect);
+ FX_RECT re = rect.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ 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);
+ matr1.TransformRect(rect1);
+ re = rect1.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ strWidth = (int32_t)(strWidth * m_outputHScale);
CalcTextInfo(tempStr, pCharPos, m_pFont, (float)strWidth, iFontSize, blank);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize);
- CFX_FxgeDevice ge;
- if (pOutBitmap) {
- ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
(float)leftPosition * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
@@ -236,22 +221,13 @@ void CBC_OnedEAN8Writer::ShowChars(
iLen = tempStr.GetLength();
CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (float)strWidth, iFontSize,
blank);
- if (pOutBitmap) {
- ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 4, m_pFont,
- static_cast<float>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple,
- m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(
1.0, 0.0, 0.0, -1.0,
(float)(leftPosition + 33 * multiple) * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos + 4, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.h b/fxbarcode/oned/BC_OnedEAN8Writer.h
index 1d26d16620..57f3b44f7c 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.h
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.h
@@ -50,7 +50,6 @@ class CBC_OnedEAN8Writer : public CBC_OneDimWriter {
protected:
void ShowChars(const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index 87c6db12e1..3d31e2d389 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -119,13 +119,12 @@ uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents,
void CBC_OnedUPCAWriter::ShowChars(
const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
int32_t multiple,
int32_t& e) {
- if (!device && !pOutBitmap) {
+ if (!device) {
e = BCExceptionIllegalArgument;
return;
}
@@ -139,68 +138,53 @@ void CBC_OnedUPCAWriter::ShowChars(
CFX_ByteString tempStr = str.Mid(1, 5);
float strWidth = (float)35 * multiple;
float blank = 0.0;
- CFX_FxgeDevice geBitmap;
- if (pOutBitmap)
- geBitmap.Attach(pOutBitmap, false, nullptr, false);
iLen = tempStr.GetLength();
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
int32_t iTextHeight = iFontSize + 1;
- if (!pOutBitmap) {
- CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
- (float)(leftPosition + strWidth - 0.5), (float)m_Height);
- matr.Concat(*matrix);
- matr.TransformRect(rect);
- FX_RECT re = rect.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- 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),
- (float)((leftPosition + 40 * multiple) + strWidth - 0.5),
- (float)m_Height);
- matr1.Concat(*matrix);
- matr1.TransformRect(rect1);
- re = rect1.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- 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);
- matr2.TransformRect(rect2);
- re = rect2.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- 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),
- (float)((leftPosition + 85 * multiple) + strWidth1 - 0.5),
- (float)m_Height);
- matr3.Concat(*matrix);
- matr3.TransformRect(rect3);
- re = rect3.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- }
- if (!pOutBitmap)
- strWidth = strWidth * m_outputHScale;
+
+ CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
+ (float)(leftPosition + strWidth - 0.5), (float)m_Height);
+ matr.Concat(*matrix);
+ matr.TransformRect(rect);
+ FX_RECT re = rect.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ 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),
+ (float)((leftPosition + 40 * multiple) + strWidth - 0.5),
+ (float)m_Height);
+ matr1.Concat(*matrix);
+ matr1.TransformRect(rect1);
+ re = rect1.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ 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);
+ matr2.TransformRect(rect2);
+ re = rect2.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ 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),
+ (float)((leftPosition + 85 * multiple) + strWidth1 - 0.5),
+ (float)m_Height);
+ matr3.Concat(*matrix);
+ matr3.TransformRect(rect3);
+ re = rect3.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ strWidth = strWidth * m_outputHScale;
CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize);
- CFX_FxgeDevice ge;
- if (pOutBitmap) {
- ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
- static_cast<float>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
(float)leftPosition * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
@@ -208,22 +192,13 @@ void CBC_OnedUPCAWriter::ShowChars(
tempStr = str.Mid(6, 5);
iLen = tempStr.GetLength();
CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap) {
- FX_RECT rect2(0, 0, (int)strWidth, iTextHeight);
- ge.FillRect(&rect2, m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 6, m_pFont,
- static_cast<float>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple,
- m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(
1.0, 0.0, 0.0, -1.0,
(float)(leftPosition + 40 * multiple) * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos + 6, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
@@ -231,22 +206,14 @@ void CBC_OnedUPCAWriter::ShowChars(
tempStr = str.Mid(0, 1);
iLen = tempStr.GetLength();
strWidth = (float)multiple * 7;
- if (!pOutBitmap)
- strWidth = strWidth * m_outputHScale;
+ strWidth = strWidth * m_outputHScale;
CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap) {
- ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
@@ -254,22 +221,13 @@ void CBC_OnedUPCAWriter::ShowChars(
tempStr = str.Mid(11, 1);
iLen = tempStr.GetLength();
CalcTextInfo(tempStr, pCharPos + 11, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap) {
- ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 11, m_pFont,
- static_cast<float>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 85 * multiple,
- m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(
1.0, 0.0, 0.0, -1.0,
(float)(leftPosition + 85 * multiple) * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos + 11, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.h b/fxbarcode/oned/BC_OnedUPCAWriter.h
index 83e70302f8..c52f4e0ecd 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.h
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.h
@@ -52,7 +52,6 @@ class CBC_OnedUPCAWriter : public CBC_OneDimWriter {
protected:
void ShowChars(const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,