OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/fpdfapi/render/cpdf_transferfunc.h" | 7 #include "core/fpdfapi/render/cpdf_transferfunc.h" |
8 | 8 |
9 #include "core/fpdfapi/parser/cpdf_document.h" | 9 #include "core/fpdfapi/parser/cpdf_document.h" |
10 #include "core/fpdfapi/render/render_int.h" | 10 #include "core/fpdfapi/render/cpdf_dibtransferfunc.h" |
11 | 11 |
12 CPDF_TransferFunc::CPDF_TransferFunc(CPDF_Document* pDoc) : m_pPDFDoc(pDoc) {} | 12 CPDF_TransferFunc::CPDF_TransferFunc(CPDF_Document* pDoc) : m_pPDFDoc(pDoc) {} |
13 | 13 |
14 FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const { | 14 FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const { |
15 return FXSYS_RGB(m_Samples[FXSYS_GetRValue(rgb)], | 15 return FXSYS_RGB(m_Samples[FXSYS_GetRValue(rgb)], |
16 m_Samples[256 + FXSYS_GetGValue(rgb)], | 16 m_Samples[256 + FXSYS_GetGValue(rgb)], |
17 m_Samples[512 + FXSYS_GetBValue(rgb)]); | 17 m_Samples[512 + FXSYS_GetBValue(rgb)]); |
18 } | 18 } |
19 | 19 |
20 CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc, | 20 CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc, |
21 bool bAutoDropSrc) { | 21 bool bAutoDropSrc) { |
22 CPDF_DIBTransferFunc* pDest = new CPDF_DIBTransferFunc(this); | 22 CPDF_DIBTransferFunc* pDest = new CPDF_DIBTransferFunc(this); |
23 pDest->LoadSrc(pSrc, bAutoDropSrc); | 23 pDest->LoadSrc(pSrc, bAutoDropSrc); |
24 return pDest; | 24 return pDest; |
25 } | 25 } |
OLD | NEW |