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

Side by Side Diff: xfa/fwl/cfwl_barcode.cpp

Issue 2609423003: Properly ref-count CFGAS_GEFont with CFX_RetainPtr. (Closed)
Patch Set: comments Created 3 years, 11 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fwl/cfwl_barcode.h" 7 #include "xfa/fwl/cfwl_barcode.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 m_dwStatus = 0; 163 m_dwStatus = 0;
164 CreateBarcodeEngine(); 164 CreateBarcodeEngine();
165 if (!m_pBarcodeEngine) 165 if (!m_pBarcodeEngine)
166 return; 166 return;
167 167
168 IFWL_ThemeProvider* pTheme = GetAvailableTheme(); 168 IFWL_ThemeProvider* pTheme = GetAvailableTheme();
169 if (pTheme) { 169 if (pTheme) {
170 CFWL_ThemePart part; 170 CFWL_ThemePart part;
171 part.m_pWidget = this; 171 part.m_pWidget = this;
172 172 if (CFX_RetainPtr<CFGAS_GEFont> pFont = pTheme->GetFont(&part)) {
173 if (CFGAS_GEFont* pFont = pTheme->GetFont(&part)) {
174 if (CFX_Font* pCXFont = pFont->GetDevFont()) 173 if (CFX_Font* pCXFont = pFont->GetDevFont())
175 m_pBarcodeEngine->SetFont(pCXFont); 174 m_pBarcodeEngine->SetFont(pCXFont);
176 } 175 }
177 m_pBarcodeEngine->SetFontSize(pTheme->GetFontSize(&part)); 176 m_pBarcodeEngine->SetFontSize(pTheme->GetFontSize(&part));
178 m_pBarcodeEngine->SetFontColor(pTheme->GetTextColor(&part)); 177 m_pBarcodeEngine->SetFontColor(pTheme->GetTextColor(&part));
179 } else { 178 } else {
180 m_pBarcodeEngine->SetFontSize(FWLTHEME_CAPACITY_FontSize); 179 m_pBarcodeEngine->SetFontSize(FWLTHEME_CAPACITY_FontSize);
181 } 180 }
182 181
183 m_pBarcodeEngine->SetHeight(int32_t(GetRTClient().height)); 182 m_pBarcodeEngine->SetHeight(int32_t(GetRTClient().height));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 215 }
217 216
218 void CFWL_Barcode::CreateBarcodeEngine() { 217 void CFWL_Barcode::CreateBarcodeEngine() {
219 if (m_pBarcodeEngine || m_type == BC_UNKNOWN) 218 if (m_pBarcodeEngine || m_type == BC_UNKNOWN)
220 return; 219 return;
221 220
222 std::unique_ptr<CFX_Barcode> pBarcode(new CFX_Barcode); 221 std::unique_ptr<CFX_Barcode> pBarcode(new CFX_Barcode);
223 if (pBarcode->Create(m_type)) 222 if (pBarcode->Create(m_type))
224 m_pBarcodeEngine = std::move(pBarcode); 223 m_pBarcodeEngine = std::move(pBarcode);
225 } 224 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698