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

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

Issue 2000973002: Make CPDF_Function::Load() return an unique_ptr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix build, nits 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
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_colorspace.cpp ('k') | core/fpdfapi/fpdf_page/cpdf_meshstream.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 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>
11 #include <vector>
12
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
11 #include "core/fxcrt/include/fx_basic.h" 14 #include "core/fxcrt/include/fx_basic.h"
12 #include "core/fxcrt/include/fx_system.h" 15 #include "core/fxcrt/include/fx_system.h"
13 16
14 struct CPDF_MeshVertex { 17 struct CPDF_MeshVertex {
15 FX_FLOAT x; 18 FX_FLOAT x;
16 FX_FLOAT y; 19 FX_FLOAT y;
17 FX_FLOAT r; 20 FX_FLOAT r;
18 FX_FLOAT g; 21 FX_FLOAT g;
19 FX_FLOAT b; 22 FX_FLOAT b;
20 }; 23 };
21 24
22 class CFX_Matrix; 25 class CFX_Matrix;
23 class CPDF_ColorSpace; 26 class CPDF_ColorSpace;
24 class CPDF_Function; 27 class CPDF_Function;
25 class CPDF_Stream; 28 class CPDF_Stream;
26 29
27 class CPDF_MeshStream { 30 class CPDF_MeshStream {
28 public: 31 public:
29 FX_BOOL Load(CPDF_Stream* pShadingStream, 32 CPDF_MeshStream(const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
30 CPDF_Function** pFuncs, 33 CPDF_ColorSpace* pCS);
31 int nFuncs,
32 CPDF_ColorSpace* pCS);
33 34
35 bool Load(CPDF_Stream* pShadingStream);
34 uint32_t GetFlag(); 36 uint32_t GetFlag();
35 37
36 void GetCoords(FX_FLOAT& x, FX_FLOAT& y); 38 void GetCoords(FX_FLOAT& x, FX_FLOAT& y);
37 void GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b); 39 void GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b);
38 40
39 uint32_t GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap); 41 uint32_t GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap);
40 FX_BOOL GetVertexRow(CPDF_MeshVertex* vertex, 42 FX_BOOL GetVertexRow(CPDF_MeshVertex* vertex,
41 int count, 43 int count,
42 CFX_Matrix* pObject2Bitmap); 44 CFX_Matrix* pObject2Bitmap);
43 45
44 CPDF_Function** m_pFuncs; 46 CFX_BitStream* BitStream() { return &m_BitStream; }
45 CPDF_ColorSpace* m_pCS; 47 uint32_t CoordBits() const { return m_nCoordBits; }
46 uint32_t m_nFuncs; 48 uint32_t CompBits() const { return m_nCompBits; }
49 uint32_t FlagBits() const { return m_nFlagBits; }
50 uint32_t comps() const { return m_nComps; }
51
52 private:
53 const std::vector<std::unique_ptr<CPDF_Function>>& m_funcs;
54 CPDF_ColorSpace* const m_pCS;
47 uint32_t m_nCoordBits; 55 uint32_t m_nCoordBits;
48 uint32_t m_nCompBits; 56 uint32_t m_nCompBits;
49 uint32_t m_nFlagBits; 57 uint32_t m_nFlagBits;
50 uint32_t m_nComps; 58 uint32_t m_nComps;
51 uint32_t m_CoordMax; 59 uint32_t m_CoordMax;
52 uint32_t m_CompMax; 60 uint32_t m_CompMax;
53 FX_FLOAT m_xmin; 61 FX_FLOAT m_xmin;
54 FX_FLOAT m_xmax; 62 FX_FLOAT m_xmax;
55 FX_FLOAT m_ymin; 63 FX_FLOAT m_ymin;
56 FX_FLOAT m_ymax; 64 FX_FLOAT m_ymax;
57 FX_FLOAT m_ColorMin[8]; 65 FX_FLOAT m_ColorMin[8];
58 FX_FLOAT m_ColorMax[8]; 66 FX_FLOAT m_ColorMax[8];
59 CPDF_StreamAcc m_Stream; 67 CPDF_StreamAcc m_Stream;
60 CFX_BitStream m_BitStream; 68 CFX_BitStream m_BitStream;
61 }; 69 };
62 70
63 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_MESHSTREAM_H_ 71 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_MESHSTREAM_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_colorspace.cpp ('k') | core/fpdfapi/fpdf_page/cpdf_meshstream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698