diff options
author | thestig <thestig@chromium.org> | 2016-05-26 20:15:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-26 20:15:19 -0700 |
commit | befa4506dc9d2a679c526aff96c09bcb0e9daecb (patch) | |
tree | 3c1d3e11d9802b2db95e35f4ab81ff449492ee10 /xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp | |
parent | 7aed76f53137a71491040c776ab2f8931e91061b (diff) | |
download | pdfium-befa4506dc9d2a679c526aff96c09bcb0e9daecb.tar.xz |
Remove default arguments from CFX_FxgeDevice.
Remove unused dithering code.
Review-Url: https://codereview.chromium.org/2010813003
Diffstat (limited to 'xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp')
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp index 4427cb8970..2aa57d18d1 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -158,6 +158,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, } return result; } + void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, CFX_DIBitmap* pOutBitmap, CFX_RenderDevice* device, @@ -165,10 +166,11 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, int32_t barWidth, int32_t multiple, int32_t& e) { - if (device == NULL && pOutBitmap == NULL) { + if (!device && !pOutBitmap) { e = BCExceptionIllegalArgument; return; } + int32_t leftPosition = 3 * multiple; CFX_ByteString str = FX_UTF8Encode(contents); int32_t iLength = str.GetLength(); @@ -179,12 +181,12 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, int32_t strWidth = 7 * multiple * 4; FX_FLOAT blank = 0.0; CFX_FxgeDevice geBitmap; - if (pOutBitmap) { - geBitmap.Attach(pOutBitmap); - } + if (pOutBitmap) + geBitmap.Attach(pOutBitmap, false, nullptr, false); + int32_t iFontSize = (int32_t)fabs(m_fFontSize); int32_t iTextHeight = iFontSize + 1; - if (pOutBitmap == NULL) { + if (!pOutBitmap) { CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); CFX_FloatRect rect( (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), @@ -204,16 +206,16 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, re = rect1.GetOutterRect(); device->FillRect(&re, m_backgroundColor); } - if (pOutBitmap == NULL) { + if (!pOutBitmap) strWidth = (int32_t)(strWidth * m_outputHScale); - } + CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, blank); CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); CFX_FxgeDevice ge; if (pOutBitmap) { delete ge.GetBitmap(); - ge.Create(strWidth, iTextHeight, FXDIB_Argb); + ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); ge.DrawNormalText(iLen, pCharPos, m_pFont, CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, @@ -236,7 +238,7 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, blank); if (pOutBitmap) { delete ge.GetBitmap(); - ge.Create(strWidth, iTextHeight, FXDIB_Argb); + ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); ge.DrawNormalText(iLen, pCharPos + 4, m_pFont, CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, @@ -259,6 +261,7 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, } FX_Free(pCharPos); } + void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents, uint8_t* code, int32_t codeLength, |