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/include/fpdfapi/fpdf_module.h" | 7 #include "core/include/fpdfapi/fpdf_module.h" |
8 #include "core/include/fpdfapi/fpdf_page.h" | 8 #include "core/include/fpdfapi/fpdf_page.h" |
9 #include "core/include/fpdfapi/fpdf_render.h" | 9 #include "core/include/fpdfapi/fpdf_render.h" |
10 #include "core/include/fxcodec/fx_codec.h" | 10 #include "core/include/fxcodec/fx_codec.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 pDict->SetAtName("Subtype", "Image"); | 26 pDict->SetAtName("Subtype", "Image"); |
27 pDict->SetAtInteger("Width", width); | 27 pDict->SetAtInteger("Width", width); |
28 pDict->SetAtInteger("Height", height); | 28 pDict->SetAtInteger("Height", height); |
29 const FX_CHAR* csname = NULL; | 29 const FX_CHAR* csname = NULL; |
30 if (num_comps == 1) { | 30 if (num_comps == 1) { |
31 csname = "DeviceGray"; | 31 csname = "DeviceGray"; |
32 } else if (num_comps == 3) { | 32 } else if (num_comps == 3) { |
33 csname = "DeviceRGB"; | 33 csname = "DeviceRGB"; |
34 } else if (num_comps == 4) { | 34 } else if (num_comps == 4) { |
35 csname = "DeviceCMYK"; | 35 csname = "DeviceCMYK"; |
36 CPDF_Array* pDecode = CPDF_Array::Create(); | 36 CPDF_Array* pDecode = new CPDF_Array; |
37 for (int n = 0; n < 4; n++) { | 37 for (int n = 0; n < 4; n++) { |
38 pDecode->AddInteger(1); | 38 pDecode->AddInteger(1); |
39 pDecode->AddInteger(0); | 39 pDecode->AddInteger(0); |
40 } | 40 } |
41 pDict->SetAt("Decode", pDecode); | 41 pDict->SetAt("Decode", pDecode); |
42 } | 42 } |
43 pDict->SetAtName("ColorSpace", csname); | 43 pDict->SetAtName("ColorSpace", csname); |
44 pDict->SetAtInteger("BitsPerComponent", bits); | 44 pDict->SetAtInteger("BitsPerComponent", bits); |
45 pDict->SetAtName("Filter", "DCTDecode"); | 45 pDict->SetAtName("Filter", "DCTDecode"); |
46 if (!color_trans) { | 46 if (!color_trans) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 pCS->AddInteger(1); | 144 pCS->AddInteger(1); |
145 CFX_ByteString ct; | 145 CFX_ByteString ct; |
146 FX_CHAR* pBuf = ct.GetBuffer(6); | 146 FX_CHAR* pBuf = ct.GetBuffer(6); |
147 pBuf[0] = (FX_CHAR)reset_r; | 147 pBuf[0] = (FX_CHAR)reset_r; |
148 pBuf[1] = (FX_CHAR)reset_g; | 148 pBuf[1] = (FX_CHAR)reset_g; |
149 pBuf[2] = (FX_CHAR)reset_b; | 149 pBuf[2] = (FX_CHAR)reset_b; |
150 pBuf[3] = (FX_CHAR)set_r; | 150 pBuf[3] = (FX_CHAR)set_r; |
151 pBuf[4] = (FX_CHAR)set_g; | 151 pBuf[4] = (FX_CHAR)set_g; |
152 pBuf[5] = (FX_CHAR)set_b; | 152 pBuf[5] = (FX_CHAR)set_b; |
153 ct.ReleaseBuffer(6); | 153 ct.ReleaseBuffer(6); |
154 pCS->Add(CPDF_String::Create(ct, TRUE)); | 154 pCS->Add(new CPDF_String(ct, TRUE)); |
155 pDict->SetAt("ColorSpace", pCS); | 155 pDict->SetAt("ColorSpace", pCS); |
156 } | 156 } |
157 pDict->SetAtInteger("BitsPerComponent", 1); | 157 pDict->SetAtInteger("BitsPerComponent", 1); |
158 dest_pitch = (BitmapWidth + 7) / 8; | 158 dest_pitch = (BitmapWidth + 7) / 8; |
159 if ((iCompress & 0x03) == PDF_IMAGE_NO_COMPRESS) { | 159 if ((iCompress & 0x03) == PDF_IMAGE_NO_COMPRESS) { |
160 opType = 1; | 160 opType = 1; |
161 } else { | 161 } else { |
162 opType = 0; | 162 opType = 0; |
163 } | 163 } |
164 } else if (bpp == 8) { | 164 } else if (bpp == 8) { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 m_pStream->InitStreamFromFile(pFileRead, pDict); | 377 m_pStream->InitStreamFromFile(pFileRead, pDict); |
378 } | 378 } |
379 m_bIsMask = pBitmap->IsAlphaMask(); | 379 m_bIsMask = pBitmap->IsAlphaMask(); |
380 m_Width = BitmapWidth; | 380 m_Width = BitmapWidth; |
381 m_Height = BitmapHeight; | 381 m_Height = BitmapHeight; |
382 FX_Free(dest_buf); | 382 FX_Free(dest_buf); |
383 } | 383 } |
384 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { | 384 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { |
385 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); | 385 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); |
386 } | 386 } |
OLD | NEW |