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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(FX_BYTE, src_size); |
352 if (!src_buf) { | |
353 return FALSE; | |
354 } | |
355 for (int row = 0; row < height; row ++) { | 352 for (int row = 0; row < height; row ++) { |
356 FX_LPCBYTE src_scan = pSource->GetScanline(row); | 353 FX_LPCBYTE src_scan = pSource->GetScanline(row); |
357 FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch); | 354 FXSYS_memcpy32(src_buf + row * pitch, src_scan, pitch); |
358 } | 355 } |
359 FX_LPBYTE output_buf; | 356 FX_LPBYTE output_buf; |
360 FX_DWORD output_size; | 357 FX_DWORD output_size; |
361 FaxCompressData(src_buf, width, height, output_buf, output_size); | 358 FaxCompressData(src_buf, width, height, output_buf, output_size); |
362 if (pSource->IsAlphaMask()) { | 359 if (pSource->IsAlphaMask()) { |
363 SetColor(color, alpha_flag, pIccTransform); | 360 SetColor(color, alpha_flag, pIccTransform); |
364 m_bColorSet = FALSE; | 361 m_bColorSet = FALSE; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 if (flags & FXRENDER_IMAGE_LOSSY) { | 415 if (flags & FXRENDER_IMAGE_LOSSY) { |
419 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); | 416 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); |
420 if (pEncoders && pEncoders->GetJpegModule()->Encode(pConverted, outp
ut_buf, output_size)) { | 417 if (pEncoders && pEncoders->GetJpegModule()->Encode(pConverted, outp
ut_buf, output_size)) { |
421 filter = "/DCTDecode filter "; | 418 filter = "/DCTDecode filter "; |
422 } | 419 } |
423 } | 420 } |
424 if (filter == NULL) { | 421 if (filter == NULL) { |
425 int src_pitch = width * Bpp; | 422 int src_pitch = width * Bpp; |
426 output_size = height * src_pitch; | 423 output_size = height * src_pitch; |
427 output_buf = FX_Alloc(FX_BYTE, output_size); | 424 output_buf = FX_Alloc(FX_BYTE, output_size); |
428 if (!output_buf) { | |
429 if (pConverted != pSource) { | |
430 delete pConverted; | |
431 pConverted = NULL; | |
432 } | |
433 return FALSE; | |
434 } | |
435 for (int row = 0; row < height; row ++) { | 425 for (int row = 0; row < height; row ++) { |
436 FX_LPCBYTE src_scan = pConverted->GetScanline(row); | 426 FX_LPCBYTE src_scan = pConverted->GetScanline(row); |
437 FX_LPBYTE dest_scan = output_buf + row * src_pitch; | 427 FX_LPBYTE dest_scan = output_buf + row * src_pitch; |
438 if (Bpp == 3) { | 428 if (Bpp == 3) { |
439 for (int col = 0; col < width; col ++) { | 429 for (int col = 0; col < width; col ++) { |
440 *dest_scan++ = src_scan[2]; | 430 *dest_scan++ = src_scan[2]; |
441 *dest_scan++ = src_scan[1]; | 431 *dest_scan++ = src_scan[1]; |
442 *dest_scan++ = *src_scan; | 432 *dest_scan++ = *src_scan; |
443 src_scan += 3; | 433 src_scan += 3; |
444 } | 434 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 FX_LPBYTE dest_buf; | 638 FX_LPBYTE dest_buf; |
649 FX_DWORD dest_size; | 639 FX_DWORD dest_size; |
650 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); | 640 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); |
651 if (pEncoders && pEncoders->GetBasicModule()->A85Encode(data, len, dest_buf,
dest_size)) { | 641 if (pEncoders && pEncoders->GetBasicModule()->A85Encode(data, len, dest_buf,
dest_size)) { |
652 m_pOutput->OutputPS((FX_LPCSTR)dest_buf, dest_size); | 642 m_pOutput->OutputPS((FX_LPCSTR)dest_buf, dest_size); |
653 FX_Free(dest_buf); | 643 FX_Free(dest_buf); |
654 } else { | 644 } else { |
655 m_pOutput->OutputPS((FX_LPCSTR)data, len); | 645 m_pOutput->OutputPS((FX_LPCSTR)data, len); |
656 } | 646 } |
657 } | 647 } |
OLD | NEW |