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

Side by Side Diff: xfa/fxbarcode/BC_TwoDimWriter.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/fxge/win32/fx_win32_gdipext.cpp ('k') | xfa/fxbarcode/oned/BC_OneDimWriter.cpp » ('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 <algorithm> 7 #include <algorithm>
8 8
9 #include "core/fxge/cfx_graphstatedata.h" 9 #include "core/fxge/cfx_graphstatedata.h"
10 #include "core/fxge/cfx_pathdata.h" 10 #include "core/fxge/cfx_pathdata.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 topPos = (m_Height - m_output->GetHeight()) / 2; 75 topPos = (m_Height - m_output->GetHeight()) / 2;
76 } 76 }
77 for (int32_t x = 0; x < m_output->GetWidth(); x++) { 77 for (int32_t x = 0; x < m_output->GetWidth(); x++) {
78 for (int32_t y = 0; y < m_output->GetHeight(); y++) { 78 for (int32_t y = 0; y < m_output->GetHeight(); y++) {
79 if (m_output->Get(x, y)) { 79 if (m_output->Get(x, y)) {
80 pOutBitmap->SetPixel(leftPos + x, topPos + y, m_barColor); 80 pOutBitmap->SetPixel(leftPos + x, topPos + y, m_barColor);
81 } 81 }
82 } 82 }
83 } 83 }
84 if (!m_bFixedSize) { 84 if (!m_bFixedSize) {
85 CFX_DIBitmap* pStretchBitmap = pOutBitmap->StretchTo(m_Width, m_Height); 85 std::unique_ptr<CFX_DIBitmap> pStretchBitmap =
86 pOutBitmap->StretchTo(m_Width, m_Height);
86 delete pOutBitmap; 87 delete pOutBitmap;
87 pOutBitmap = pStretchBitmap; 88 pOutBitmap = pStretchBitmap.release();
88 } 89 }
89 } 90 }
90 91
91 void CBC_TwoDimWriter::RenderResult(uint8_t* code, 92 void CBC_TwoDimWriter::RenderResult(uint8_t* code,
92 int32_t codeWidth, 93 int32_t codeWidth,
93 int32_t codeHeight, 94 int32_t codeHeight,
94 int32_t& e) { 95 int32_t& e) {
95 int32_t inputWidth = codeWidth; 96 int32_t inputWidth = codeWidth;
96 int32_t inputHeight = codeHeight; 97 int32_t inputHeight = codeHeight;
97 int32_t tempWidth = inputWidth + 2; 98 int32_t tempWidth = inputWidth + 2;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 for (int32_t inputX = 0, outputX = leftPadding; 142 for (int32_t inputX = 0, outputX = leftPadding;
142 (inputX < inputWidth) && (outputX < outputWidth - multiX); 143 (inputX < inputWidth) && (outputX < outputWidth - multiX);
143 inputX++, outputX += multiX) { 144 inputX++, outputX += multiX) {
144 if (code[inputX + inputY * inputWidth] == 1) { 145 if (code[inputX + inputY * inputWidth] == 1) {
145 m_output->SetRegion(outputX, outputY, multiX, multiY, e); 146 m_output->SetRegion(outputX, outputY, multiX, multiY, e);
146 BC_EXCEPTION_CHECK_ReturnVoid(e); 147 BC_EXCEPTION_CHECK_ReturnVoid(e);
147 } 148 }
148 } 149 }
149 } 150 }
150 } 151 }
OLDNEW
« no previous file with comments | « core/fxge/win32/fx_win32_gdipext.cpp ('k') | xfa/fxbarcode/oned/BC_OneDimWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698