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

Side by Side Diff: core/src/fxcodec/codec/fx_codec_progress.h

Issue 1720043003: Remove foo != NULL outside of xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 10 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/src/fxcodec/codec/fx_codec_png.cpp ('k') | core/src/fxcodec/codec/fx_codec_progress.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_SRC_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_ 7 #ifndef CORE_SRC_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_
8 #define CORE_SRC_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_ 8 #define CORE_SRC_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_
9 9
10 #define FXCODEC_BLOCK_SIZE 4096 10 #define FXCODEC_BLOCK_SIZE 4096
11 #define FXCODEC_PNG_GAMMA 2.2 11 #define FXCODEC_PNG_GAMMA 2.2
12 #if _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_ 12 #if _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_
13 #undef FXCODEC_PNG_GAMMA 13 #undef FXCODEC_PNG_GAMMA
14 #define FXCODEC_PNG_GAMMA 1.7 14 #define FXCODEC_PNG_GAMMA 1.7
15 #endif 15 #endif
16 struct PixelWeight { 16 struct PixelWeight {
17 int m_SrcStart; 17 int m_SrcStart;
18 int m_SrcEnd; 18 int m_SrcEnd;
19 int m_Weights[1]; 19 int m_Weights[1];
20 }; 20 };
21 class CFXCODEC_WeightTable { 21 class CFXCODEC_WeightTable {
22 public: 22 public:
23 CFXCODEC_WeightTable() { m_pWeightTables = NULL; } 23 CFXCODEC_WeightTable() { m_pWeightTables = NULL; }
24 ~CFXCODEC_WeightTable() { 24 ~CFXCODEC_WeightTable() { FX_Free(m_pWeightTables); }
25 if (m_pWeightTables != NULL) {
26 FX_Free(m_pWeightTables);
27 }
28 }
29 25
30 void Calc(int dest_len, 26 void Calc(int dest_len,
31 int dest_min, 27 int dest_min,
32 int dest_max, 28 int dest_max,
33 int src_len, 29 int src_len,
34 int src_min, 30 int src_min,
35 int src_max, 31 int src_max,
36 FX_BOOL bInterpol); 32 FX_BOOL bInterpol);
37 PixelWeight* GetPixelWeight(int pixel) { 33 PixelWeight* GetPixelWeight(int pixel) {
38 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize); 34 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize);
39 } 35 }
40 36
41 int m_DestMin, m_ItemSize; 37 int m_DestMin, m_ItemSize;
42 uint8_t* m_pWeightTables; 38 uint8_t* m_pWeightTables;
43 }; 39 };
44 class CFXCODEC_HorzTable { 40 class CFXCODEC_HorzTable {
45 public: 41 public:
46 CFXCODEC_HorzTable() { m_pWeightTables = NULL; } 42 CFXCODEC_HorzTable() { m_pWeightTables = NULL; }
47 ~CFXCODEC_HorzTable() { 43 ~CFXCODEC_HorzTable() { FX_Free(m_pWeightTables); }
48 if (m_pWeightTables != NULL) {
49 FX_Free(m_pWeightTables);
50 }
51 }
52 44
53 void Calc(int dest_len, int src_len, FX_BOOL bInterpol); 45 void Calc(int dest_len, int src_len, FX_BOOL bInterpol);
54 PixelWeight* GetPixelWeight(int pixel) { 46 PixelWeight* GetPixelWeight(int pixel) {
55 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize); 47 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
56 } 48 }
57 49
58 int m_ItemSize; 50 int m_ItemSize;
59 uint8_t* m_pWeightTables; 51 uint8_t* m_pWeightTables;
60 }; 52 };
61 class CFXCODEC_VertTable { 53 class CFXCODEC_VertTable {
62 public: 54 public:
63 CFXCODEC_VertTable() { m_pWeightTables = NULL; } 55 CFXCODEC_VertTable() { m_pWeightTables = NULL; }
64 ~CFXCODEC_VertTable() { 56 ~CFXCODEC_VertTable() { FX_Free(m_pWeightTables); }
65 if (m_pWeightTables != NULL) {
66 FX_Free(m_pWeightTables);
67 }
68 }
69 void Calc(int dest_len, int src_len); 57 void Calc(int dest_len, int src_len);
70 PixelWeight* GetPixelWeight(int pixel) { 58 PixelWeight* GetPixelWeight(int pixel) {
71 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize); 59 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
72 } 60 }
73 int m_ItemSize; 61 int m_ItemSize;
74 uint8_t* m_pWeightTables; 62 uint8_t* m_pWeightTables;
75 }; 63 };
76 enum FXCodec_Format { 64 enum FXCodec_Format {
77 FXCodec_Invalid = 0, 65 FXCodec_Invalid = 0,
78 FXCodec_1bppGray = 0x101, 66 FXCodec_1bppGray = 0x101,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 int m_GifBgIndex; 204 int m_GifBgIndex;
217 uint8_t* m_pGifPalette; 205 uint8_t* m_pGifPalette;
218 int32_t m_GifPltNumber; 206 int32_t m_GifPltNumber;
219 int m_GifTransIndex; 207 int m_GifTransIndex;
220 FX_RECT m_GifFrameRect; 208 FX_RECT m_GifFrameRect;
221 FX_BOOL m_BmpIsTopBottom; 209 FX_BOOL m_BmpIsTopBottom;
222 FXCODEC_STATUS m_status; 210 FXCODEC_STATUS m_status;
223 }; 211 };
224 212
225 #endif // CORE_SRC_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_ 213 #endif // CORE_SRC_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_png.cpp ('k') | core/src/fxcodec/codec/fx_codec_progress.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698