Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: core/fpdfapi/page/cpdf_image.cpp

Issue 2451493002: Refcount all the IFX_ stream classes all the time. (Closed)
Patch Set: Clean up cast expression Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/page/cpdf_image.h ('k') | core/fpdfapi/parser/cfdf_document.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/page/cpdf_image.h" 7 #include "core/fpdfapi/page/cpdf_image.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 pParms->SetNewFor<CPDF_Number>("ColorTransform", 0); 109 pParms->SetNewFor<CPDF_Number>("ColorTransform", 0);
110 } 110 }
111 m_bIsMask = false; 111 m_bIsMask = false;
112 m_Width = width; 112 m_Width = width;
113 m_Height = height; 113 m_Height = height;
114 if (!m_pStream) 114 if (!m_pStream)
115 m_pStream = pdfium::MakeUnique<CPDF_Stream>(); 115 m_pStream = pdfium::MakeUnique<CPDF_Stream>();
116 return pDict; 116 return pDict;
117 } 117 }
118 118
119 void CPDF_Image::SetJpegImage(IFX_SeekableReadStream* pFile) { 119 void CPDF_Image::SetJpegImage(
120 const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) {
120 uint32_t size = pdfium::base::checked_cast<uint32_t>(pFile->GetSize()); 121 uint32_t size = pdfium::base::checked_cast<uint32_t>(pFile->GetSize());
121 if (!size) 122 if (!size)
122 return; 123 return;
123 124
124 uint32_t dwEstimateSize = std::min(size, 8192U); 125 uint32_t dwEstimateSize = std::min(size, 8192U);
125 std::vector<uint8_t> data(dwEstimateSize); 126 std::vector<uint8_t> data(dwEstimateSize);
126 if (!pFile->ReadBlock(data.data(), 0, dwEstimateSize)) 127 if (!pFile->ReadBlock(data.data(), 0, dwEstimateSize))
127 return; 128 return;
128 129
129 std::unique_ptr<CPDF_Dictionary> pDict = 130 std::unique_ptr<CPDF_Dictionary> pDict =
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 362 }
362 if (!ret) { 363 if (!ret) {
363 delete m_pDIBSource; 364 delete m_pDIBSource;
364 m_pDIBSource = nullptr; 365 m_pDIBSource = nullptr;
365 return false; 366 return false;
366 } 367 }
367 m_pMask = pSource->DetachMask(); 368 m_pMask = pSource->DetachMask();
368 m_MatteColor = pSource->GetMatteColor(); 369 m_MatteColor = pSource->GetMatteColor();
369 return false; 370 return false;
370 } 371 }
OLDNEW
« no previous file with comments | « core/fpdfapi/page/cpdf_image.h ('k') | core/fpdfapi/parser/cfdf_document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698