From c635c93c974db1c55032c36e81e98f3d214a249f Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 3 Jan 2017 15:46:55 -0500 Subject: Remove the ::GetCapacity methods. The GetCapacity methods return a void* because they return different types of internal class memory based on what the calling parameter was. This is confusing and makes it difficult to tell when then enum values can be removed. This CL removes GetCapacity and adds methods as needed to get the real values. Change-Id: I64c2edc858220624880e27f4ed49c2dae080f462 Reviewed-on: https://pdfium-review.googlesource.com/2137 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fwl/cfwl_barcode.cpp | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'xfa/fwl/cfwl_barcode.cpp') diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp index 83ab74a608..8b05927223 100644 --- a/xfa/fwl/cfwl_barcode.cpp +++ b/xfa/fwl/cfwl_barcode.cpp @@ -165,27 +165,20 @@ void CFWL_Barcode::GenerateBarcodeImageCache() { if (!m_pBarcodeEngine) return; - CFX_WideString wsText = GetText(); - - CFWL_ThemePart part; - part.m_pWidget = this; - IFWL_ThemeProvider* pTheme = GetAvailableTheme(); - CFGAS_GEFont* pFont = static_cast( - pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Font)); - CFX_Font* pCXFont = pFont ? pFont->GetDevFont() : nullptr; - if (pCXFont) - m_pBarcodeEngine->SetFont(pCXFont); - - FX_FLOAT* pFontSize = static_cast( - pTheme->GetCapacity(&part, CFWL_WidgetCapacity::FontSize)); - if (pFontSize) - m_pBarcodeEngine->SetFontSize(*pFontSize); - - FX_ARGB* pFontColor = static_cast( - pTheme->GetCapacity(&part, CFWL_WidgetCapacity::TextColor)); - if (pFontColor) - m_pBarcodeEngine->SetFontColor(*pFontColor); + if (pTheme) { + CFWL_ThemePart part; + part.m_pWidget = this; + + if (CFGAS_GEFont* pFont = pTheme->GetFont(&part)) { + if (CFX_Font* pCXFont = pFont->GetDevFont()) + m_pBarcodeEngine->SetFont(pCXFont); + } + m_pBarcodeEngine->SetFontSize(pTheme->GetFontSize(&part)); + m_pBarcodeEngine->SetFontColor(pTheme->GetTextColor(&part)); + } else { + m_pBarcodeEngine->SetFontSize(FWLTHEME_CAPACITY_FontSize); + } m_pBarcodeEngine->SetHeight(int32_t(GetRTClient().height)); m_pBarcodeEngine->SetWidth(int32_t(GetRTClient().width)); @@ -217,7 +210,7 @@ void CFWL_Barcode::GenerateBarcodeImageCache() { m_pBarcodeEngine->SetTruncated(m_bTruncated); int32_t errorCode = 0; - m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsStringC(), true, errorCode) + m_dwStatus = m_pBarcodeEngine->Encode(GetText().AsStringC(), true, errorCode) ? XFA_BCS_EncodeSuccess : 0; } -- cgit v1.2.3