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

Side by Side Diff: core/fpdfapi/fpdf_page/pageint.h

Issue 1990843004: Fix Undefined-shift in CPDF_SampledFunc::v_Init(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix bug 596530 as well Created 4 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 #ifndef CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_
8 #define CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ 8 #define CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_
9 9
10 #include <map> 10 #include <map>
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 CPDF_ColorSpaceMap m_ColorSpaceMap; 359 CPDF_ColorSpaceMap m_ColorSpaceMap;
360 CPDF_FontFileMap m_FontFileMap; 360 CPDF_FontFileMap m_FontFileMap;
361 CPDF_FontMap m_FontMap; 361 CPDF_FontMap m_FontMap;
362 CPDF_IccProfileMap m_IccProfileMap; 362 CPDF_IccProfileMap m_IccProfileMap;
363 CPDF_ImageMap m_ImageMap; 363 CPDF_ImageMap m_ImageMap;
364 CPDF_PatternMap m_PatternMap; 364 CPDF_PatternMap m_PatternMap;
365 }; 365 };
366 366
367 class CPDF_Function { 367 class CPDF_Function {
368 public: 368 public:
369 enum class Type { 369 static CPDF_Function* Load(CPDF_Object* pFuncObj);
370 kType0Sampled,
371 kType2ExpotentialInterpolation,
372 kType3Stitching,
373 kType4PostScript,
374 };
375 370
376 static CPDF_Function* Load(CPDF_Object* pFuncObj);
377 virtual ~CPDF_Function(); 371 virtual ~CPDF_Function();
378 FX_BOOL Call(FX_FLOAT* inputs, 372 FX_BOOL Call(FX_FLOAT* inputs,
379 uint32_t ninputs, 373 uint32_t ninputs,
380 FX_FLOAT* results, 374 FX_FLOAT* results,
381 int& nresults) const; 375 int& nresults) const;
382 uint32_t CountInputs() const { return m_nInputs; } 376 uint32_t CountInputs() const { return m_nInputs; }
383 uint32_t CountOutputs() const { return m_nOutputs; } 377 uint32_t CountOutputs() const { return m_nOutputs; }
384 FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; }
385 FX_FLOAT GetRange(int i) const { return m_pRanges[i]; }
386 Type GetType() const { return m_Type; }
387 378
388 protected: 379 protected:
389 CPDF_Function(Type type); 380 CPDF_Function();
381
390 FX_BOOL Init(CPDF_Object* pObj); 382 FX_BOOL Init(CPDF_Object* pObj);
391 virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0; 383 virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0;
392 virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; 384 virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0;
393 385
394 uint32_t m_nInputs; 386 uint32_t m_nInputs;
395 uint32_t m_nOutputs; 387 uint32_t m_nOutputs;
396 FX_FLOAT* m_pDomains; 388 FX_FLOAT* m_pDomains;
397 FX_FLOAT* m_pRanges; 389 FX_FLOAT* m_pRanges;
398 Type m_Type;
399 }; 390 };
400 391
401 class CPDF_ExpIntFunc : public CPDF_Function { 392 class CPDF_ExpIntFunc : public CPDF_Function {
402 public: 393 public:
403 CPDF_ExpIntFunc(); 394 CPDF_ExpIntFunc();
404 ~CPDF_ExpIntFunc() override; 395 ~CPDF_ExpIntFunc() override;
405 396
406 // CPDF_Function 397 // CPDF_Function
407 FX_BOOL v_Init(CPDF_Object* pObj) override; 398 FX_BOOL v_Init(CPDF_Object* pObj) override;
408 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; 399 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
(...skipping 17 matching lines...) Expand all
426 FX_FLOAT decode_min; 417 FX_FLOAT decode_min;
427 }; 418 };
428 419
429 CPDF_SampledFunc(); 420 CPDF_SampledFunc();
430 ~CPDF_SampledFunc() override; 421 ~CPDF_SampledFunc() override;
431 422
432 // CPDF_Function 423 // CPDF_Function
433 FX_BOOL v_Init(CPDF_Object* pObj) override; 424 FX_BOOL v_Init(CPDF_Object* pObj) override;
434 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; 425 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
435 426
436 SampleEncodeInfo* m_pEncodeInfo; 427 private:
437 SampleDecodeInfo* m_pDecodeInfo; 428 std::vector<SampleEncodeInfo> m_pEncodeInfo;
429 std::vector<SampleDecodeInfo> m_pDecodeInfo;
438 uint32_t m_nBitsPerSample; 430 uint32_t m_nBitsPerSample;
439 uint32_t m_SampleMax; 431 uint32_t m_SampleMax;
440 CPDF_StreamAcc* m_pSampleStream; 432 std::unique_ptr<CPDF_StreamAcc> m_pSampleStream;
441 }; 433 };
442 434
443 class CPDF_StitchFunc : public CPDF_Function { 435 class CPDF_StitchFunc : public CPDF_Function {
444 public: 436 public:
445 CPDF_StitchFunc(); 437 CPDF_StitchFunc();
446 ~CPDF_StitchFunc() override; 438 ~CPDF_StitchFunc() override;
447 439
448 // CPDF_Function 440 // CPDF_Function
449 FX_BOOL v_Init(CPDF_Object* pObj) override; 441 FX_BOOL v_Init(CPDF_Object* pObj) override;
450 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; 442 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
451 443
452 std::vector<CPDF_Function*> m_pSubFunctions; 444 std::vector<std::unique_ptr<CPDF_Function>> m_pSubFunctions;
453 FX_FLOAT* m_pBounds; 445 FX_FLOAT* m_pBounds;
454 FX_FLOAT* m_pEncode; 446 FX_FLOAT* m_pEncode;
455 447
456 static const uint32_t kRequiredNumInputs = 1; 448 static const uint32_t kRequiredNumInputs = 1;
457 }; 449 };
458 450
459 class CPDF_IccProfile { 451 class CPDF_IccProfile {
460 public: 452 public:
461 CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize); 453 CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize);
462 ~CPDF_IccProfile(); 454 ~CPDF_IccProfile();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 }; 515 };
524 516
525 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); 517 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr);
526 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( 518 CFX_ByteStringC PDF_FindValueAbbreviationForTesting(
527 const CFX_ByteStringC& abbr); 519 const CFX_ByteStringC& abbr);
528 520
529 void PDF_ReplaceAbbr(CPDF_Object* pObj); 521 void PDF_ReplaceAbbr(CPDF_Object* pObj);
530 bool IsPathOperator(const uint8_t* buf, size_t len); 522 bool IsPathOperator(const uint8_t* buf, size_t len);
531 523
532 #endif // CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ 524 #endif // CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_
OLDNEW
« core/fpdfapi/fpdf_page/fpdf_page_func.cpp ('K') | « core/fpdfapi/fpdf_page/fpdf_page_func.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698