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

Side by Side Diff: xfa/fgas/font/cfgas_gefont.cpp

Issue 2451493002: Refcount all the IFX_ stream classes all the time. (Closed)
Patch Set: Clean up cast expression Created 4 years 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
« no previous file with comments | « xfa/fgas/font/cfgas_gefont.h ('k') | xfa/fxfa/app/xfa_checksum.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fgas/font/cfgas_gefont.h" 7 #include "xfa/fgas/font/cfgas_gefont.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return InitFont(); 203 return InitFont();
204 } 204 }
205 205
206 bool CFGAS_GEFont::LoadFontInternal(IFGAS_Stream* pFontStream, 206 bool CFGAS_GEFont::LoadFontInternal(IFGAS_Stream* pFontStream,
207 bool bSaveStream) { 207 bool bSaveStream) {
208 if (m_pFont || m_pFileRead || !pFontStream || pFontStream->GetLength() < 1) 208 if (m_pFont || m_pFileRead || !pFontStream || pFontStream->GetLength() < 1)
209 return false; 209 return false;
210 if (bSaveStream) 210 if (bSaveStream)
211 m_pStream.reset(pFontStream); 211 m_pStream.reset(pFontStream);
212 212
213 m_pFileRead.reset(pFontStream->MakeSeekableReadStream()); 213 m_pFileRead = pFontStream->MakeSeekableReadStream();
214 m_pFont = new CFX_Font; 214 m_pFont = new CFX_Font;
215 if (m_pFont->LoadFile(m_pFileRead.get())) 215 if (!m_pFont->LoadFile(m_pFileRead)) {
216 return InitFont(); 216 m_pFileRead.Reset();
217 m_pFileRead.reset(); 217 return false;
218 return false; 218 }
219 return InitFont();
219 } 220 }
220 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 221 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
221 222
222 bool CFGAS_GEFont::LoadFontInternal(CFX_Font* pExternalFont) { 223 bool CFGAS_GEFont::LoadFontInternal(CFX_Font* pExternalFont) {
223 if (m_pFont || !pExternalFont) 224 if (m_pFont || !pExternalFont)
224 return false; 225 return false;
225 226
226 m_pFont = pExternalFont; 227 m_pFont = pExternalFont;
227 m_bExternalFont = true; 228 m_bExternalFont = true;
228 return InitFont(); 229 return InitFont();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 454
454 int32_t CFGAS_GEFont::GetDescent() const { 455 int32_t CFGAS_GEFont::GetDescent() const {
455 return m_pFont->GetDescent(); 456 return m_pFont->GetDescent();
456 } 457 }
457 458
458 CFGAS_GEFont* CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) const { 459 CFGAS_GEFont* CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) const {
459 iGlyphIndex = static_cast<uint32_t>(iGlyphIndex) >> 24; 460 iGlyphIndex = static_cast<uint32_t>(iGlyphIndex) >> 24;
460 return iGlyphIndex == 0 ? const_cast<CFGAS_GEFont*>(this) 461 return iGlyphIndex == 0 ? const_cast<CFGAS_GEFont*>(this)
461 : m_SubstFonts[iGlyphIndex - 1]; 462 : m_SubstFonts[iGlyphIndex - 1];
462 } 463 }
OLDNEW
« no previous file with comments | « xfa/fgas/font/cfgas_gefont.h ('k') | xfa/fxfa/app/xfa_checksum.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698