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

Side by Side Diff: core/fpdfapi/render/fpdf_render_loadimage.cpp

Issue 2534953004: Return unique_ptrs from CFX_DIBitmap::Clone(). (Closed)
Patch Set: nits 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/render/cpdf_type3cache.cpp ('k') | core/fpdfapi/render/render_int.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 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/render/render_int.h" 7 #include "core/fpdfapi/render/render_int.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 FX_Free(m_pMaskedLine); 125 FX_Free(m_pMaskedLine);
126 FX_Free(m_pLineBuf); 126 FX_Free(m_pLineBuf);
127 m_pCachedBitmap.reset(); 127 m_pCachedBitmap.reset();
128 FX_Free(m_pCompData); 128 FX_Free(m_pCompData);
129 CPDF_ColorSpace* pCS = m_pColorSpace; 129 CPDF_ColorSpace* pCS = m_pColorSpace;
130 if (pCS && m_pDocument) { 130 if (pCS && m_pDocument) {
131 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); 131 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
132 } 132 }
133 } 133 }
134 134
135 CFX_DIBitmap* CPDF_DIBSource::GetBitmap() const {
136 return m_pCachedBitmap ? m_pCachedBitmap.get() : Clone();
137 }
138
139 void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const {
140 if (pBitmap && pBitmap != m_pCachedBitmap.get()) {
141 delete pBitmap;
142 }
143 }
144
145 bool CPDF_DIBSource::Load(CPDF_Document* pDoc, 135 bool CPDF_DIBSource::Load(CPDF_Document* pDoc,
146 const CPDF_Stream* pStream, 136 const CPDF_Stream* pStream,
147 CPDF_DIBSource** ppMask, 137 CPDF_DIBSource** ppMask,
148 uint32_t* pMatteColor, 138 uint32_t* pMatteColor,
149 CPDF_Dictionary* pFormResources, 139 CPDF_Dictionary* pFormResources,
150 CPDF_Dictionary* pPageResources, 140 CPDF_Dictionary* pPageResources,
151 bool bStdCS, 141 bool bStdCS,
152 uint32_t GroupFamily, 142 uint32_t GroupFamily,
153 bool bLoadMask) { 143 bool bLoadMask) {
154 if (!pStream) { 144 if (!pStream) {
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 *pDestPixel++ = FXARGB_G(argb); 1486 *pDestPixel++ = FXARGB_G(argb);
1497 *pDestPixel = FXARGB_R(argb); 1487 *pDestPixel = FXARGB_R(argb);
1498 } 1488 }
1499 } 1489 }
1500 } 1490 }
1501 1491
1502 bool CPDF_DIBSource::TransMask() const { 1492 bool CPDF_DIBSource::TransMask() const {
1503 return m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && 1493 return m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK &&
1504 m_Family == PDFCS_DEVICECMYK; 1494 m_Family == PDFCS_DEVICECMYK;
1505 } 1495 }
OLDNEW
« no previous file with comments | « core/fpdfapi/render/cpdf_type3cache.cpp ('k') | core/fpdfapi/render/render_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698