Chromium Code Reviews| 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 "core/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/fpdfapi/fpdf_render/render_int.h" |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 m_Flags |= RENDER_FORCE_DOWNSAMPLE; | 405 m_Flags |= RENDER_FORCE_DOWNSAMPLE; |
| 406 } else if (m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_HALFTONE) { | 406 } else if (m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_HALFTONE) { |
| 407 m_Flags |= RENDER_FORCE_HALFTONE; | 407 m_Flags |= RENDER_FORCE_HALFTONE; |
| 408 } | 408 } |
| 409 if (m_pRenderStatus->m_pDevice->GetDeviceClass() != FXDC_DISPLAY) { | 409 if (m_pRenderStatus->m_pDevice->GetDeviceClass() != FXDC_DISPLAY) { |
| 410 CPDF_Object* pFilters = | 410 CPDF_Object* pFilters = |
| 411 m_pImageObject->m_pImage->GetStream()->GetDict()->GetDirectObjectBy( | 411 m_pImageObject->m_pImage->GetStream()->GetDict()->GetDirectObjectBy( |
| 412 "Filter"); | 412 "Filter"); |
| 413 if (pFilters) { | 413 if (pFilters) { |
| 414 if (pFilters->IsName()) { | 414 if (pFilters->IsName()) { |
| 415 CFX_ByteStringC bsDecodeType = pFilters->GetConstString(); | 415 CFX_ByteString bsDecodeType = pFilters->GetString(); |
| 416 if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") { | 416 if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") { |
| 417 m_Flags |= FXRENDER_IMAGE_LOSSY; | 417 m_Flags |= FXRENDER_IMAGE_LOSSY; |
| 418 } | 418 } |
| 419 } else if (CPDF_Array* pArray = pFilters->AsArray()) { | 419 } else if (CPDF_Array* pArray = pFilters->AsArray()) { |
| 420 for (size_t i = 0; i < pArray->GetCount(); i++) { | 420 for (size_t i = 0; i < pArray->GetCount(); i++) { |
| 421 CFX_ByteStringC bsDecodeType = pArray->GetConstStringAt(i); | 421 CFX_ByteString bsDecodeType = pArray->GetStringAt(i); |
| 422 if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") { | 422 if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") { |
| 423 m_Flags |= FXRENDER_IMAGE_LOSSY; | 423 m_Flags |= FXRENDER_IMAGE_LOSSY; |
| 424 break; | 424 break; |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 if (m_pRenderStatus->m_Options.m_Flags & RENDER_NOIMAGESMOOTH) { | 430 if (m_pRenderStatus->m_Options.m_Flags & RENDER_NOIMAGESMOOTH) { |
| 431 m_Flags |= FXDIB_NOSMOOTH; | 431 m_Flags |= FXDIB_NOSMOOTH; |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 int bpc, | 875 int bpc, |
| 876 const CPDF_Dictionary* pParams); | 876 const CPDF_Dictionary* pParams); |
| 877 CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, | 877 CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, |
| 878 FX_RECT* pClipRect, | 878 FX_RECT* pClipRect, |
| 879 const CFX_Matrix* pMatrix) { | 879 const CFX_Matrix* pMatrix) { |
| 880 if (!pSMaskDict) { | 880 if (!pSMaskDict) { |
| 881 return NULL; | 881 return NULL; |
| 882 } | 882 } |
| 883 int width = pClipRect->right - pClipRect->left; | 883 int width = pClipRect->right - pClipRect->left; |
| 884 int height = pClipRect->bottom - pClipRect->top; | 884 int height = pClipRect->bottom - pClipRect->top; |
| 885 FX_BOOL bLuminosity = FALSE; | 885 FX_BOOL bLuminosity = pSMaskDict->GetStringBy("S") != "Alpha"; |
|
Lei Zhang
2016/04/11 21:57:34
You can also move this down, closer to where it's
| |
| 886 bLuminosity = pSMaskDict->GetConstStringBy("S") != "Alpha"; | |
| 887 CPDF_Stream* pGroup = pSMaskDict->GetStreamBy("G"); | 886 CPDF_Stream* pGroup = pSMaskDict->GetStreamBy("G"); |
| 888 if (!pGroup) { | 887 if (!pGroup) { |
| 889 return NULL; | 888 return NULL; |
| 890 } | 889 } |
| 891 std::unique_ptr<CPDF_Function> pFunc; | 890 std::unique_ptr<CPDF_Function> pFunc; |
| 892 CPDF_Object* pFuncObj = pSMaskDict->GetDirectObjectBy("TR"); | 891 CPDF_Object* pFuncObj = pSMaskDict->GetDirectObjectBy("TR"); |
| 893 if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream())) | 892 if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream())) |
| 894 pFunc.reset(CPDF_Function::Load(pFuncObj)); | 893 pFunc.reset(CPDF_Function::Load(pFuncObj)); |
| 895 | 894 |
| 896 CFX_Matrix matrix = *pMatrix; | 895 CFX_Matrix matrix = *pMatrix; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 997 } else if (pFunc) { | 996 } else if (pFunc) { |
| 998 int size = dest_pitch * height; | 997 int size = dest_pitch * height; |
| 999 for (int i = 0; i < size; i++) { | 998 for (int i = 0; i < size; i++) { |
| 1000 dest_buf[i] = transfers[src_buf[i]]; | 999 dest_buf[i] = transfers[src_buf[i]]; |
| 1001 } | 1000 } |
| 1002 } else { | 1001 } else { |
| 1003 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); | 1002 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); |
| 1004 } | 1003 } |
| 1005 return pMask.release(); | 1004 return pMask.release(); |
| 1006 } | 1005 } |
| OLD | NEW |