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

Side by Side Diff: xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp

Issue 1726373002: Remove foo != NULL checks in xfa/src/fxbarcode. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 10 months 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
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 // Original code is licensed as follows: 6 // Original code is licensed as follows:
7 /* 7 /*
8 * Copyright 2011 ZXing authors 8 * Copyright 2011 ZXing authors
9 * 9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * Licensed under the Apache License, Version 2.0 (the "License");
(...skipping 27 matching lines...) Expand all
38 m_fFontSize = 10; 38 m_fFontSize = 10;
39 ; 39 ;
40 m_iFontStyle = 0; 40 m_iFontStyle = 0;
41 m_fontColor = 0xff000000; 41 m_fontColor = 0xff000000;
42 m_iContentLen = 0; 42 m_iContentLen = 0;
43 m_bLeftPadding = FALSE; 43 m_bLeftPadding = FALSE;
44 m_bRightPadding = FALSE; 44 m_bRightPadding = FALSE;
45 m_output = NULL; 45 m_output = NULL;
46 } 46 }
47 CBC_OneDimWriter::~CBC_OneDimWriter() { 47 CBC_OneDimWriter::~CBC_OneDimWriter() {
48 if (m_output != NULL) { 48 delete m_output;
49 delete m_output;
50 m_output = NULL;
51 }
52 } 49 }
53 void CBC_OneDimWriter::SetPrintChecksum(FX_BOOL checksum) { 50 void CBC_OneDimWriter::SetPrintChecksum(FX_BOOL checksum) {
54 m_bPrintChecksum = checksum; 51 m_bPrintChecksum = checksum;
55 } 52 }
56 void CBC_OneDimWriter::SetDataLength(int32_t length) { 53 void CBC_OneDimWriter::SetDataLength(int32_t length) {
57 m_iDataLenth = length; 54 m_iDataLenth = length;
58 } 55 }
59 void CBC_OneDimWriter::SetCalcChecksum(int32_t state) { 56 void CBC_OneDimWriter::SetCalcChecksum(int32_t state) {
60 m_bCalcChecksum = state; 57 m_bCalcChecksum = state;
61 } 58 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 CFX_FloatRect rect((FX_FLOAT)locX, (FX_FLOAT)locY, (FX_FLOAT)(locX + geWidth), 188 CFX_FloatRect rect((FX_FLOAT)locX, (FX_FLOAT)locY, (FX_FLOAT)(locX + geWidth),
192 (FX_FLOAT)(locY + iTextHeight)); 189 (FX_FLOAT)(locY + iTextHeight));
193 if (geWidth != m_Width) { 190 if (geWidth != m_Width) {
194 rect.right -= 1; 191 rect.right -= 1;
195 } 192 }
196 matrix->TransformRect(rect); 193 matrix->TransformRect(rect);
197 FX_RECT re = rect.GetOutterRect(); 194 FX_RECT re = rect.GetOutterRect();
198 device->FillRect(&re, m_backgroundColor); 195 device->FillRect(&re, m_backgroundColor);
199 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (FX_FLOAT)locX, 196 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (FX_FLOAT)locX,
200 (FX_FLOAT)(locY + iFontSize)); 197 (FX_FLOAT)(locY + iFontSize));
201 if (matrix != NULL) { 198 if (matrix) {
202 affine_matrix.Concat(*matrix); 199 affine_matrix.Concat(*matrix);
203 } 200 }
204 device->DrawNormalText(str.GetLength(), pCharPos, m_pFont, 201 device->DrawNormalText(str.GetLength(), pCharPos, m_pFont,
205 CFX_GEModule::Get()->GetFontCache(), 202 CFX_GEModule::Get()->GetFontCache(),
206 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix, 203 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix,
207 m_fontColor, FXTEXT_CLEARTYPE); 204 m_fontColor, FXTEXT_CLEARTYPE);
208 } 205 }
209 void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, 206 void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap,
210 const CFX_ByteString str, 207 const CFX_ByteString str,
211 FX_FLOAT geWidth, 208 FX_FLOAT geWidth,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 locY = m_Height - iTextHeight; 276 locY = m_Height - iTextHeight;
280 geWidth = charsLen; 277 geWidth = charsLen;
281 break; 278 break;
282 case BC_TEXT_LOC_BELOW: 279 case BC_TEXT_LOC_BELOW:
283 default: 280 default:
284 locX = 0; 281 locX = 0;
285 locY = m_Height - iTextHeight; 282 locY = m_Height - iTextHeight;
286 geWidth = (FX_FLOAT)barWidth; 283 geWidth = (FX_FLOAT)barWidth;
287 break; 284 break;
288 } 285 }
289 if (device != NULL) { 286 if (device) {
290 ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (FX_FLOAT)locX, 287 ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (FX_FLOAT)locX,
291 (FX_FLOAT)locY, barWidth); 288 (FX_FLOAT)locY, barWidth);
292 } else { 289 } else {
293 ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (FX_FLOAT)locX, 290 ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (FX_FLOAT)locX,
294 (FX_FLOAT)locY, barWidth); 291 (FX_FLOAT)locY, barWidth);
295 } 292 }
296 FX_Free(pCharPos); 293 FX_Free(pCharPos);
297 } 294 }
298 void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap, 295 void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap,
299 const CFX_WideStringC& contents, 296 const CFX_WideStringC& contents,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { 430 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) {
434 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); 431 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e);
435 break; 432 break;
436 } 433 }
437 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); 434 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e);
438 BC_EXCEPTION_CHECK_ReturnVoid(e); 435 BC_EXCEPTION_CHECK_ReturnVoid(e);
439 } 436 }
440 outputX += m_multiple; 437 outputX += m_multiple;
441 } 438 }
442 } 439 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698