Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: xfa/fwl/core/ifwl_barcode.cpp

Issue 2501033005: Continue fwl/core nit cleanup. (Closed)
Patch Set: Rebase to master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_barcode.h ('k') | xfa/fwl/core/ifwl_caret.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/ifwl_barcode.cpp
diff --git a/xfa/fwl/core/ifwl_barcode.cpp b/xfa/fwl/core/ifwl_barcode.cpp
index c918b3bc8c3e7c10efd8e991c0d2c333f3b435a8..d055a4bcd134abea7f2bbd6c136b1819387b0391 100644
--- a/xfa/fwl/core/ifwl_barcode.cpp
+++ b/xfa/fwl/core/ifwl_barcode.cpp
@@ -26,9 +26,9 @@ FWL_Type IFWL_Barcode::GetClassID() const {
}
void IFWL_Barcode::Update() {
- if (IsLocked()) {
+ if (IsLocked())
return;
- }
+
IFWL_Edit::Update();
GenerateBarcodeImageCache();
}
@@ -41,15 +41,15 @@ void IFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics,
return;
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
GenerateBarcodeImageCache();
- if (!m_pBarcodeEngine || (m_dwStatus & XFA_BCS_EncodeSuccess) == 0) {
+ if (!m_pBarcodeEngine || (m_dwStatus & XFA_BCS_EncodeSuccess) == 0)
return;
- }
+
CFX_Matrix mt;
mt.e = GetRTClient().left;
mt.f = GetRTClient().top;
- if (pMatrix) {
+ if (pMatrix)
mt.Concat(*pMatrix);
- }
+
int32_t errorCode = 0;
m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix,
errorCode);
@@ -57,9 +57,11 @@ void IFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics,
}
IFWL_Edit::DrawWidget(pGraphics, pMatrix);
}
+
void IFWL_Barcode::GenerateBarcodeImageCache() {
if ((m_dwStatus & XFA_BCS_NeedUpdate) == 0)
return;
+
m_dwStatus = 0;
CreateBarcodeEngine();
IFWL_BarcodeDP* pData =
@@ -68,70 +70,60 @@ void IFWL_Barcode::GenerateBarcodeImageCache() {
return;
if (!m_pBarcodeEngine)
return;
+
CFX_WideString wsText;
GetText(wsText);
CFWL_ThemePart part;
part.m_pWidget = this;
+
IFWL_ThemeProvider* pTheme = GetAvailableTheme();
CFGAS_GEFont* pFont = static_cast<CFGAS_GEFont*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Font));
CFX_Font* pCXFont = pFont ? pFont->GetDevFont() : nullptr;
- if (pCXFont) {
+ if (pCXFont)
m_pBarcodeEngine->SetFont(pCXFont);
- }
+
FX_FLOAT* pFontSize = static_cast<FX_FLOAT*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::FontSize));
- if (pFontSize) {
+ if (pFontSize)
m_pBarcodeEngine->SetFontSize(*pFontSize);
- }
+
FX_ARGB* pFontColor = static_cast<FX_ARGB*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::TextColor));
- if (pFontColor) {
+ if (pFontColor)
m_pBarcodeEngine->SetFontColor(*pFontColor);
- }
+
m_pBarcodeEngine->SetHeight(int32_t(GetRTClient().height));
m_pBarcodeEngine->SetWidth(int32_t(GetRTClient().width));
uint32_t dwAttributeMask = pData->GetBarcodeAttributeMask();
- if (dwAttributeMask & FWL_BCDATTRIBUTE_CHARENCODING) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_CHARENCODING)
m_pBarcodeEngine->SetCharEncoding(pData->GetCharEncoding());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_MODULEHEIGHT) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_MODULEHEIGHT)
m_pBarcodeEngine->SetModuleHeight(pData->GetModuleHeight());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_MODULEWIDTH) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_MODULEWIDTH)
m_pBarcodeEngine->SetModuleWidth(pData->GetModuleWidth());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_DATALENGTH) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_DATALENGTH)
m_pBarcodeEngine->SetDataLength(pData->GetDataLength());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_CALCHECKSUM) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_CALCHECKSUM)
m_pBarcodeEngine->SetCalChecksum(pData->GetCalChecksum());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_PRINTCHECKSUM) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_PRINTCHECKSUM)
m_pBarcodeEngine->SetPrintChecksum(pData->GetPrintChecksum());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_TEXTLOCATION) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_TEXTLOCATION)
m_pBarcodeEngine->SetTextLocation(pData->GetTextLocation());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_WIDENARROWRATIO) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_WIDENARROWRATIO)
m_pBarcodeEngine->SetWideNarrowRatio(pData->GetWideNarrowRatio());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_STARTCHAR) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_STARTCHAR)
m_pBarcodeEngine->SetStartChar(pData->GetStartChar());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_ENDCHAR) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_ENDCHAR)
m_pBarcodeEngine->SetEndChar(pData->GetEndChar());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_VERSION) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_VERSION)
m_pBarcodeEngine->SetVersion(pData->GetVersion());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_ECLEVEL) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_ECLEVEL)
m_pBarcodeEngine->SetErrorCorrectionLevel(pData->GetErrorCorrectionLevel());
- }
- if (dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED) {
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED)
m_pBarcodeEngine->SetTruncated(pData->GetTruncated());
- }
+
int32_t errorCode = 0;
m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsStringC(), true, errorCode)
? XFA_BCS_EncodeSuccess
@@ -155,15 +147,17 @@ void IFWL_Barcode::SetType(BC_TYPE type) {
m_type = type;
m_dwStatus = XFA_BCS_NeedUpdate;
}
+
void IFWL_Barcode::SetText(const CFX_WideString& wsText) {
m_pBarcodeEngine.reset();
m_dwStatus = XFA_BCS_NeedUpdate;
IFWL_Edit::SetText(wsText);
}
-bool IFWL_Barcode::IsProtectedType() {
- if (!m_pBarcodeEngine) {
+
+bool IFWL_Barcode::IsProtectedType() const {
+ if (!m_pBarcodeEngine)
return true;
- }
+
BC_TYPE tEngineType = m_pBarcodeEngine->GetType();
if (tEngineType == BC_QR_CODE || tEngineType == BC_PDF417 ||
tEngineType == BC_DATAMATRIX) {
« no previous file with comments | « xfa/fwl/core/ifwl_barcode.h ('k') | xfa/fwl/core/ifwl_caret.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698