diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-14 14:43:42 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-14 19:05:58 +0000 |
commit | 05df075154a832fcb476e1dfcfb865722d0ea898 (patch) | |
tree | b8b771b62adae74d5d5ee561db75d10de3a848bf /xfa/fxbarcode/oned | |
parent | 6b94f01d1c8ad386d497428c7397b1a99614aeba (diff) | |
download | pdfium-05df075154a832fcb476e1dfcfb865722d0ea898.tar.xz |
Replace FX_FLOAT with underlying float type.
Change-Id: I158b7d80b0ec28b742a9f2d5a96f3dde7fb3ab56
Reviewed-on: https://pdfium-review.googlesource.com/3031
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fxbarcode/oned')
-rw-r--r-- | xfa/fxbarcode/oned/BC_OneDimWriter.cpp | 90 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OneDimWriter.h | 22 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp | 51 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp | 39 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp | 63 |
5 files changed, 127 insertions, 138 deletions
diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp index dd7fcaa864..02ae58dc84 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp @@ -71,7 +71,7 @@ bool CBC_OneDimWriter::SetFont(CFX_Font* cFont) { return true; } -void CBC_OneDimWriter::SetFontSize(FX_FLOAT size) { +void CBC_OneDimWriter::SetFontSize(float size) { m_fFontSize = size; } @@ -151,39 +151,39 @@ int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target, void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, FXTEXT_CHARPOS* charPos, CFX_Font* cFont, - FX_FLOAT geWidth, + float geWidth, int32_t fontSize, - FX_FLOAT& charsLen) { + float& charsLen) { std::unique_ptr<CFX_UnicodeEncodingEx> encoding( FX_CreateFontEncodingEx(cFont)); int32_t length = text.GetLength(); uint32_t* pCharCode = FX_Alloc(uint32_t, text.GetLength()); - FX_FLOAT charWidth = 0; + float charWidth = 0; for (int32_t j = 0; j < text.GetLength(); j++) { pCharCode[j] = encoding->CharCodeFromUnicode(text[j]); int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]); int32_t glyp_value = cFont->GetGlyphWidth(glyp_code); - FX_FLOAT temp = (FX_FLOAT)((glyp_value)*fontSize / 1000.0); + float temp = (float)((glyp_value)*fontSize / 1000.0); charWidth += temp; } charsLen = charWidth; - FX_FLOAT leftPositon = (FX_FLOAT)(geWidth - charsLen) / 2.0f; + float leftPositon = (float)(geWidth - charsLen) / 2.0f; if (leftPositon < 0 && geWidth == 0) { leftPositon = 0; } - FX_FLOAT penX = 0.0; - FX_FLOAT penY = - (FX_FLOAT)FXSYS_abs(cFont->GetDescent()) * (FX_FLOAT)fontSize / 1000.0f; - FX_FLOAT left = leftPositon; - FX_FLOAT top = 0.0; + float penX = 0.0; + float penY = + (float)FXSYS_abs(cFont->GetDescent()) * (float)fontSize / 1000.0f; + float left = leftPositon; + float top = 0.0; charPos[0].m_Origin = CFX_PointF(penX + left, penY + top); charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[0]); charPos[0].m_FontCharWidth = cFont->GetGlyphWidth(charPos[0].m_GlyphIndex); #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ charPos[0].m_ExtGID = charPos[0].m_GlyphIndex; #endif - penX += (FX_FLOAT)(charPos[0].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f; + penX += (float)(charPos[0].m_FontCharWidth) * (float)fontSize / 1000.0f; for (int32_t i = 1; i < length; i++) { charPos[i].m_Origin = CFX_PointF(penX + left, penY + top); charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]); @@ -191,8 +191,7 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ charPos[i].m_ExtGID = charPos[i].m_GlyphIndex; #endif - penX += - (FX_FLOAT)(charPos[i].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f; + penX += (float)(charPos[i].m_FontCharWidth) * (float)fontSize / 1000.0f; } FX_Free(pCharCode); } @@ -200,37 +199,37 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device, const CFX_Matrix* matrix, const CFX_ByteString str, - FX_FLOAT geWidth, + float geWidth, FXTEXT_CHARPOS* pCharPos, - FX_FLOAT locX, - FX_FLOAT locY, + float locX, + float locY, int32_t barWidth) { int32_t iFontSize = (int32_t)fabs(m_fFontSize); int32_t iTextHeight = iFontSize + 1; - CFX_FloatRect rect((FX_FLOAT)locX, (FX_FLOAT)locY, (FX_FLOAT)(locX + geWidth), - (FX_FLOAT)(locY + iTextHeight)); + CFX_FloatRect rect((float)locX, (float)locY, (float)(locX + geWidth), + (float)(locY + iTextHeight)); if (geWidth != m_Width) { rect.right -= 1; } matrix->TransformRect(rect); FX_RECT re = rect.GetOuterRect(); device->FillRect(&re, m_backgroundColor); - CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (FX_FLOAT)locX, - (FX_FLOAT)(locY + iFontSize)); + CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (float)locX, + (float)(locY + iFontSize)); if (matrix) { affine_matrix.Concat(*matrix); } device->DrawNormalText(str.GetLength(), pCharPos, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + static_cast<float>(iFontSize), &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); } void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, const CFX_ByteString str, - FX_FLOAT geWidth, + float geWidth, FXTEXT_CHARPOS* pCharPos, - FX_FLOAT locX, - FX_FLOAT locY, + float locX, + float locY, int32_t barWidth) { int32_t iFontSize = (int32_t)fabs(m_fFontSize); int32_t iTextHeight = iFontSize + 1; @@ -239,10 +238,10 @@ void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, 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<FX_FLOAT>(iFontSize)); + static_cast<float>(iFontSize)); ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, - m_fontColor, FXTEXT_CLEARTYPE); + 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); @@ -267,14 +266,14 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, int32_t iLen = str.GetLength(); FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen); FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen); - FX_FLOAT charsLen = 0; - FX_FLOAT geWidth = 0; + float charsLen = 0; + float geWidth = 0; if (m_locTextLoc == BC_TEXT_LOC_ABOVEEMBED || m_locTextLoc == BC_TEXT_LOC_BELOWEMBED) { geWidth = 0; } else if (m_locTextLoc == BC_TEXT_LOC_ABOVE || m_locTextLoc == BC_TEXT_LOC_BELOW) { - geWidth = (FX_FLOAT)barWidth; + geWidth = (float)barWidth; } int32_t iFontSize = (int32_t)fabs(m_fFontSize); int32_t iTextHeight = iFontSize + 1; @@ -293,7 +292,7 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, case BC_TEXT_LOC_ABOVE: locX = 0; locY = 0; - geWidth = (FX_FLOAT)barWidth; + geWidth = (float)barWidth; break; case BC_TEXT_LOC_BELOWEMBED: locX = (int32_t)(barWidth - charsLen) / 2; @@ -304,15 +303,15 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, default: locX = 0; locY = m_Height - iTextHeight; - geWidth = (FX_FLOAT)barWidth; + geWidth = (float)barWidth; break; } if (device) { - ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (FX_FLOAT)locX, - (FX_FLOAT)locY, barWidth); + ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (float)locX, + (float)locY, barWidth); } else { - ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (FX_FLOAT)locX, - (FX_FLOAT)locY, barWidth); + ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (float)locX, + (float)locY, barWidth); } FX_Free(pCharPos); } @@ -364,16 +363,15 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, CFX_GraphStateData stateData; CFX_PathData path; - path.AppendRect(0, 0, (FX_FLOAT)m_Width, (FX_FLOAT)m_Height); + path.AppendRect(0, 0, (float)m_Width, (float)m_Height); device->DrawPath(&path, matrix, &stateData, m_backgroundColor, m_backgroundColor, FXFILL_ALTERNATE); - CFX_Matrix matri(m_outputHScale, 0.0, 0.0, (FX_FLOAT)m_Height, 0.0, 0.0); + CFX_Matrix matri(m_outputHScale, 0.0, 0.0, (float)m_Height, 0.0, 0.0); matri.Concat(*matrix); for (int32_t x = 0; x < m_output->GetWidth(); x++) { for (int32_t y = 0; y < m_output->GetHeight(); y++) { CFX_PathData rect; - rect.AppendRect((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)(x + 1), - (FX_FLOAT)(y + 1)); + rect.AppendRect((float)x, (float)y, (float)(x + 1), (float)(y + 1)); if (m_output->Get(x, y)) { CFX_GraphStateData data; device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING); @@ -417,18 +415,18 @@ void CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents, codeLength += rightPadding; m_outputHScale = 1.0; if (m_Width > 0) { - m_outputHScale = (FX_FLOAT)m_Width / (FX_FLOAT)codeLength; + m_outputHScale = (float)m_Width / (float)codeLength; } if (!isDevice) { m_outputHScale = - std::max(m_outputHScale, static_cast<FX_FLOAT>(m_ModuleWidth)); + std::max(m_outputHScale, static_cast<float>(m_ModuleWidth)); } - FX_FLOAT dataLengthScale = 1.0; + float dataLengthScale = 1.0; if (m_iDataLenth > 0 && contents.GetLength() != 0) { - dataLengthScale = FX_FLOAT(contents.GetLength()) / FX_FLOAT(m_iDataLenth); + dataLengthScale = float(contents.GetLength()) / float(m_iDataLenth); } if (m_iDataLenth > 0 && contents.GetLength() == 0) { - dataLengthScale = FX_FLOAT(1) / FX_FLOAT(m_iDataLenth); + dataLengthScale = float(1) / float(m_iDataLenth); } m_multiple = 1; if (!isDevice) { diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.h b/xfa/fxbarcode/oned/BC_OneDimWriter.h index b7c5cebe06..b2447cffb7 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.h +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.h @@ -55,7 +55,7 @@ class CBC_OneDimWriter : public CBC_Writer { virtual void SetPrintChecksum(bool checksum); virtual void SetDataLength(int32_t length); virtual void SetCalcChecksum(bool state); - virtual void SetFontSize(FX_FLOAT size); + virtual void SetFontSize(float size); virtual void SetFontStyle(int32_t style); virtual void SetFontColor(FX_ARGB color); bool SetFont(CFX_Font* cFont); @@ -64,9 +64,9 @@ class CBC_OneDimWriter : public CBC_Writer { virtual void CalcTextInfo(const CFX_ByteString& text, FXTEXT_CHARPOS* charPos, CFX_Font* cFont, - FX_FLOAT geWidth, + float geWidth, int32_t fontSize, - FX_FLOAT& charsLen); + float& charsLen); virtual void ShowChars(const CFX_WideStringC& contents, CFX_DIBitmap* pOutBitmap, CFX_RenderDevice* device, @@ -76,18 +76,18 @@ class CBC_OneDimWriter : public CBC_Writer { int32_t& e); virtual void ShowBitmapChars(CFX_DIBitmap* pOutBitmap, const CFX_ByteString str, - FX_FLOAT geWidth, + float geWidth, FXTEXT_CHARPOS* pCharPos, - FX_FLOAT locX, - FX_FLOAT locY, + float locX, + float locY, int32_t barWidth); virtual void ShowDeviceChars(CFX_RenderDevice* device, const CFX_Matrix* matrix, const CFX_ByteString str, - FX_FLOAT geWidth, + float geWidth, FXTEXT_CHARPOS* pCharPos, - FX_FLOAT locX, - FX_FLOAT locY, + float locX, + float locY, int32_t barWidth); virtual int32_t AppendPattern(uint8_t* target, int32_t pos, @@ -102,7 +102,7 @@ class CBC_OneDimWriter : public CBC_Writer { int32_t m_iDataLenth; bool m_bCalcChecksum; CFX_Font* m_pFont; - FX_FLOAT m_fFontSize; + float m_fFontSize; int32_t m_iFontStyle; uint32_t m_fontColor; BC_TEXT_LOC m_locTextLoc; @@ -112,7 +112,7 @@ class CBC_OneDimWriter : public CBC_Writer { std::unique_ptr<CBC_CommonBitMatrix> m_output; int32_t m_barWidth; int32_t m_multiple; - FX_FLOAT m_outputHScale; + float m_outputHScale; }; #endif // XFA_FXBARCODE_ONED_BC_ONEDIMWRITER_H_ diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp index 47e47eaddb..555b58643d 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -194,18 +194,16 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents, 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( - (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height); + 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( - (FX_FLOAT)(leftPosition + 47 * multiple), - (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)(leftPosition + 47 * multiple + strWidth - 0.5), - (FX_FLOAT)m_Height); + 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); @@ -213,63 +211,63 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents, 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, (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)strWidth1 - 0.5f, (FX_FLOAT)m_Height); + 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); } - FX_FLOAT blank = 0.0; + float blank = 0.0; iLen = tempStr.GetLength(); if (!pOutBitmap) { strWidth = (int32_t)(strWidth * m_outputHScale); } - CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (FX_FLOAT)strWidth, iFontSize, + CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (float)strWidth, iFontSize, blank); - CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); + 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<FX_FLOAT>(iFontSize), &affine_matrix, + 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, - (FX_FLOAT)leftPosition * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight) + iFontSize); + (float)leftPosition * m_outputHScale, + (float)(m_Height - iTextHeight) + iFontSize); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 1, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(7, 6); iLen = tempStr.GetLength(); - CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (FX_FLOAT)strWidth, iFontSize, + 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<FX_FLOAT>(iFontSize), &affine_matrix, + 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, - (FX_FLOAT)(leftPosition + 47 * multiple) * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(leftPosition + 47 * multiple) * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 7, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(0, 1); @@ -278,23 +276,22 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents, if (!pOutBitmap) strWidth = (int32_t)(strWidth * m_outputHScale); - CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, - blank); + CalcTextInfo(tempStr, pCharPos, m_pFont, (float)strWidth, iFontSize, blank); if (pOutBitmap) { delete ge.GetBitmap(); ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); - ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize), + 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, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } FX_Free(pCharPos); diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp index cd21759a19..5f571c2a30 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -185,7 +185,7 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, CFX_ByteString tempStr = str.Mid(0, 4); int32_t iLen = tempStr.GetLength(); int32_t strWidth = 7 * multiple * 4; - FX_FLOAT blank = 0.0; + float blank = 0.0; CFX_FxgeDevice geBitmap; if (pOutBitmap) geBitmap.Attach(pOutBitmap, false, nullptr, false); @@ -194,19 +194,17 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, 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( - (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height); + 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( - (FX_FLOAT)(leftPosition + 33 * multiple), - (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)(leftPosition + 33 * multiple + strWidth - 0.5), - (FX_FLOAT)m_Height); + 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(); @@ -215,49 +213,48 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, 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); + 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) { delete ge.GetBitmap(); ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); - ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize), + 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, - (FX_FLOAT)leftPosition * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)leftPosition * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); affine_matrix1.Concat(*matrix); device->DrawNormalText(iLen, pCharPos, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(4, 4); iLen = tempStr.GetLength(); - CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (FX_FLOAT)strWidth, iFontSize, + CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (float)strWidth, iFontSize, blank); if (pOutBitmap) { delete ge.GetBitmap(); ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); ge.DrawNormalText(iLen, pCharPos + 4, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + 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, - (FX_FLOAT)(leftPosition + 33 * multiple) * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(leftPosition + 33 * multiple) * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 4, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } FX_Free(pCharPos); diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp index 3cb72f204a..cefae97d8d 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -136,8 +136,8 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen); FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen); CFX_ByteString tempStr = str.Mid(1, 5); - FX_FLOAT strWidth = (FX_FLOAT)35 * multiple; - FX_FLOAT blank = 0.0; + float strWidth = (float)35 * multiple; + float blank = 0.0; CFX_FxgeDevice geBitmap; if (pOutBitmap) geBitmap.Attach(pOutBitmap, false, nullptr, false); @@ -147,37 +147,34 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, 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( - (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height); + 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( - (FX_FLOAT)(leftPosition + 40 * multiple), - (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)((leftPosition + 40 * multiple) + strWidth - 0.5), - (FX_FLOAT)m_Height); + (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); - FX_FLOAT strWidth1 = (FX_FLOAT)multiple * 7; + 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, (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)strWidth1 - 1, (FX_FLOAT)m_Height); + 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( - (FX_FLOAT)(leftPosition + 85 * multiple), - (FX_FLOAT)(m_Height - iTextHeight), - (FX_FLOAT)((leftPosition + 85 * multiple) + strWidth1 - 0.5), - (FX_FLOAT)m_Height); + (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(); @@ -187,24 +184,24 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, 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, (FX_FLOAT)iFontSize); + 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<FX_FLOAT>(iFontSize), &affine_matrix, + 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, - (FX_FLOAT)leftPosition * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)leftPosition * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 1, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(6, 5); @@ -214,25 +211,25 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, FX_RECT rect2(0, 0, (int)strWidth, iTextHeight); ge.FillRect(&rect2, m_backgroundColor); ge.DrawNormalText(iLen, pCharPos + 6, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + 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, - (FX_FLOAT)(leftPosition + 40 * multiple) * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(leftPosition + 40 * multiple) * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 6, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(0, 1); iLen = tempStr.GetLength(); - strWidth = (FX_FLOAT)multiple * 7; + strWidth = (float)multiple * 7; if (!pOutBitmap) strWidth = strWidth * m_outputHScale; @@ -241,17 +238,17 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, delete ge.GetBitmap(); ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); - ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<FX_FLOAT>(iFontSize), + 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, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } tempStr = str.Mid(11, 1); @@ -262,20 +259,20 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr); ge.GetBitmap()->Clear(m_backgroundColor); ge.DrawNormalText(iLen, pCharPos + 11, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix, + 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, - (FX_FLOAT)(leftPosition + 85 * multiple) * m_outputHScale, - (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); + (float)(leftPosition + 85 * multiple) * m_outputHScale, + (float)(m_Height - iTextHeight + iFontSize)); if (matrix) { affine_matrix1.Concat(*matrix); } device->DrawNormalText(iLen, pCharPos + 11, m_pFont, - static_cast<FX_FLOAT>(iFontSize), &affine_matrix1, + static_cast<float>(iFontSize), &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); } FX_Free(pCharPos); |