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_renderoptions.h" 8 9 CPDF_RenderOptions::CPDF_RenderOptions() 10 : m_ColorMode(kNormal), 11 m_Flags(RENDER_CLEARTYPE), 12 m_dwLimitCacheSize(1024 * 1024 * 100), 13 m_bDrawAnnots(false) {} 14 15 CPDF_RenderOptions::CPDF_RenderOptions(const CPDF_RenderOptions& rhs) 16 : m_ColorMode(rhs.m_ColorMode), 17 m_Flags(rhs.m_Flags), 18 m_dwLimitCacheSize(rhs.m_dwLimitCacheSize), 19 m_bDrawAnnots(rhs.m_bDrawAnnots), 20 m_pOCContext(rhs.m_pOCContext) {} 21 22 CPDF_RenderOptions::~CPDF_RenderOptions() {} 23 24 FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const { 25 if (ColorModeIs(kNormal)) 26 return argb; 27 if (ColorModeIs(kAlpha)) 28 return argb; 29 30 int a; 31 int r; 32 int g; 33 int b; 34 std::tie(a, r, g, b) = ArgbDecode(argb); 35 int gray = FXRGB2GRAY(r, g, b); 36 return ArgbEncode(a, gray, gray, gray); 37 } 38