• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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/fxge/dib/cfx_dibextractor.h"
8 
9 #include "core/fxge/dib/cfx_dibsource.h"
10 
CFX_DIBExtractor(const RetainPtr<CFX_DIBSource> & pSrc)11 CFX_DIBExtractor::CFX_DIBExtractor(const RetainPtr<CFX_DIBSource>& pSrc) {
12   if (!pSrc->GetBuffer()) {
13     m_pBitmap = pSrc->Clone(nullptr);
14     return;
15   }
16   RetainPtr<CFX_DIBSource> pOldSrc(pSrc);
17   m_pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
18   if (!m_pBitmap->Create(pOldSrc->GetWidth(), pOldSrc->GetHeight(),
19                          pOldSrc->GetFormat(), pOldSrc->GetBuffer())) {
20     m_pBitmap.Reset();
21     return;
22   }
23   m_pBitmap->SetPalette(pOldSrc->GetPalette());
24   m_pBitmap->SetAlphaMask(pOldSrc->m_pAlphaMask, nullptr);
25 }
26 
~CFX_DIBExtractor()27 CFX_DIBExtractor::~CFX_DIBExtractor() {}
28