Home | History | Annotate | Download | only in render
      1 // Copyright 2016 PDFium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
      6 
      7 #include "core/fpdfapi/render/cpdf_transferfunc.h"
      8 
      9 #include "core/fpdfapi/parser/cpdf_document.h"
     10 #include "core/fpdfapi/render/cpdf_dibtransferfunc.h"
     11 
     12 CPDF_TransferFunc::CPDF_TransferFunc(CPDF_Document* pDoc) : m_pPDFDoc(pDoc) {}
     13 
     14 FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const {
     15   return FXSYS_RGB(m_Samples[FXSYS_GetRValue(rgb)],
     16                    m_Samples[256 + FXSYS_GetGValue(rgb)],
     17                    m_Samples[512 + FXSYS_GetBValue(rgb)]);
     18 }
     19 
     20 CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc,
     21                                                  bool bAutoDropSrc) {
     22   CPDF_DIBTransferFunc* pDest = new CPDF_DIBTransferFunc(this);
     23   pDest->LoadSrc(pSrc, bAutoDropSrc);
     24   return pDest;
     25 }
     26