diff options
author | npm <npm@chromium.org> | 2016-12-02 14:01:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-02 14:01:36 -0800 |
commit | 4bed2af0c049bf499dcdb1327a47d40b4c0db92d (patch) | |
tree | 04239e723c4d27c02d3edd78e3e93012d517ba6e /core/fpdfapi/render/fpdf_render_image.cpp | |
parent | 0527ec571a8842b84f5161dc67f8da439e65eb12 (diff) | |
download | pdfium-4bed2af0c049bf499dcdb1327a47d40b4c0db92d.tar.xz |
Rename fpdf_render_image and fpdf_render_textchromium/2942chromium/2941chromium/2940
Review-Url: https://codereview.chromium.org/2551593002
Diffstat (limited to 'core/fpdfapi/render/fpdf_render_image.cpp')
-rw-r--r-- | core/fpdfapi/render/fpdf_render_image.cpp | 214 |
1 files changed, 0 insertions, 214 deletions
diff --git a/core/fpdfapi/render/fpdf_render_image.cpp b/core/fpdfapi/render/fpdf_render_image.cpp deleted file mode 100644 index da5eda2020..0000000000 --- a/core/fpdfapi/render/fpdf_render_image.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright 2014 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/fpdfapi/render/render_int.h" - -#include <memory> -#include <utility> -#include <vector> - -#include "core/fpdfapi/page/cpdf_docpagedata.h" -#include "core/fpdfapi/page/cpdf_form.h" -#include "core/fpdfapi/page/cpdf_image.h" -#include "core/fpdfapi/page/cpdf_imageobject.h" -#include "core/fpdfapi/page/cpdf_page.h" -#include "core/fpdfapi/page/cpdf_shadingpattern.h" -#include "core/fpdfapi/page/cpdf_tilingpattern.h" -#include "core/fpdfapi/page/pageint.h" -#include "core/fpdfapi/parser/cpdf_array.h" -#include "core/fpdfapi/parser/cpdf_dictionary.h" -#include "core/fpdfapi/parser/cpdf_document.h" -#include "core/fpdfapi/render/cpdf_pagerendercache.h" -#include "core/fpdfapi/render/cpdf_rendercontext.h" -#include "core/fpdfapi/render/cpdf_renderoptions.h" -#include "core/fpdfapi/render/cpdf_renderstatus.h" -#include "core/fpdfapi/render/cpdf_transferfunc.h" -#include "core/fpdfdoc/cpdf_occontext.h" -#include "core/fxcodec/fx_codec.h" -#include "core/fxcrt/fx_safe_types.h" -#include "core/fxge/cfx_fxgedevice.h" -#include "core/fxge/cfx_pathdata.h" - -#ifdef _SKIA_SUPPORT_ -#include "core/fxge/skia/fx_skia_device.h" -#endif - -CPDF_DIBTransferFunc::~CPDF_DIBTransferFunc() {} - -FXDIB_Format CPDF_DIBTransferFunc::GetDestFormat() { - if (m_pSrc->IsAlphaMask()) { - return FXDIB_8bppMask; - } -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - return (m_pSrc->HasAlpha()) ? FXDIB_Argb : FXDIB_Rgb32; -#else - return (m_pSrc->HasAlpha()) ? FXDIB_Argb : FXDIB_Rgb; -#endif -} - -FX_ARGB* CPDF_DIBTransferFunc::GetDestPalette() { - return nullptr; -} - -CPDF_DIBTransferFunc::CPDF_DIBTransferFunc( - const CPDF_TransferFunc* pTransferFunc) { - m_RampR = pTransferFunc->m_Samples; - m_RampG = &pTransferFunc->m_Samples[256]; - m_RampB = &pTransferFunc->m_Samples[512]; -} - -void CPDF_DIBTransferFunc::TranslateScanline( - const uint8_t* src_buf, - std::vector<uint8_t>* dest_buf) const { - bool bSkip = false; - switch (m_pSrc->GetFormat()) { - case FXDIB_1bppRgb: { - int r0 = m_RampR[0]; - int g0 = m_RampG[0]; - int b0 = m_RampB[0]; - int r1 = m_RampR[255]; - int g1 = m_RampG[255]; - int b1 = m_RampB[255]; - int index = 0; - for (int i = 0; i < m_Width; i++) { - if (src_buf[i / 8] & (1 << (7 - i % 8))) { - (*dest_buf)[index++] = b1; - (*dest_buf)[index++] = g1; - (*dest_buf)[index++] = r1; - } else { - (*dest_buf)[index++] = b0; - (*dest_buf)[index++] = g0; - (*dest_buf)[index++] = r0; - } -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - index++; -#endif - } - break; - } - case FXDIB_1bppMask: { - int m0 = m_RampR[0]; - int m1 = m_RampR[255]; - int index = 0; - for (int i = 0; i < m_Width; i++) { - if (src_buf[i / 8] & (1 << (7 - i % 8))) - (*dest_buf)[index++] = m1; - else - (*dest_buf)[index++] = m0; - } - break; - } - case FXDIB_8bppRgb: { - FX_ARGB* pPal = m_pSrc->GetPalette(); - int index = 0; - for (int i = 0; i < m_Width; i++) { - if (pPal) { - FX_ARGB src_argb = pPal[*src_buf]; - (*dest_buf)[index++] = m_RampB[FXARGB_R(src_argb)]; - (*dest_buf)[index++] = m_RampG[FXARGB_G(src_argb)]; - (*dest_buf)[index++] = m_RampR[FXARGB_B(src_argb)]; - } else { - uint32_t src_byte = *src_buf; - (*dest_buf)[index++] = m_RampB[src_byte]; - (*dest_buf)[index++] = m_RampG[src_byte]; - (*dest_buf)[index++] = m_RampR[src_byte]; - } - src_buf++; -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - index++; -#endif - } - break; - } - case FXDIB_8bppMask: { - int index = 0; - for (int i = 0; i < m_Width; i++) { - (*dest_buf)[index++] = m_RampR[*(src_buf++)]; - } - break; - } - case FXDIB_Rgb: { - int index = 0; - for (int i = 0; i < m_Width; i++) { - (*dest_buf)[index++] = m_RampB[*(src_buf++)]; - (*dest_buf)[index++] = m_RampG[*(src_buf++)]; - (*dest_buf)[index++] = m_RampR[*(src_buf++)]; -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - index++; -#endif - } - break; - } - case FXDIB_Rgb32: - bSkip = true; - case FXDIB_Argb: { - int index = 0; - for (int i = 0; i < m_Width; i++) { - (*dest_buf)[index++] = m_RampB[*(src_buf++)]; - (*dest_buf)[index++] = m_RampG[*(src_buf++)]; - (*dest_buf)[index++] = m_RampR[*(src_buf++)]; - if (!bSkip) { - (*dest_buf)[index++] = *src_buf; -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - } else { - index++; -#endif - } - src_buf++; - } - break; - } - default: - break; - } -} - -void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, - const uint8_t* src_buf, - int pixels, - int Bpp) const { - if (Bpp == 8) { - for (int i = 0; i < pixels; i++) { - *dest_buf++ = m_RampR[*(src_buf++)]; - } - } else if (Bpp == 24) { - for (int i = 0; i < pixels; i++) { - *dest_buf++ = m_RampB[*(src_buf++)]; - *dest_buf++ = m_RampG[*(src_buf++)]; - *dest_buf++ = m_RampR[*(src_buf++)]; - } - } else { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - if (!m_pSrc->HasAlpha()) { - for (int i = 0; i < pixels; i++) { - *dest_buf++ = m_RampB[*(src_buf++)]; - *dest_buf++ = m_RampG[*(src_buf++)]; - *dest_buf++ = m_RampR[*(src_buf++)]; - dest_buf++; - src_buf++; - } - } else { -#endif - for (int i = 0; i < pixels; i++) { - *dest_buf++ = m_RampB[*(src_buf++)]; - *dest_buf++ = m_RampG[*(src_buf++)]; - *dest_buf++ = m_RampR[*(src_buf++)]; - *dest_buf++ = *(src_buf++); - } -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - } -#endif - } -} - -CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder( - const uint8_t* src_buf, - uint32_t src_size, - int width, - int height, - int nComps, - int bpc, - const CPDF_Dictionary* pParams); |