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

Side by Side Diff: core/src/fxge/dib/fx_dib_composite.cpp

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/src/fxcodec/jbig2/JBig2_Context.cpp ('k') | core/src/fxge/dib/fx_dib_convert.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 #include "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #include "../../../include/fxcodec/fx_codec.h" 8 #include "../../../include/fxcodec/fx_codec.h"
9 #include "dib_int.h" 9 #include "dib_int.h"
10 const uint8_t _color_sqrt[256] = { 10 const uint8_t _color_sqrt[256] = {
(...skipping 4038 matching lines...) Expand 10 before | Expand all | Expand 10 after
4049 } 4049 }
4050 return TRUE; 4050 return TRUE;
4051 } 4051 }
4052 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, 4052 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format,
4053 FXDIB_Format dest_format, 4053 FXDIB_Format dest_format,
4054 FX_DWORD*& pDestPalette, 4054 FX_DWORD*& pDestPalette,
4055 FX_DWORD* pSrcPalette, 4055 FX_DWORD* pSrcPalette,
4056 void* icc_module, 4056 void* icc_module,
4057 void* pIccTransform) { 4057 void* pIccTransform) {
4058 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; 4058 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module;
4059 FX_BOOL isSrcCmyk = src_format & 0x0400 ? TRUE : FALSE; 4059 FX_BOOL isSrcCmyk = !!(src_format & 0x0400);
4060 FX_BOOL isDstCmyk = dest_format & 0x0400 ? TRUE : FALSE; 4060 FX_BOOL isDstCmyk = !!(dest_format & 0x0400);
4061 pDestPalette = NULL; 4061 pDestPalette = NULL;
4062 if (pIccTransform) { 4062 if (pIccTransform) {
4063 if (pSrcPalette) { 4063 if (pSrcPalette) {
4064 if ((dest_format & 0xff) == 8) { 4064 if ((dest_format & 0xff) == 8) {
4065 int pal_count = 1 << (src_format & 0xff); 4065 int pal_count = 1 << (src_format & 0xff);
4066 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); 4066 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count);
4067 pDestPalette = (FX_DWORD*)gray_pal; 4067 pDestPalette = (FX_DWORD*)gray_pal;
4068 for (int i = 0; i < pal_count; i++) { 4068 for (int i = 0; i < pal_count; i++) {
4069 FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) 4069 FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i])
4070 : FXARGB_TODIB(pSrcPalette[i]); 4070 : FXARGB_TODIB(pSrcPalette[i]);
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
4905 color_p[2], color_p[1], color_p[0]); 4905 color_p[2], color_p[1], color_p[0]);
4906 else if (!(alpha_flag >> 8) && IsCmykImage()) { 4906 else if (!(alpha_flag >> 8) && IsCmykImage()) {
4907 return FALSE; 4907 return FALSE;
4908 } 4908 }
4909 } 4909 }
4910 if (!IsCmykImage()) { 4910 if (!IsCmykImage()) {
4911 color_p[3] = (uint8_t)src_alpha; 4911 color_p[3] = (uint8_t)src_alpha;
4912 } 4912 }
4913 int Bpp = m_bpp / 8; 4913 int Bpp = m_bpp / 8;
4914 FX_BOOL bAlpha = HasAlpha(); 4914 FX_BOOL bAlpha = HasAlpha();
4915 FX_BOOL bArgb = GetFormat() == FXDIB_Argb ? TRUE : FALSE; 4915 FX_BOOL bArgb = GetFormat() == FXDIB_Argb;
4916 if (src_alpha == 255) { 4916 if (src_alpha == 255) {
4917 for (int row = rect.top; row < rect.bottom; row++) { 4917 for (int row = rect.top; row < rect.bottom; row++) {
4918 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; 4918 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp;
4919 uint8_t* dest_scan_alpha = 4919 uint8_t* dest_scan_alpha =
4920 m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left 4920 m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left
4921 : NULL; 4921 : NULL;
4922 if (dest_scan_alpha) { 4922 if (dest_scan_alpha) {
4923 FXSYS_memset(dest_scan_alpha, 0xff, width); 4923 FXSYS_memset(dest_scan_alpha, 0xff, width);
4924 } 4924 }
4925 if (Bpp == 4) { 4925 if (Bpp == 4) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
5189 } 5189 }
5190 src_alpha_scan = m_pScanlineAlphaV; 5190 src_alpha_scan = m_pScanlineAlphaV;
5191 dest_alpha_scan = dest_alpha_buf; 5191 dest_alpha_scan = dest_alpha_buf;
5192 if (dest_alpha_scan) { 5192 if (dest_alpha_scan) {
5193 for (i = 0; i < m_DestHeight; i++) { 5193 for (i = 0; i < m_DestHeight; i++) {
5194 *dest_alpha_scan = *src_alpha_scan++; 5194 *dest_alpha_scan = *src_alpha_scan++;
5195 dest_alpha_scan += y_alpha_step; 5195 dest_alpha_scan += y_alpha_step;
5196 } 5196 }
5197 } 5197 }
5198 } 5198 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_Context.cpp ('k') | core/src/fxge/dib/fx_dib_convert.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698