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

Side by Side Diff: core/include/fpdfapi/fpdf_resource.h

Issue 1408063016: Fix a leak in CPDF_Type3Font::LoadChar(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@parser_b268
Patch Set: remove dead code, m_bPageRequired is always false Created 5 years, 1 month 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 | « no previous file | core/src/fpdfapi/fpdf_font/fpdf_font.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 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_
8 #define CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ 8 #define CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_
9 9
10 #include <map>
11
10 #include "../fxcrt/fx_system.h" 12 #include "../fxcrt/fx_system.h"
11 #include "../fxge/fx_font.h" 13 #include "../fxge/fx_font.h"
12 #include "fpdf_parser.h" 14 #include "fpdf_parser.h"
13 15
14 class CFX_CTTGSUBTable; 16 class CFX_CTTGSUBTable;
15 class CFX_DIBitmap; 17 class CFX_DIBitmap;
16 class CFX_Font; 18 class CFX_Font;
17 class CFX_SubstFont; 19 class CFX_SubstFont;
18 class CPDF_CID2UnicodeMap; 20 class CPDF_CID2UnicodeMap;
19 class CPDF_CIDFont; 21 class CPDF_CIDFont;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 virtual void LoadGlyphMap(); 355 virtual void LoadGlyphMap();
354 }; 356 };
355 class CPDF_TrueTypeFont : public CPDF_SimpleFont { 357 class CPDF_TrueTypeFont : public CPDF_SimpleFont {
356 public: 358 public:
357 CPDF_TrueTypeFont(); 359 CPDF_TrueTypeFont();
358 360
359 protected: 361 protected:
360 virtual FX_BOOL _Load(); 362 virtual FX_BOOL _Load();
361 virtual void LoadGlyphMap(); 363 virtual void LoadGlyphMap();
362 }; 364 };
365
363 class CPDF_Type3Char { 366 class CPDF_Type3Char {
364 public: 367 public:
365 CPDF_Type3Char(); 368 // Takes ownership of |pForm|.
366 369 explicit CPDF_Type3Char(CPDF_Form* pForm);
367 ~CPDF_Type3Char(); 370 ~CPDF_Type3Char();
368 371
369 FX_BOOL LoadBitmap(CPDF_RenderContext* pContext); 372 FX_BOOL LoadBitmap(CPDF_RenderContext* pContext);
370 373
374 CPDF_Form* m_pForm;
375 CFX_DIBitmap* m_pBitmap;
371 FX_BOOL m_bColored; 376 FX_BOOL m_bColored;
372 377 int m_Width;
373 FX_BOOL m_bPageRequired;
374
375 CPDF_Form* m_pForm;
376
377 CFX_AffineMatrix m_ImageMatrix; 378 CFX_AffineMatrix m_ImageMatrix;
378
379 CFX_DIBitmap* m_pBitmap;
380
381 int m_Width;
382
383 FX_RECT m_BBox; 379 FX_RECT m_BBox;
384 }; 380 };
381
385 class CPDF_Type3Font : public CPDF_SimpleFont { 382 class CPDF_Type3Font : public CPDF_SimpleFont {
386 public: 383 public:
387 CPDF_Type3Font(); 384 CPDF_Type3Font();
388 ~CPDF_Type3Font() override; 385 ~CPDF_Type3Font() override;
389 386
390 void SetPageResources(CPDF_Dictionary* pResources) { 387 void SetPageResources(CPDF_Dictionary* pResources) {
391 m_pPageResources = pResources; 388 m_pPageResources = pResources;
392 } 389 }
393 CPDF_Type3Char* LoadChar(FX_DWORD charcode, int level = 0); 390 CPDF_Type3Char* LoadChar(FX_DWORD charcode, int level = 0);
394 int GetCharWidthF(FX_DWORD charcode, int level = 0) override; 391 int GetCharWidthF(FX_DWORD charcode, int level = 0) override;
395 int GetCharTypeWidth(FX_DWORD charcode) override { 392 int GetCharTypeWidth(FX_DWORD charcode) override {
396 return GetCharWidthF(charcode); 393 return GetCharWidthF(charcode);
397 } 394 }
398 void GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level = 0) override; 395 void GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level = 0) override;
399 CFX_AffineMatrix& GetFontMatrix() { return m_FontMatrix; } 396 CFX_AffineMatrix& GetFontMatrix() { return m_FontMatrix; }
400 void CheckType3FontMetrics(); 397 void CheckType3FontMetrics();
401 398
402 protected: 399 protected:
403 CFX_AffineMatrix m_FontMatrix; 400 CFX_AffineMatrix m_FontMatrix;
404 401
405 private: 402 private:
406 FX_BOOL _Load() override; 403 FX_BOOL _Load() override;
407 void LoadGlyphMap() override {} 404 void LoadGlyphMap() override {}
408 405
409 int m_CharWidthL[256]; 406 int m_CharWidthL[256];
410 CPDF_Dictionary* m_pCharProcs; 407 CPDF_Dictionary* m_pCharProcs;
411 CPDF_Dictionary* m_pPageResources; 408 CPDF_Dictionary* m_pPageResources;
412 CPDF_Dictionary* m_pFontResources; 409 CPDF_Dictionary* m_pFontResources;
413 CFX_MapPtrToPtr m_CacheMap; 410 std::map<FX_DWORD, CPDF_Type3Char*> m_CacheMap;
414 CFX_MapPtrToPtr m_DeletedMap;
415 }; 411 };
416 412
417 enum CIDSet { 413 enum CIDSet {
418 CIDSET_UNKNOWN, 414 CIDSET_UNKNOWN,
419 CIDSET_GB1, 415 CIDSET_GB1,
420 CIDSET_CNS1, 416 CIDSET_CNS1,
421 CIDSET_JAPAN1, 417 CIDSET_JAPAN1,
422 CIDSET_KOREA1, 418 CIDSET_KOREA1,
423 CIDSET_UNICODE, 419 CIDSET_UNICODE,
424 CIDSET_NUM_SETS 420 CIDSET_NUM_SETS
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 850
855 FX_BOOL m_bInterpolate; 851 FX_BOOL m_bInterpolate;
856 852
857 CPDF_Document* m_pDocument; 853 CPDF_Document* m_pDocument;
858 854
859 CPDF_Dictionary* m_pOC; 855 CPDF_Dictionary* m_pOC;
860 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); 856 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size);
861 }; 857 };
862 858
863 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ 859 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698