| 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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 bFlipX ? (m_Width - dest_x * m_Width / dest_width - 1) * src_Bpp | 1227 bFlipX ? (m_Width - dest_x * m_Width / dest_width - 1) * src_Bpp |
| 1228 : (dest_x * m_Width / dest_width) * src_Bpp; | 1228 : (dest_x * m_Width / dest_width) * src_Bpp; |
| 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 |
| 1238 // TODO(weili): Split this function into two for handling CMYK and RGB |
| 1239 // colors separately. |
| 1237 FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, | 1240 FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, |
| 1238 FX_DWORD backcolor) { | 1241 FX_DWORD backcolor) { |
| 1239 ASSERT(!IsAlphaMask()); | 1242 ASSERT(!IsAlphaMask()); |
| 1240 if (!m_pBuffer || IsAlphaMask()) { | 1243 if (!m_pBuffer || IsAlphaMask()) { |
| 1241 return FALSE; | 1244 return FALSE; |
| 1242 } | 1245 } |
| 1243 int fc, fm, fy, fk, bc, bm, by, bk; | 1246 // Values used for CMYK colors. |
| 1244 int fr, fg, fb, br, bg, bb; | 1247 int fc = 0; |
| 1248 int fm = 0; |
| 1249 int fy = 0; |
| 1250 int fk = 0; |
| 1251 int bc = 0; |
| 1252 int bm = 0; |
| 1253 int by = 0; |
| 1254 int bk = 0; |
| 1255 // Values used for RGB colors. |
| 1256 int fr = 0; |
| 1257 int fg = 0; |
| 1258 int fb = 0; |
| 1259 int br = 0; |
| 1260 int bg = 0; |
| 1261 int bb = 0; |
| 1245 FX_BOOL isCmykImage = IsCmykImage(); | 1262 FX_BOOL isCmykImage = IsCmykImage(); |
| 1246 if (isCmykImage) { | 1263 if (isCmykImage) { |
| 1247 fc = FXSYS_GetCValue(forecolor); | 1264 fc = FXSYS_GetCValue(forecolor); |
| 1248 fm = FXSYS_GetMValue(forecolor); | 1265 fm = FXSYS_GetMValue(forecolor); |
| 1249 fy = FXSYS_GetYValue(forecolor); | 1266 fy = FXSYS_GetYValue(forecolor); |
| 1250 fk = FXSYS_GetKValue(forecolor); | 1267 fk = FXSYS_GetKValue(forecolor); |
| 1251 bc = FXSYS_GetCValue(backcolor); | 1268 bc = FXSYS_GetCValue(backcolor); |
| 1252 bm = FXSYS_GetMValue(backcolor); | 1269 bm = FXSYS_GetMValue(backcolor); |
| 1253 by = FXSYS_GetYValue(backcolor); | 1270 by = FXSYS_GetYValue(backcolor); |
| 1254 bk = FXSYS_GetKValue(backcolor); | 1271 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)) { | 1753 if (!m_pBitmap->Create(width, height, src_format)) { |
| 1737 delete m_pBitmap; | 1754 delete m_pBitmap; |
| 1738 m_pBitmap = NULL; | 1755 m_pBitmap = NULL; |
| 1739 return FALSE; | 1756 return FALSE; |
| 1740 } | 1757 } |
| 1741 if (pSrcPalette) { | 1758 if (pSrcPalette) { |
| 1742 m_pBitmap->CopyPalette(pSrcPalette); | 1759 m_pBitmap->CopyPalette(pSrcPalette); |
| 1743 } | 1760 } |
| 1744 return TRUE; | 1761 return TRUE; |
| 1745 } | 1762 } |
| OLD | NEW |