| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
| 8 #include "../../../include/fxcodec/fx_codec.h" | 8 #include "../../../include/fxcodec/fx_codec.h" |
| 9 #include "text_int.h" | 9 #include "text_int.h" |
| 10 struct PSGlyph { | 10 struct PSGlyph { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 if (!bKeepSaved) { | 86 if (!bKeepSaved) { |
| 87 m_ClipBoxStack.RemoveAt(m_ClipBoxStack.GetSize() - 1); | 87 m_ClipBoxStack.RemoveAt(m_ClipBoxStack.GetSize() - 1); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, const CFX_AffineM
atrix* pObject2Device) | 90 void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, const CFX_AffineM
atrix* pObject2Device) |
| 91 { | 91 { |
| 92 int nPoints = pPathData->GetPointCount(); | 92 int nPoints = pPathData->GetPointCount(); |
| 93 CFX_ByteTextBuf buf; | 93 CFX_ByteTextBuf buf; |
| 94 buf.EstimateSize(nPoints * 10); | 94 buf.EstimateSize(nPoints * 10); |
| 95 for (int i = 0; i < nPoints; i ++) { | 95 for (int i = 0; i < nPoints; i ++) { |
| 96 FX_BYTE flag = pPathData->GetFlag(i); | 96 uint8_t flag = pPathData->GetFlag(i); |
| 97 FX_FLOAT x = pPathData->GetPointX(i); | 97 FX_FLOAT x = pPathData->GetPointX(i); |
| 98 FX_FLOAT y = pPathData->GetPointY(i); | 98 FX_FLOAT y = pPathData->GetPointY(i); |
| 99 if (pObject2Device) { | 99 if (pObject2Device) { |
| 100 pObject2Device->Transform(x, y); | 100 pObject2Device->Transform(x, y); |
| 101 } | 101 } |
| 102 buf << x << FX_BSTRC(" ") << y; | 102 buf << x << FX_BSTRC(" ") << y; |
| 103 switch (flag & FXPT_TYPE) { | 103 switch (flag & FXPT_TYPE) { |
| 104 case FXPT_MOVETO: | 104 case FXPT_MOVETO: |
| 105 buf << FX_BSTRC(" m "); | 105 buf << FX_BSTRC(" m "); |
| 106 break; | 106 break; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 CFX_ByteTextBuf buf; | 341 CFX_ByteTextBuf buf; |
| 342 buf << FX_BSTRC("[") << pMatrix->a << FX_BSTRC(" ") << pMatrix->b << FX_BSTR
C(" ") << | 342 buf << FX_BSTRC("[") << pMatrix->a << FX_BSTRC(" ") << pMatrix->b << FX_BSTR
C(" ") << |
| 343 pMatrix->c << FX_BSTRC(" ") << pMatrix->d << FX_BSTRC(" ") << pMatrix->e
<< | 343 pMatrix->c << FX_BSTRC(" ") << pMatrix->d << FX_BSTRC(" ") << pMatrix->e
<< |
| 344 FX_BSTRC(" ") << pMatrix->f << FX_BSTRC("]cm "); | 344 FX_BSTRC(" ") << pMatrix->f << FX_BSTRC("]cm "); |
| 345 int width = pSource->GetWidth(); | 345 int width = pSource->GetWidth(); |
| 346 int height = pSource->GetHeight(); | 346 int height = pSource->GetHeight(); |
| 347 buf << width << FX_BSTRC(" ") << height; | 347 buf << width << FX_BSTRC(" ") << height; |
| 348 if (pSource->GetBPP() == 1 && pSource->GetPalette() == NULL) { | 348 if (pSource->GetBPP() == 1 && pSource->GetPalette() == NULL) { |
| 349 int pitch = (width + 7) / 8; | 349 int pitch = (width + 7) / 8; |
| 350 FX_DWORD src_size = height * pitch; | 350 FX_DWORD src_size = height * pitch; |
| 351 FX_LPBYTE src_buf = FX_Alloc(FX_BYTE, src_size); | 351 FX_LPBYTE src_buf = FX_Alloc(uint8_t, src_size); |
| 352 for (int row = 0; row < height; row ++) { | 352 for (int row = 0; row < height; row ++) { |
| 353 FX_LPCBYTE src_scan = pSource->GetScanline(row); | 353 FX_LPCBYTE src_scan = pSource->GetScanline(row); |
| 354 FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch); | 354 FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch); |
| 355 } | 355 } |
| 356 FX_LPBYTE output_buf; | 356 FX_LPBYTE output_buf; |
| 357 FX_DWORD output_size; | 357 FX_DWORD output_size; |
| 358 FaxCompressData(src_buf, width, height, output_buf, output_size); | 358 FaxCompressData(src_buf, width, height, output_buf, output_size); |
| 359 if (pSource->IsAlphaMask()) { | 359 if (pSource->IsAlphaMask()) { |
| 360 SetColor(color, alpha_flag, pIccTransform); | 360 SetColor(color, alpha_flag, pIccTransform); |
| 361 m_bColorSet = FALSE; | 361 m_bColorSet = FALSE; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 FX_LPCSTR filter = NULL; | 414 FX_LPCSTR filter = NULL; |
| 415 if (flags & FXRENDER_IMAGE_LOSSY) { | 415 if (flags & FXRENDER_IMAGE_LOSSY) { |
| 416 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); | 416 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); |
| 417 if (pEncoders && pEncoders->GetJpegModule()->Encode(pConverted, outp
ut_buf, output_size)) { | 417 if (pEncoders && pEncoders->GetJpegModule()->Encode(pConverted, outp
ut_buf, output_size)) { |
| 418 filter = "/DCTDecode filter "; | 418 filter = "/DCTDecode filter "; |
| 419 } | 419 } |
| 420 } | 420 } |
| 421 if (filter == NULL) { | 421 if (filter == NULL) { |
| 422 int src_pitch = width * Bpp; | 422 int src_pitch = width * Bpp; |
| 423 output_size = height * src_pitch; | 423 output_size = height * src_pitch; |
| 424 output_buf = FX_Alloc(FX_BYTE, output_size); | 424 output_buf = FX_Alloc(uint8_t, output_size); |
| 425 for (int row = 0; row < height; row ++) { | 425 for (int row = 0; row < height; row ++) { |
| 426 FX_LPCBYTE src_scan = pConverted->GetScanline(row); | 426 FX_LPCBYTE src_scan = pConverted->GetScanline(row); |
| 427 FX_LPBYTE dest_scan = output_buf + row * src_pitch; | 427 FX_LPBYTE dest_scan = output_buf + row * src_pitch; |
| 428 if (Bpp == 3) { | 428 if (Bpp == 3) { |
| 429 for (int col = 0; col < width; col ++) { | 429 for (int col = 0; col < width; col ++) { |
| 430 *dest_scan++ = src_scan[2]; | 430 *dest_scan++ = src_scan[2]; |
| 431 *dest_scan++ = src_scan[1]; | 431 *dest_scan++ = src_scan[1]; |
| 432 *dest_scan++ = *src_scan; | 432 *dest_scan++ = *src_scan; |
| 433 src_scan += 3; | 433 src_scan += 3; |
| 434 } | 434 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 FX_LPBYTE dest_buf; | 635 FX_LPBYTE dest_buf; |
| 636 FX_DWORD dest_size; | 636 FX_DWORD dest_size; |
| 637 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); | 637 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); |
| 638 if (pEncoders && pEncoders->GetBasicModule()->A85Encode(data, len, dest_buf,
dest_size)) { | 638 if (pEncoders && pEncoders->GetBasicModule()->A85Encode(data, len, dest_buf,
dest_size)) { |
| 639 m_pOutput->OutputPS((FX_LPCSTR)dest_buf, dest_size); | 639 m_pOutput->OutputPS((FX_LPCSTR)dest_buf, dest_size); |
| 640 FX_Free(dest_buf); | 640 FX_Free(dest_buf); |
| 641 } else { | 641 } else { |
| 642 m_pOutput->OutputPS((FX_LPCSTR)data, len); | 642 m_pOutput->OutputPS((FX_LPCSTR)data, len); |
| 643 } | 643 } |
| 644 } | 644 } |
| OLD | NEW |