diff options
author | Nicolas Pena <npm@chromium.org> | 2017-04-03 12:48:00 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-03 17:26:35 +0000 |
commit | 192e4d969f918e1ec1e79094b6af0235d7be4818 (patch) | |
tree | 4bf5cdbbc5d22c045f4fe3bf6242dff3fd15dfeb /core/fxge/dib/cfx_dibextractor.cpp | |
parent | 1423319f52c5e80253d337ad02b19187c6d66ff1 (diff) | |
download | pdfium-192e4d969f918e1ec1e79094b6af0235d7be4818.tar.xz |
Split fx_dib part 4
- Moved CFX_DIBitmap code to its own cpp file.
- Moved CFX_DIBExtractor out from fx_dib.h
Change-Id: I7b3fe9c657a350320b7ecb3f005017080491fe29
Reviewed-on: https://pdfium-review.googlesource.com/3591
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/dib/cfx_dibextractor.cpp')
-rw-r--r-- | core/fxge/dib/cfx_dibextractor.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/core/fxge/dib/cfx_dibextractor.cpp b/core/fxge/dib/cfx_dibextractor.cpp new file mode 100644 index 0000000000..8de69e2e3b --- /dev/null +++ b/core/fxge/dib/cfx_dibextractor.cpp @@ -0,0 +1,27 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "core/fxge/dib/cfx_dibextractor.h" + +#include "core/fxge/dib/cfx_dibsource.h" + +CFX_DIBExtractor::CFX_DIBExtractor(const CFX_RetainPtr<CFX_DIBSource>& pSrc) { + if (!pSrc->GetBuffer()) { + m_pBitmap = pSrc->Clone(); + return; + } + CFX_RetainPtr<CFX_DIBSource> pOldSrc(pSrc); + m_pBitmap = pdfium::MakeRetain<CFX_DIBitmap>(); + if (!m_pBitmap->Create(pOldSrc->GetWidth(), pOldSrc->GetHeight(), + pOldSrc->GetFormat(), pOldSrc->GetBuffer())) { + m_pBitmap.Reset(); + return; + } + m_pBitmap->SetPalette(pOldSrc->GetPalette()); + m_pBitmap->SetAlphaMask(pOldSrc->m_pAlphaMask); +} + +CFX_DIBExtractor::~CFX_DIBExtractor() {} |