| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_CPDF_MESHSTREAM_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_CPDF_MESHSTREAM_H_ |
| 8 #define CORE_FPDFAPI_FPDF_PAGE_CPDF_MESHSTREAM_H_ | 8 #define CORE_FPDFAPI_FPDF_PAGE_CPDF_MESHSTREAM_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" |
| 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" | 14 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" |
| 14 #include "core/fxcrt/include/fx_basic.h" | 15 #include "core/fxcrt/include/fx_basic.h" |
| 15 #include "core/fxcrt/include/fx_system.h" | 16 #include "core/fxcrt/include/fx_system.h" |
| 16 | 17 |
| 17 struct CPDF_MeshVertex { | 18 struct CPDF_MeshVertex { |
| 18 FX_FLOAT x; | 19 FX_FLOAT x; |
| 19 FX_FLOAT y; | 20 FX_FLOAT y; |
| 20 FX_FLOAT r; | 21 FX_FLOAT r; |
| 21 FX_FLOAT g; | 22 FX_FLOAT g; |
| 22 FX_FLOAT b; | 23 FX_FLOAT b; |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 class CFX_Matrix; | 26 class CFX_Matrix; |
| 26 class CPDF_ColorSpace; | 27 class CPDF_ColorSpace; |
| 27 class CPDF_Function; | 28 class CPDF_Function; |
| 28 class CPDF_Stream; | 29 class CPDF_Stream; |
| 29 | 30 |
| 30 class CPDF_MeshStream { | 31 class CPDF_MeshStream { |
| 31 public: | 32 public: |
| 32 CPDF_MeshStream(const std::vector<std::unique_ptr<CPDF_Function>>& funcs, | 33 CPDF_MeshStream(ShadingType type, |
| 34 const std::vector<std::unique_ptr<CPDF_Function>>& funcs, |
| 35 CPDF_Stream* pShadingStream, |
| 33 CPDF_ColorSpace* pCS); | 36 CPDF_ColorSpace* pCS); |
| 34 | 37 |
| 35 bool Load(CPDF_Stream* pShadingStream); | 38 bool Load(); |
| 39 |
| 36 uint32_t GetFlag(); | 40 uint32_t GetFlag(); |
| 37 | |
| 38 void GetCoords(FX_FLOAT& x, FX_FLOAT& y); | 41 void GetCoords(FX_FLOAT& x, FX_FLOAT& y); |
| 39 void GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b); | 42 void GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b); |
| 40 | 43 |
| 41 uint32_t GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap); | 44 uint32_t GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap); |
| 42 FX_BOOL GetVertexRow(CPDF_MeshVertex* vertex, | 45 FX_BOOL GetVertexRow(CPDF_MeshVertex* vertex, |
| 43 int count, | 46 int count, |
| 44 CFX_Matrix* pObject2Bitmap); | 47 CFX_Matrix* pObject2Bitmap); |
| 45 | 48 |
| 46 CFX_BitStream* BitStream() { return &m_BitStream; } | 49 CFX_BitStream* BitStream() { return &m_BitStream; } |
| 47 uint32_t CoordBits() const { return m_nCoordBits; } | |
| 48 uint32_t CompBits() const { return m_nCompBits; } | 50 uint32_t CompBits() const { return m_nCompBits; } |
| 49 uint32_t FlagBits() const { return m_nFlagBits; } | |
| 50 uint32_t comps() const { return m_nComps; } | 51 uint32_t comps() const { return m_nComps; } |
| 51 | 52 |
| 52 private: | 53 private: |
| 54 static const uint32_t kMaxResults = 8; |
| 55 |
| 56 const ShadingType m_type; |
| 53 const std::vector<std::unique_ptr<CPDF_Function>>& m_funcs; | 57 const std::vector<std::unique_ptr<CPDF_Function>>& m_funcs; |
| 58 CPDF_Stream* const m_pShadingStream; |
| 54 CPDF_ColorSpace* const m_pCS; | 59 CPDF_ColorSpace* const m_pCS; |
| 55 uint32_t m_nCoordBits; | 60 uint32_t m_nCoordBits; |
| 56 uint32_t m_nCompBits; | 61 uint32_t m_nCompBits; |
| 57 uint32_t m_nFlagBits; | 62 uint32_t m_nFlagBits; |
| 58 uint32_t m_nComps; | 63 uint32_t m_nComps; |
| 59 uint32_t m_CoordMax; | 64 uint32_t m_CoordMax; |
| 60 uint32_t m_CompMax; | 65 uint32_t m_CompMax; |
| 61 FX_FLOAT m_xmin; | 66 FX_FLOAT m_xmin; |
| 62 FX_FLOAT m_xmax; | 67 FX_FLOAT m_xmax; |
| 63 FX_FLOAT m_ymin; | 68 FX_FLOAT m_ymin; |
| 64 FX_FLOAT m_ymax; | 69 FX_FLOAT m_ymax; |
| 65 FX_FLOAT m_ColorMin[8]; | 70 FX_FLOAT m_ColorMin[kMaxResults]; |
| 66 FX_FLOAT m_ColorMax[8]; | 71 FX_FLOAT m_ColorMax[kMaxResults]; |
| 67 CPDF_StreamAcc m_Stream; | 72 CPDF_StreamAcc m_Stream; |
| 68 CFX_BitStream m_BitStream; | 73 CFX_BitStream m_BitStream; |
| 69 }; | 74 }; |
| 70 | 75 |
| 71 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_MESHSTREAM_H_ | 76 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_MESHSTREAM_H_ |
| OLD | NEW |