diff options
author | Lei Zhang <thestig@chromium.org> | 2017-04-16 01:30:59 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-17 21:40:45 +0000 |
commit | 080dfd89269a95713d31d66829016d4885afe76b (patch) | |
tree | 7858d204a9e166f3a51be9bef5e1104514d54ac2 /fxbarcode/oned/BC_OnedEAN13Writer.cpp | |
parent | 8f0bf890b4b15148a149bf9bbeead4eed6675e8a (diff) | |
download | pdfium-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/BC_OnedEAN13Writer.cpp')
-rw-r--r-- | fxbarcode/oned/BC_OnedEAN13Writer.cpp | 104 |
1 files changed, 35 insertions, 69 deletions
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); |