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

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

Issue 1769273002: Reland "Fix chromium-style errors." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « core/include/fpdfapi/fpdf_parser.h ('k') | core/include/fxcrt/fx_basic.h » ('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> 10 #include <map>
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 class CPDF_Font { 95 class CPDF_Font {
96 public: 96 public:
97 static CPDF_Font* CreateFontF(CPDF_Document* pDoc, 97 static CPDF_Font* CreateFontF(CPDF_Document* pDoc,
98 CPDF_Dictionary* pFontDict); 98 CPDF_Dictionary* pFontDict);
99 static CPDF_Font* GetStockFont(CPDF_Document* pDoc, 99 static CPDF_Font* GetStockFont(CPDF_Document* pDoc,
100 const CFX_ByteStringC& fontname); 100 const CFX_ByteStringC& fontname);
101 static const FX_DWORD kInvalidCharCode = static_cast<FX_DWORD>(-1); 101 static const FX_DWORD kInvalidCharCode = static_cast<FX_DWORD>(-1);
102 102
103 virtual ~CPDF_Font(); 103 virtual ~CPDF_Font();
104 104
105 virtual bool IsType1Font() const { return false; } 105 virtual bool IsType1Font() const;
106 virtual bool IsTrueTypeFont() const { return false; } 106 virtual bool IsTrueTypeFont() const;
107 virtual bool IsType3Font() const { return false; } 107 virtual bool IsType3Font() const;
108 virtual bool IsCIDFont() const { return false; } 108 virtual bool IsCIDFont() const;
109 virtual const CPDF_Type1Font* AsType1Font() const { return nullptr; } 109 virtual const CPDF_Type1Font* AsType1Font() const;
110 virtual CPDF_Type1Font* AsType1Font() { return nullptr; } 110 virtual CPDF_Type1Font* AsType1Font();
111 virtual const CPDF_TrueTypeFont* AsTrueTypeFont() const { return nullptr; } 111 virtual const CPDF_TrueTypeFont* AsTrueTypeFont() const;
112 virtual CPDF_TrueTypeFont* AsTrueTypeFont() { return nullptr; } 112 virtual CPDF_TrueTypeFont* AsTrueTypeFont();
113 virtual const CPDF_Type3Font* AsType3Font() const { return nullptr; } 113 virtual const CPDF_Type3Font* AsType3Font() const;
114 virtual CPDF_Type3Font* AsType3Font() { return nullptr; } 114 virtual CPDF_Type3Font* AsType3Font();
115 virtual const CPDF_CIDFont* AsCIDFont() const { return nullptr; } 115 virtual const CPDF_CIDFont* AsCIDFont() const;
116 virtual CPDF_CIDFont* AsCIDFont() { return nullptr; } 116 virtual CPDF_CIDFont* AsCIDFont();
117 117
118 virtual FX_BOOL IsVertWriting() const; 118 virtual FX_BOOL IsVertWriting() const;
119 virtual FX_BOOL IsUnicodeCompatible() const { return FALSE; } 119 virtual FX_BOOL IsUnicodeCompatible() const;
120 virtual FX_DWORD GetNextChar(const FX_CHAR* pString, 120 virtual FX_DWORD GetNextChar(const FX_CHAR* pString,
121 int nStrLen, 121 int nStrLen,
122 int& offset) const; 122 int& offset) const;
123 virtual int CountChar(const FX_CHAR* pString, int size) const { return size; } 123 virtual int CountChar(const FX_CHAR* pString, int size) const;
124 virtual int AppendChar(FX_CHAR* buf, FX_DWORD charcode) const; 124 virtual int AppendChar(FX_CHAR* buf, FX_DWORD charcode) const;
125 virtual int GetCharSize(FX_DWORD charcode) const { return 1; } 125 virtual int GetCharSize(FX_DWORD charcode) const;
126 virtual int GlyphFromCharCode(FX_DWORD charcode, 126 virtual int GlyphFromCharCode(FX_DWORD charcode,
127 FX_BOOL* pVertGlyph = NULL) = 0; 127 FX_BOOL* pVertGlyph = nullptr);
128 virtual int GlyphFromCharCodeExt(FX_DWORD charcode) { 128 virtual int GlyphFromCharCodeExt(FX_DWORD charcode);
129 return GlyphFromCharCode(charcode);
130 }
131 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const; 129 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const;
132 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const; 130 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const;
133 131
134 const CFX_ByteString& GetBaseFont() const { return m_BaseFont; } 132 const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
135 const CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); } 133 const CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
136 FX_DWORD GetFlags() const { return m_Flags; } 134 FX_DWORD GetFlags() const { return m_Flags; }
137 FX_BOOL IsEmbedded() const { return IsType3Font() || m_pFontFile != NULL; } 135 FX_BOOL IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; }
138 CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; } 136 CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; }
139 CPDF_Dictionary* GetFontDict() const { return m_pFontDict; } 137 CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
140 FX_BOOL IsStandardFont() const; 138 FX_BOOL IsStandardFont() const;
141 FXFT_Face GetFace() const { return m_Font.GetFace(); } 139 FXFT_Face GetFace() const { return m_Font.GetFace(); }
142 void AppendChar(CFX_ByteString& str, FX_DWORD charcode) const; 140 void AppendChar(CFX_ByteString& str, FX_DWORD charcode) const;
143 141
144 void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; } 142 void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; }
145 int GetTypeAscent() const { return m_Ascent; } 143 int GetTypeAscent() const { return m_Ascent; }
146 int GetTypeDescent() const { return m_Descent; } 144 int GetTypeDescent() const { return m_Descent; }
147 int GetItalicAngle() const { return m_ItalicAngle; } 145 int GetItalicAngle() const { return m_ItalicAngle; }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 FX_WORD m_CharWidth[256]; 248 FX_WORD m_CharWidth[256];
251 FX_SMALL_RECT m_CharBBox[256]; 249 FX_SMALL_RECT m_CharBBox[256];
252 FX_BOOL m_bUseFontWidth; 250 FX_BOOL m_bUseFontWidth;
253 }; 251 };
254 252
255 class CPDF_Type1Font : public CPDF_SimpleFont { 253 class CPDF_Type1Font : public CPDF_SimpleFont {
256 public: 254 public:
257 CPDF_Type1Font(); 255 CPDF_Type1Font();
258 256
259 // CPDF_Font: 257 // CPDF_Font:
260 bool IsType1Font() const override { return true; } 258 bool IsType1Font() const override;
261 const CPDF_Type1Font* AsType1Font() const override { return this; } 259 const CPDF_Type1Font* AsType1Font() const override;
262 CPDF_Type1Font* AsType1Font() override { return this; } 260 CPDF_Type1Font* AsType1Font() override;
263 int GlyphFromCharCodeExt(FX_DWORD charcode) override; 261 int GlyphFromCharCodeExt(FX_DWORD charcode) override;
264 262
265 int GetBase14Font() const { return m_Base14Font; } 263 int GetBase14Font() const { return m_Base14Font; }
266 264
267 protected: 265 protected:
268 // CPDF_Font: 266 // CPDF_Font:
269 FX_BOOL Load() override; 267 FX_BOOL Load() override;
270 268
271 // CPDF_SimpleFont: 269 // CPDF_SimpleFont:
272 void LoadGlyphMap() override; 270 void LoadGlyphMap() override;
273 271
274 int m_Base14Font; 272 int m_Base14Font;
275 }; 273 };
276 274
277 class CPDF_TrueTypeFont : public CPDF_SimpleFont { 275 class CPDF_TrueTypeFont : public CPDF_SimpleFont {
278 public: 276 public:
279 CPDF_TrueTypeFont(); 277 CPDF_TrueTypeFont();
280 278
281 // CPDF_Font: 279 // CPDF_Font:
282 bool IsTrueTypeFont() const override { return true; } 280 bool IsTrueTypeFont() const override;
283 const CPDF_TrueTypeFont* AsTrueTypeFont() const override { return this; } 281 const CPDF_TrueTypeFont* AsTrueTypeFont() const override;
284 CPDF_TrueTypeFont* AsTrueTypeFont() override { return this; } 282 CPDF_TrueTypeFont* AsTrueTypeFont() override;
285 283
286 protected: 284 protected:
287 // CPDF_Font: 285 // CPDF_Font:
288 FX_BOOL Load() override; 286 FX_BOOL Load() override;
289 287
290 // CPDF_SimpleFont: 288 // CPDF_SimpleFont:
291 void LoadGlyphMap() override; 289 void LoadGlyphMap() override;
292 }; 290 };
293 291
294 class CPDF_Type3Char { 292 class CPDF_Type3Char {
(...skipping 11 matching lines...) Expand all
306 CFX_Matrix m_ImageMatrix; 304 CFX_Matrix m_ImageMatrix;
307 FX_RECT m_BBox; 305 FX_RECT m_BBox;
308 }; 306 };
309 307
310 class CPDF_Type3Font : public CPDF_SimpleFont { 308 class CPDF_Type3Font : public CPDF_SimpleFont {
311 public: 309 public:
312 CPDF_Type3Font(); 310 CPDF_Type3Font();
313 ~CPDF_Type3Font() override; 311 ~CPDF_Type3Font() override;
314 312
315 // CPDF_Font: 313 // CPDF_Font:
316 bool IsType3Font() const override { return true; } 314 bool IsType3Font() const override;
317 const CPDF_Type3Font* AsType3Font() const override { return this; } 315 const CPDF_Type3Font* AsType3Font() const override;
318 CPDF_Type3Font* AsType3Font() override { return this; } 316 CPDF_Type3Font* AsType3Font() override;
319 int GetCharWidthF(FX_DWORD charcode, int level = 0) override; 317 int GetCharWidthF(FX_DWORD charcode, int level = 0) override;
320 FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override; 318 FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override;
321 319
322 void SetPageResources(CPDF_Dictionary* pResources) { 320 void SetPageResources(CPDF_Dictionary* pResources) {
323 m_pPageResources = pResources; 321 m_pPageResources = pResources;
324 } 322 }
325 CPDF_Type3Char* LoadChar(FX_DWORD charcode, int level = 0); 323 CPDF_Type3Char* LoadChar(FX_DWORD charcode, int level = 0);
326 void CheckType3FontMetrics(); 324 void CheckType3FontMetrics();
327 325
328 CFX_Matrix& GetFontMatrix() { return m_FontMatrix; } 326 CFX_Matrix& GetFontMatrix() { return m_FontMatrix; }
(...skipping 26 matching lines...) Expand all
355 }; 353 };
356 354
357 class CPDF_CIDFont : public CPDF_Font { 355 class CPDF_CIDFont : public CPDF_Font {
358 public: 356 public:
359 CPDF_CIDFont(); 357 CPDF_CIDFont();
360 ~CPDF_CIDFont() override; 358 ~CPDF_CIDFont() override;
361 359
362 static FX_FLOAT CIDTransformToFloat(uint8_t ch); 360 static FX_FLOAT CIDTransformToFloat(uint8_t ch);
363 361
364 // CPDF_Font: 362 // CPDF_Font:
365 bool IsCIDFont() const override { return true; } 363 bool IsCIDFont() const override;
366 const CPDF_CIDFont* AsCIDFont() const override { return this; } 364 const CPDF_CIDFont* AsCIDFont() const override;
367 CPDF_CIDFont* AsCIDFont() override { return this; } 365 CPDF_CIDFont* AsCIDFont() override;
368 int GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph = NULL) override; 366 int GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph = NULL) override;
369 int GetCharWidthF(FX_DWORD charcode, int level = 0) override; 367 int GetCharWidthF(FX_DWORD charcode, int level = 0) override;
370 FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override; 368 FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override;
371 FX_DWORD GetNextChar(const FX_CHAR* pString, 369 FX_DWORD GetNextChar(const FX_CHAR* pString,
372 int nStrLen, 370 int nStrLen,
373 int& offset) const override; 371 int& offset) const override;
374 int CountChar(const FX_CHAR* pString, int size) const override; 372 int CountChar(const FX_CHAR* pString, int size) const override;
375 int AppendChar(FX_CHAR* str, FX_DWORD charcode) const override; 373 int AppendChar(FX_CHAR* str, FX_DWORD charcode) const override;
376 int GetCharSize(FX_DWORD charcode) const override; 374 int GetCharSize(FX_DWORD charcode) const override;
377 FX_BOOL IsVertWriting() const override; 375 FX_BOOL IsVertWriting() const override;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 425
428 class CPDF_ColorSpace { 426 class CPDF_ColorSpace {
429 public: 427 public:
430 static CPDF_ColorSpace* GetStockCS(int Family); 428 static CPDF_ColorSpace* GetStockCS(int Family);
431 429
432 static CPDF_ColorSpace* Load(CPDF_Document* pDoc, CPDF_Object* pCSObj); 430 static CPDF_ColorSpace* Load(CPDF_Document* pDoc, CPDF_Object* pCSObj);
433 431
434 void ReleaseCS(); 432 void ReleaseCS();
435 433
436 int GetBufSize() const; 434 int GetBufSize() const;
437
438 FX_FLOAT* CreateBuf(); 435 FX_FLOAT* CreateBuf();
439
440 void GetDefaultColor(FX_FLOAT* buf) const; 436 void GetDefaultColor(FX_FLOAT* buf) const;
441
442 int CountComponents() const { return m_nComponents; } 437 int CountComponents() const { return m_nComponents; }
443
444 int GetFamily() const { return m_Family; } 438 int GetFamily() const { return m_Family; }
445
446 virtual void GetDefaultValue(int iComponent, 439 virtual void GetDefaultValue(int iComponent,
447 FX_FLOAT& value, 440 FX_FLOAT& value,
448 FX_FLOAT& min, 441 FX_FLOAT& min,
449 FX_FLOAT& max) const { 442 FX_FLOAT& max) const {
450 value = 0; 443 value = 0;
451 min = 0; 444 min = 0;
452 max = 1.0f; 445 max = 1.0f;
453 } 446 }
454 447
455 FX_BOOL sRGB() const; 448 FX_BOOL sRGB() const;
456
457 virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, 449 virtual FX_BOOL GetRGB(FX_FLOAT* pBuf,
458 FX_FLOAT& R, 450 FX_FLOAT& R,
459 FX_FLOAT& G, 451 FX_FLOAT& G,
460 FX_FLOAT& B) const = 0; 452 FX_FLOAT& B) const = 0;
461
462 virtual FX_BOOL SetRGB(FX_FLOAT* pBuf, 453 virtual FX_BOOL SetRGB(FX_FLOAT* pBuf,
463 FX_FLOAT R, 454 FX_FLOAT R,
464 FX_FLOAT G, 455 FX_FLOAT G,
465 FX_FLOAT B) const { 456 FX_FLOAT B) const {
466 return FALSE; 457 return FALSE;
467 } 458 }
468 459
469 FX_BOOL GetCMYK(FX_FLOAT* pBuf, 460 FX_BOOL GetCMYK(FX_FLOAT* pBuf,
470 FX_FLOAT& c, 461 FX_FLOAT& c,
471 FX_FLOAT& m, 462 FX_FLOAT& m,
472 FX_FLOAT& y, 463 FX_FLOAT& y,
473 FX_FLOAT& k) const; 464 FX_FLOAT& k) const;
474
475 FX_BOOL SetCMYK(FX_FLOAT* pBuf, 465 FX_BOOL SetCMYK(FX_FLOAT* pBuf,
476 FX_FLOAT c, 466 FX_FLOAT c,
477 FX_FLOAT m, 467 FX_FLOAT m,
478 FX_FLOAT y, 468 FX_FLOAT y,
479 FX_FLOAT k) const; 469 FX_FLOAT k) const;
480 470
481 virtual void TranslateImageLine(uint8_t* dest_buf, 471 virtual void TranslateImageLine(uint8_t* dest_buf,
482 const uint8_t* src_buf, 472 const uint8_t* src_buf,
483 int pixels, 473 int pixels,
484 int image_width, 474 int image_width,
485 int image_height, 475 int image_height,
486 FX_BOOL bTransMask = FALSE) const; 476 FX_BOOL bTransMask = FALSE) const;
487 477
488 CPDF_Array*& GetArray() { return m_pArray; } 478 CPDF_Array*& GetArray() { return m_pArray; }
489
490 int GetMaxIndex() const; 479 int GetMaxIndex() const;
491
492 virtual CPDF_ColorSpace* GetBaseCS() const { return NULL; } 480 virtual CPDF_ColorSpace* GetBaseCS() const { return NULL; }
493 481
494 virtual void EnableStdConversion(FX_BOOL bEnabled); 482 virtual void EnableStdConversion(FX_BOOL bEnabled);
495 483
496 CPDF_Document* const m_pDocument; 484 CPDF_Document* const m_pDocument;
497 485
498 protected: 486 protected:
499 CPDF_ColorSpace(CPDF_Document* pDoc, int family, int nComponents) 487 CPDF_ColorSpace(CPDF_Document* pDoc, int family, int nComponents)
500 : m_pDocument(pDoc), 488 : m_pDocument(pDoc),
501 m_Family(family), 489 m_Family(family),
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 766
779 FX_BOOL m_bInterpolate; 767 FX_BOOL m_bInterpolate;
780 768
781 CPDF_Document* m_pDocument; 769 CPDF_Document* m_pDocument;
782 770
783 CPDF_Dictionary* m_pOC; 771 CPDF_Dictionary* m_pOC;
784 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); 772 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size);
785 }; 773 };
786 774
787 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ 775 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_
OLDNEW
« no previous file with comments | « core/include/fpdfapi/fpdf_parser.h ('k') | core/include/fxcrt/fx_basic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698