Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "core/include/fxge/fx_dib.h" | 7 #include "core/include/fxge/fx_dib.h" |
| 8 | 8 |
| 9 #include <limits.h> | 9 #include <limits.h> |
| 10 | 10 |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1229 src_x %= m_Width * src_Bpp; | 1229 src_x %= m_Width * src_Bpp; |
| 1230 int dest_pos = i * src_Bpp; | 1230 int dest_pos = i * src_Bpp; |
| 1231 for (int b = 0; b < src_Bpp; b++) { | 1231 for (int b = 0; b < src_Bpp; b++) { |
| 1232 dest_scan[dest_pos + b] = scanline[src_x + b]; | 1232 dest_scan[dest_pos + b] = scanline[src_x + b]; |
| 1233 } | 1233 } |
| 1234 } | 1234 } |
| 1235 } | 1235 } |
| 1236 } | 1236 } |
| 1237 FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, | 1237 FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, |
| 1238 FX_DWORD backcolor) { | 1238 FX_DWORD backcolor) { |
| 1239 ASSERT(!IsAlphaMask()); | 1239 ASSERT(!IsAlphaMask()); |
|
Tom Sepez
2016/03/16 18:34:59
We can lose the assert here since we handle it at
Wei Li
2016/03/17 02:24:05
assert is for debugging purpose? leave it here for
| |
| 1240 if (!m_pBuffer || IsAlphaMask()) { | 1240 if (!m_pBuffer || IsAlphaMask()) { |
| 1241 return FALSE; | 1241 return FALSE; |
| 1242 } | 1242 } |
| 1243 int fc, fm, fy, fk, bc, bm, by, bk; | 1243 // Values used for CMYK colors. |
| 1244 int fr, fg, fb, br, bg, bb; | 1244 int fc = 0, fm = 0, fy = 0, fk = 0; |
|
dsinclair
2016/03/16 13:23:32
nit: one per line
Wei Li
2016/03/16 17:51:31
Done.
| |
| 1245 int bc = 0, bm = 0, by = 0, bk = 0; | |
|
Tom Sepez
2016/03/16 18:34:59
Stunning lack of duplication between the isCmykIma
Wei Li
2016/03/17 02:24:05
Acknowledged.
| |
| 1246 // Values used for RGB colors. | |
| 1247 int fr = 0, fg = 0, fb = 0; | |
| 1248 int br = 0, bg = 0, bb = 0; | |
| 1245 FX_BOOL isCmykImage = IsCmykImage(); | 1249 FX_BOOL isCmykImage = IsCmykImage(); |
| 1246 if (isCmykImage) { | 1250 if (isCmykImage) { |
| 1247 fc = FXSYS_GetCValue(forecolor); | 1251 fc = FXSYS_GetCValue(forecolor); |
| 1248 fm = FXSYS_GetMValue(forecolor); | 1252 fm = FXSYS_GetMValue(forecolor); |
| 1249 fy = FXSYS_GetYValue(forecolor); | 1253 fy = FXSYS_GetYValue(forecolor); |
| 1250 fk = FXSYS_GetKValue(forecolor); | 1254 fk = FXSYS_GetKValue(forecolor); |
| 1251 bc = FXSYS_GetCValue(backcolor); | 1255 bc = FXSYS_GetCValue(backcolor); |
| 1252 bm = FXSYS_GetMValue(backcolor); | 1256 bm = FXSYS_GetMValue(backcolor); |
| 1253 by = FXSYS_GetYValue(backcolor); | 1257 by = FXSYS_GetYValue(backcolor); |
| 1254 bk = FXSYS_GetKValue(backcolor); | 1258 bk = FXSYS_GetKValue(backcolor); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1736 if (!m_pBitmap->Create(width, height, src_format)) { | 1740 if (!m_pBitmap->Create(width, height, src_format)) { |
| 1737 delete m_pBitmap; | 1741 delete m_pBitmap; |
| 1738 m_pBitmap = NULL; | 1742 m_pBitmap = NULL; |
| 1739 return FALSE; | 1743 return FALSE; |
| 1740 } | 1744 } |
| 1741 if (pSrcPalette) { | 1745 if (pSrcPalette) { |
| 1742 m_pBitmap->CopyPalette(pSrcPalette); | 1746 m_pBitmap->CopyPalette(pSrcPalette); |
| 1743 } | 1747 } |
| 1744 return TRUE; | 1748 return TRUE; |
| 1745 } | 1749 } |
| OLD | NEW |