summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_barcode.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-03 15:46:55 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-03 21:10:00 +0000
commitc635c93c974db1c55032c36e81e98f3d214a249f (patch)
tree145a60ec7a1d43755e85e36890f73ba0e4625361 /xfa/fwl/cfwl_barcode.cpp
parent3cdcfeb04b5c496199d8c88ebd2402c3db4413ab (diff)
downloadpdfium-c635c93c974db1c55032c36e81e98f3d214a249f.tar.xz
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 <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_barcode.cpp')
-rw-r--r--xfa/fwl/cfwl_barcode.cpp35
1 files changed, 14 insertions, 21 deletions
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<CFGAS_GEFont*>(
- pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Font));
- CFX_Font* pCXFont = pFont ? pFont->GetDevFont() : nullptr;
- if (pCXFont)
- m_pBarcodeEngine->SetFont(pCXFont);
-
- FX_FLOAT* pFontSize = static_cast<FX_FLOAT*>(
- pTheme->GetCapacity(&part, CFWL_WidgetCapacity::FontSize));
- if (pFontSize)
- m_pBarcodeEngine->SetFontSize(*pFontSize);
-
- FX_ARGB* pFontColor = static_cast<FX_ARGB*>(
- 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;
}