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

Side by Side Diff: core/include/fxge/fx_dib.h

Issue 1405723003: Sanity check the values of TRUE and FALSE. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 5 years, 2 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/fxcrt/fx_system.h ('k') | core/src/fpdfapi/fpdf_render/fpdf_render.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_INCLUDE_FXGE_FX_DIB_H_ 7 #ifndef CORE_INCLUDE_FXGE_FX_DIB_H_
8 #define CORE_INCLUDE_FXGE_FX_DIB_H_ 8 #define CORE_INCLUDE_FXGE_FX_DIB_H_
9 9
10 #include "../fxcrt/fx_basic.h" 10 #include "../fxcrt/fx_basic.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 int dest_bpp, 189 int dest_bpp,
190 int dest_width, 190 int dest_width,
191 FX_BOOL bFlipX, 191 FX_BOOL bFlipX,
192 int clip_left, 192 int clip_left,
193 int clip_width) const = 0; 193 int clip_width) const = 0;
194 194
195 virtual void SetDownSampleSize(int width, int height) const {} 195 virtual void SetDownSampleSize(int width, int height) const {}
196 196
197 int GetBPP() const { return m_bpp; } 197 int GetBPP() const { return m_bpp; }
198 198
199 // TODO(thestig): Investigate this. Given the possible values of FXDIB_Format,
200 // it feels as though this should be implemented as !!(m_AlphaFlag & 1) and
201 // IsOpaqueImage() below should never be able to return TRUE.
199 FX_BOOL IsAlphaMask() const { return m_AlphaFlag == 1; } 202 FX_BOOL IsAlphaMask() const { return m_AlphaFlag == 1; }
200 203
201 FX_BOOL HasAlpha() const { return m_AlphaFlag & 2 ? TRUE : FALSE; } 204 FX_BOOL HasAlpha() const { return !!(m_AlphaFlag & 2); }
202 205
203 FX_BOOL IsOpaqueImage() const { return !(m_AlphaFlag & 3); } 206 FX_BOOL IsOpaqueImage() const { return !(m_AlphaFlag & 3); }
204 207
205 FX_BOOL IsCmykImage() const { return m_AlphaFlag & 4 ? TRUE : FALSE; } 208 FX_BOOL IsCmykImage() const { return !!(m_AlphaFlag & 4); }
206 209
207 int GetPaletteSize() const { 210 int GetPaletteSize() const {
208 return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); 211 return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0));
209 } 212 }
210 213
211 FX_DWORD GetPaletteEntry(int index) const; 214 FX_DWORD GetPaletteEntry(int index) const;
212 215
213 void SetPaletteEntry(int index, FX_DWORD color); 216 void SetPaletteEntry(int index, FX_DWORD color);
214 FX_DWORD GetPaletteArgb(int index) const { return GetPaletteEntry(index); } 217 FX_DWORD GetPaletteArgb(int index) const { return GetPaletteEntry(index); }
215 void SetPaletteArgb(int index, FX_DWORD color) { 218 void SetPaletteArgb(int index, FX_DWORD color) {
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 int m_Status; 688 int m_Status;
686 FX_RECT m_ClipBox; 689 FX_RECT m_ClipBox;
687 FX_DWORD m_Flags; 690 FX_DWORD m_Flags;
688 int m_AlphaFlag; 691 int m_AlphaFlag;
689 void* m_pIccTransform; 692 void* m_pIccTransform;
690 FX_BOOL m_bRgbByteOrder; 693 FX_BOOL m_bRgbByteOrder;
691 int m_BlendType; 694 int m_BlendType;
692 }; 695 };
693 696
694 #endif // CORE_INCLUDE_FXGE_FX_DIB_H_ 697 #endif // CORE_INCLUDE_FXGE_FX_DIB_H_
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_system.h ('k') | core/src/fpdfapi/fpdf_render/fpdf_render.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698