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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_ByteStringC bsDecodeType = pFilters->GetConstString(); |
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 (uint32_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_ByteStringC bsDecodeType = pArray->GetConstStringAt(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) { |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 comps = pCS->CountComponents(); | 930 comps = pCS->CountComponents(); |
931 } | 931 } |
932 CFX_FixedBufGrow<FX_FLOAT, 8> float_array(comps); | 932 CFX_FixedBufGrow<FX_FLOAT, 8> float_array(comps); |
933 FX_FLOAT* pFloats = float_array; | 933 FX_FLOAT* pFloats = float_array; |
934 FX_SAFE_UINT32 num_floats = comps; | 934 FX_SAFE_UINT32 num_floats = comps; |
935 num_floats *= sizeof(FX_FLOAT); | 935 num_floats *= sizeof(FX_FLOAT); |
936 if (!num_floats.IsValid()) { | 936 if (!num_floats.IsValid()) { |
937 return NULL; | 937 return NULL; |
938 } | 938 } |
939 FXSYS_memset(pFloats, 0, num_floats.ValueOrDie()); | 939 FXSYS_memset(pFloats, 0, num_floats.ValueOrDie()); |
940 int count = pBC->GetCount() > 8 ? 8 : pBC->GetCount(); | 940 size_t count = pBC->GetCount() > 8 ? 8 : pBC->GetCount(); |
941 for (int i = 0; i < count; i++) { | 941 for (size_t i = 0; i < count; i++) { |
942 pFloats[i] = pBC->GetNumberAt(i); | 942 pFloats[i] = pBC->GetNumberAt(i); |
943 } | 943 } |
944 pCS->GetRGB(pFloats, R, G, B); | 944 pCS->GetRGB(pFloats, R, G, B); |
945 back_color = 0xff000000 | ((int32_t)(R * 255) << 16) | | 945 back_color = 0xff000000 | ((int32_t)(R * 255) << 16) | |
946 ((int32_t)(G * 255) << 8) | (int32_t)(B * 255); | 946 ((int32_t)(G * 255) << 8) | (int32_t)(B * 255); |
947 m_pContext->GetDocument()->GetPageData()->ReleaseColorSpace(pCSObj); | 947 m_pContext->GetDocument()->GetPageData()->ReleaseColorSpace(pCSObj); |
948 } | 948 } |
949 } | 949 } |
950 bitmap.Clear(back_color); | 950 bitmap.Clear(back_color); |
951 } else { | 951 } else { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 } else if (pFunc) { | 997 } else if (pFunc) { |
998 int size = dest_pitch * height; | 998 int size = dest_pitch * height; |
999 for (int i = 0; i < size; i++) { | 999 for (int i = 0; i < size; i++) { |
1000 dest_buf[i] = transfers[src_buf[i]]; | 1000 dest_buf[i] = transfers[src_buf[i]]; |
1001 } | 1001 } |
1002 } else { | 1002 } else { |
1003 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); | 1003 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); |
1004 } | 1004 } |
1005 return pMask.release(); | 1005 return pMask.release(); |
1006 } | 1006 } |
OLD | NEW |