Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: core/fpdfapi/render/cpdf_dibtransferfunc.cpp

Issue 2551593002: Rename fpdf_render_image and fpdf_render_text (Closed)
Patch Set: Remove commented Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/render/cpdf_dibtransferfunc.h ('k') | core/fpdfapi/render/cpdf_textrenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/render/render_int.h" 7 #include "core/fpdfapi/render/cpdf_dibtransferfunc.h"
8 8
9 #include <memory>
10 #include <utility>
11 #include <vector> 9 #include <vector>
12 10
13 #include "core/fpdfapi/page/cpdf_docpagedata.h"
14 #include "core/fpdfapi/page/cpdf_form.h"
15 #include "core/fpdfapi/page/cpdf_image.h"
16 #include "core/fpdfapi/page/cpdf_imageobject.h"
17 #include "core/fpdfapi/page/cpdf_page.h"
18 #include "core/fpdfapi/page/cpdf_shadingpattern.h"
19 #include "core/fpdfapi/page/cpdf_tilingpattern.h"
20 #include "core/fpdfapi/page/pageint.h"
21 #include "core/fpdfapi/parser/cpdf_array.h"
22 #include "core/fpdfapi/parser/cpdf_dictionary.h" 11 #include "core/fpdfapi/parser/cpdf_dictionary.h"
23 #include "core/fpdfapi/parser/cpdf_document.h"
24 #include "core/fpdfapi/render/cpdf_pagerendercache.h"
25 #include "core/fpdfapi/render/cpdf_rendercontext.h"
26 #include "core/fpdfapi/render/cpdf_renderoptions.h"
27 #include "core/fpdfapi/render/cpdf_renderstatus.h"
28 #include "core/fpdfapi/render/cpdf_transferfunc.h" 12 #include "core/fpdfapi/render/cpdf_transferfunc.h"
29 #include "core/fpdfdoc/cpdf_occontext.h"
30 #include "core/fxcodec/fx_codec.h"
31 #include "core/fxcrt/fx_safe_types.h"
32 #include "core/fxge/cfx_fxgedevice.h"
33 #include "core/fxge/cfx_pathdata.h"
34 13
35 #ifdef _SKIA_SUPPORT_ 14 CPDF_DIBTransferFunc::CPDF_DIBTransferFunc(
36 #include "core/fxge/skia/fx_skia_device.h" 15 const CPDF_TransferFunc* pTransferFunc) {
37 #endif 16 m_RampR = pTransferFunc->m_Samples;
17 m_RampG = &pTransferFunc->m_Samples[256];
18 m_RampB = &pTransferFunc->m_Samples[512];
19 }
38 20
39 CPDF_DIBTransferFunc::~CPDF_DIBTransferFunc() {} 21 CPDF_DIBTransferFunc::~CPDF_DIBTransferFunc() {}
40 22
41 FXDIB_Format CPDF_DIBTransferFunc::GetDestFormat() { 23 FXDIB_Format CPDF_DIBTransferFunc::GetDestFormat() {
42 if (m_pSrc->IsAlphaMask()) { 24 if (m_pSrc->IsAlphaMask())
43 return FXDIB_8bppMask; 25 return FXDIB_8bppMask;
44 } 26
45 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 27 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
46 return (m_pSrc->HasAlpha()) ? FXDIB_Argb : FXDIB_Rgb32; 28 return (m_pSrc->HasAlpha()) ? FXDIB_Argb : FXDIB_Rgb32;
47 #else 29 #else
48 return (m_pSrc->HasAlpha()) ? FXDIB_Argb : FXDIB_Rgb; 30 return (m_pSrc->HasAlpha()) ? FXDIB_Argb : FXDIB_Rgb;
49 #endif 31 #endif
50 } 32 }
51 33
52 FX_ARGB* CPDF_DIBTransferFunc::GetDestPalette() { 34 FX_ARGB* CPDF_DIBTransferFunc::GetDestPalette() {
53 return nullptr; 35 return nullptr;
54 } 36 }
55 37
56 CPDF_DIBTransferFunc::CPDF_DIBTransferFunc(
57 const CPDF_TransferFunc* pTransferFunc) {
58 m_RampR = pTransferFunc->m_Samples;
59 m_RampG = &pTransferFunc->m_Samples[256];
60 m_RampB = &pTransferFunc->m_Samples[512];
61 }
62
63 void CPDF_DIBTransferFunc::TranslateScanline( 38 void CPDF_DIBTransferFunc::TranslateScanline(
64 const uint8_t* src_buf, 39 const uint8_t* src_buf,
65 std::vector<uint8_t>* dest_buf) const { 40 std::vector<uint8_t>* dest_buf) const {
66 bool bSkip = false; 41 bool bSkip = false;
67 switch (m_pSrc->GetFormat()) { 42 switch (m_pSrc->GetFormat()) {
68 case FXDIB_1bppRgb: { 43 case FXDIB_1bppRgb: {
69 int r0 = m_RampR[0]; 44 int r0 = m_RampR[0];
70 int g0 = m_RampG[0]; 45 int g0 = m_RampG[0];
71 int b0 = m_RampB[0]; 46 int b0 = m_RampB[0];
72 int r1 = m_RampR[255]; 47 int r1 = m_RampR[255];
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 93 }
119 src_buf++; 94 src_buf++;
120 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 95 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
121 index++; 96 index++;
122 #endif 97 #endif
123 } 98 }
124 break; 99 break;
125 } 100 }
126 case FXDIB_8bppMask: { 101 case FXDIB_8bppMask: {
127 int index = 0; 102 int index = 0;
128 for (int i = 0; i < m_Width; i++) { 103 for (int i = 0; i < m_Width; i++)
129 (*dest_buf)[index++] = m_RampR[*(src_buf++)]; 104 (*dest_buf)[index++] = m_RampR[*(src_buf++)];
130 }
131 break; 105 break;
132 } 106 }
133 case FXDIB_Rgb: { 107 case FXDIB_Rgb: {
134 int index = 0; 108 int index = 0;
135 for (int i = 0; i < m_Width; i++) { 109 for (int i = 0; i < m_Width; i++) {
136 (*dest_buf)[index++] = m_RampB[*(src_buf++)]; 110 (*dest_buf)[index++] = m_RampB[*(src_buf++)];
137 (*dest_buf)[index++] = m_RampG[*(src_buf++)]; 111 (*dest_buf)[index++] = m_RampG[*(src_buf++)];
138 (*dest_buf)[index++] = m_RampR[*(src_buf++)]; 112 (*dest_buf)[index++] = m_RampR[*(src_buf++)];
139 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 113 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
140 index++; 114 index++;
(...skipping 23 matching lines...) Expand all
164 default: 138 default:
165 break; 139 break;
166 } 140 }
167 } 141 }
168 142
169 void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, 143 void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf,
170 const uint8_t* src_buf, 144 const uint8_t* src_buf,
171 int pixels, 145 int pixels,
172 int Bpp) const { 146 int Bpp) const {
173 if (Bpp == 8) { 147 if (Bpp == 8) {
174 for (int i = 0; i < pixels; i++) { 148 for (int i = 0; i < pixels; i++)
175 *dest_buf++ = m_RampR[*(src_buf++)]; 149 *dest_buf++ = m_RampR[*(src_buf++)];
176 }
177 } else if (Bpp == 24) { 150 } else if (Bpp == 24) {
178 for (int i = 0; i < pixels; i++) { 151 for (int i = 0; i < pixels; i++) {
179 *dest_buf++ = m_RampB[*(src_buf++)]; 152 *dest_buf++ = m_RampB[*(src_buf++)];
180 *dest_buf++ = m_RampG[*(src_buf++)]; 153 *dest_buf++ = m_RampG[*(src_buf++)];
181 *dest_buf++ = m_RampR[*(src_buf++)]; 154 *dest_buf++ = m_RampR[*(src_buf++)];
182 } 155 }
183 } else { 156 } else {
184 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 157 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
185 if (!m_pSrc->HasAlpha()) { 158 if (!m_pSrc->HasAlpha()) {
186 for (int i = 0; i < pixels; i++) { 159 for (int i = 0; i < pixels; i++) {
187 *dest_buf++ = m_RampB[*(src_buf++)]; 160 *dest_buf++ = m_RampB[*(src_buf++)];
188 *dest_buf++ = m_RampG[*(src_buf++)]; 161 *dest_buf++ = m_RampG[*(src_buf++)];
189 *dest_buf++ = m_RampR[*(src_buf++)]; 162 *dest_buf++ = m_RampR[*(src_buf++)];
190 dest_buf++; 163 dest_buf++;
191 src_buf++; 164 src_buf++;
192 } 165 }
193 } else { 166 } else {
194 #endif 167 #endif
195 for (int i = 0; i < pixels; i++) { 168 for (int i = 0; i < pixels; i++) {
196 *dest_buf++ = m_RampB[*(src_buf++)]; 169 *dest_buf++ = m_RampB[*(src_buf++)];
197 *dest_buf++ = m_RampG[*(src_buf++)]; 170 *dest_buf++ = m_RampG[*(src_buf++)];
198 *dest_buf++ = m_RampR[*(src_buf++)]; 171 *dest_buf++ = m_RampR[*(src_buf++)];
199 *dest_buf++ = *(src_buf++); 172 *dest_buf++ = *(src_buf++);
200 } 173 }
201 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 174 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
202 } 175 }
203 #endif 176 #endif
204 } 177 }
205 } 178 }
206
207 CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
208 const uint8_t* src_buf,
209 uint32_t src_size,
210 int width,
211 int height,
212 int nComps,
213 int bpc,
214 const CPDF_Dictionary* pParams);
OLDNEW
« no previous file with comments | « core/fpdfapi/render/cpdf_dibtransferfunc.h ('k') | core/fpdfapi/render/cpdf_textrenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698