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

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

Issue 2060973002: Make code compile with clang_use_chrome_plugin (part I) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 6 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 "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" 7 #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h"
8 8
9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
10 #include "core/fpdfapi/fpdf_page/pageint.h" 10 #include "core/fpdfapi/fpdf_page/pageint.h"
11 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
12 #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" 12 #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
13 #include "core/fpdfapi/fpdf_render/render_int.h" 13 #include "core/fpdfapi/fpdf_render/render_int.h"
14 #include "core/fxge/include/fx_ge.h" 14 #include "core/fxge/include/fx_ge.h"
15 15
16 struct CACHEINFO { 16 struct CACHEINFO {
17 uint32_t time; 17 uint32_t time;
18 CPDF_Stream* pStream; 18 CPDF_Stream* pStream;
19 }; 19 };
20 20
21 extern "C" { 21 extern "C" {
22 static int compare(const void* data1, const void* data2) { 22 static int compare(const void* data1, const void* data2) {
23 return ((CACHEINFO*)data1)->time - ((CACHEINFO*)data2)->time; 23 return ((CACHEINFO*)data1)->time - ((CACHEINFO*)data2)->time;
24 } 24 }
25 } // extern "C" 25 } // extern "C"
26 26
27 CPDF_PageRenderCache::CPDF_PageRenderCache(CPDF_Page* pPage)
28 : m_pPage(pPage),
29 m_pCurImageCacheEntry(nullptr),
30 m_nTimeCount(0),
31 m_nCacheSize(0),
32 m_bCurFindCache(FALSE) {}
33
27 CPDF_PageRenderCache::~CPDF_PageRenderCache() { 34 CPDF_PageRenderCache::~CPDF_PageRenderCache() {
28 for (const auto& it : m_ImageCache) 35 for (const auto& it : m_ImageCache)
29 delete it.second; 36 delete it.second;
30 } 37 }
31 void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) { 38 void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) {
32 if (m_nCacheSize <= (uint32_t)dwLimitCacheSize) 39 if (m_nCacheSize <= (uint32_t)dwLimitCacheSize)
33 return; 40 return;
34 41
35 size_t nCount = m_ImageCache.size(); 42 size_t nCount = m_ImageCache.size();
36 CACHEINFO* pCACHEINFO = FX_Alloc(CACHEINFO, nCount); 43 CACHEINFO* pCACHEINFO = FX_Alloc(CACHEINFO, nCount);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 m_pCurBitmap = nullptr; 325 m_pCurBitmap = nullptr;
319 return 0; 326 return 0;
320 } 327 }
321 ContinueGetCachedBitmap(); 328 ContinueGetCachedBitmap();
322 return 0; 329 return 0;
323 } 330 }
324 void CPDF_ImageCacheEntry::CalcSize() { 331 void CPDF_ImageCacheEntry::CalcSize() {
325 m_dwCacheSize = FPDF_ImageCache_EstimateImageSize(m_pCachedBitmap) + 332 m_dwCacheSize = FPDF_ImageCache_EstimateImageSize(m_pCachedBitmap) +
326 FPDF_ImageCache_EstimateImageSize(m_pCachedMask); 333 FPDF_ImageCache_EstimateImageSize(m_pCachedMask);
327 } 334 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_render/cpdf_pagerendercache.h ('k') | core/fpdfapi/fpdf_render/fpdf_render_image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698