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

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp

Issue 1136673005: Merge to XFA: Add safe FX_Alloc2D() macro (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 7 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 "../../../include/fpdfapi/fpdf_render.h" 7 #include "../../../include/fpdfapi/fpdf_render.h"
8 #include "../../../include/fpdfapi/fpdf_pageobj.h" 8 #include "../../../include/fpdfapi/fpdf_pageobj.h"
9 #include "../../../include/fxge/fx_ge.h" 9 #include "../../../include/fxge/fx_ge.h"
10 #include "../fpdf_page/pageint.h" 10 #include "../fpdf_page/pageint.h"
(...skipping 25 matching lines...) Expand all
36 m_ImageCaches.RemoveAll(); 36 m_ImageCaches.RemoveAll();
37 m_nCacheSize = 0; 37 m_nCacheSize = 0;
38 m_nTimeCount = 0; 38 m_nTimeCount = 0;
39 } 39 }
40 void CPDF_PageRenderCache::CacheOptimization(FX_INT32 dwLimitCacheSize) 40 void CPDF_PageRenderCache::CacheOptimization(FX_INT32 dwLimitCacheSize)
41 { 41 {
42 if (m_nCacheSize <= (FX_DWORD)dwLimitCacheSize) { 42 if (m_nCacheSize <= (FX_DWORD)dwLimitCacheSize) {
43 return; 43 return;
44 } 44 }
45 int nCount = m_ImageCaches.GetCount(); 45 int nCount = m_ImageCaches.GetCount();
46 CACHEINFO* pCACHEINFO = (CACHEINFO*)FX_Alloc(FX_BYTE, (sizeof (CACHEINFO)) * nCount); 46 CACHEINFO* pCACHEINFO = (CACHEINFO*)FX_Alloc2D(FX_BYTE, sizeof(CACHEINFO), n Count);
47 FX_POSITION pos = m_ImageCaches.GetStartPosition(); 47 FX_POSITION pos = m_ImageCaches.GetStartPosition();
48 int i = 0; 48 int i = 0;
49 while (pos) { 49 while (pos) {
50 FX_LPVOID key, value; 50 FX_LPVOID key, value;
51 m_ImageCaches.GetNextAssoc(pos, key, value); 51 m_ImageCaches.GetNextAssoc(pos, key, value);
52 pCACHEINFO[i].time = ((CPDF_ImageCache*)value)->GetTimeCount(); 52 pCACHEINFO[i].time = ((CPDF_ImageCache*)value)->GetTimeCount();
53 pCACHEINFO[i++].pStream = ((CPDF_ImageCache*)value)->GetStream(); 53 pCACHEINFO[i++].pStream = ((CPDF_ImageCache*)value)->GetStream();
54 } 54 }
55 FXSYS_qsort(pCACHEINFO, nCount, sizeof (CACHEINFO), compare); 55 FXSYS_qsort(pCACHEINFO, nCount, sizeof (CACHEINFO), compare);
56 FX_DWORD nTimeCount = m_nTimeCount; 56 FX_DWORD nTimeCount = m_nTimeCount;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 346 }
347 void CPDF_Document::ClearRenderFont() 347 void CPDF_Document::ClearRenderFont()
348 { 348 {
349 if (m_pDocRender) { 349 if (m_pDocRender) {
350 CFX_FontCache* pCache = m_pDocRender->GetFontCache(); 350 CFX_FontCache* pCache = m_pDocRender->GetFontCache();
351 if (pCache) { 351 if (pCache) {
352 pCache->FreeCache(FALSE); 352 pCache->FreeCache(FALSE);
353 } 353 }
354 } 354 }
355 } 355 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698