| 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 // 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 25 matching lines...) Expand all Loading... |
| 36 m_pFont = NULL; | 36 m_pFont = NULL; |
| 37 m_fFontSize = 10; | 37 m_fFontSize = 10; |
| 38 m_iFontStyle = 0; | 38 m_iFontStyle = 0; |
| 39 m_fontColor = 0xff000000; | 39 m_fontColor = 0xff000000; |
| 40 m_iContentLen = 0; | 40 m_iContentLen = 0; |
| 41 m_bLeftPadding = FALSE; | 41 m_bLeftPadding = FALSE; |
| 42 m_bRightPadding = FALSE; | 42 m_bRightPadding = FALSE; |
| 43 m_output = NULL; | 43 m_output = NULL; |
| 44 } | 44 } |
| 45 CBC_OneDimWriter::~CBC_OneDimWriter() { | 45 CBC_OneDimWriter::~CBC_OneDimWriter() { |
| 46 if (m_output != NULL) { | 46 delete m_output; |
| 47 delete m_output; | |
| 48 m_output = NULL; | |
| 49 } | |
| 50 } | 47 } |
| 51 void CBC_OneDimWriter::SetPrintChecksum(FX_BOOL checksum) { | 48 void CBC_OneDimWriter::SetPrintChecksum(FX_BOOL checksum) { |
| 52 m_bPrintChecksum = checksum; | 49 m_bPrintChecksum = checksum; |
| 53 } | 50 } |
| 54 void CBC_OneDimWriter::SetDataLength(int32_t length) { | 51 void CBC_OneDimWriter::SetDataLength(int32_t length) { |
| 55 m_iDataLenth = length; | 52 m_iDataLenth = length; |
| 56 } | 53 } |
| 57 void CBC_OneDimWriter::SetCalcChecksum(int32_t state) { | 54 void CBC_OneDimWriter::SetCalcChecksum(int32_t state) { |
| 58 m_bCalcChecksum = state; | 55 m_bCalcChecksum = state; |
| 59 } | 56 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 CFX_FloatRect rect((FX_FLOAT)locX, (FX_FLOAT)locY, (FX_FLOAT)(locX + geWidth), | 186 CFX_FloatRect rect((FX_FLOAT)locX, (FX_FLOAT)locY, (FX_FLOAT)(locX + geWidth), |
| 190 (FX_FLOAT)(locY + iTextHeight)); | 187 (FX_FLOAT)(locY + iTextHeight)); |
| 191 if (geWidth != m_Width) { | 188 if (geWidth != m_Width) { |
| 192 rect.right -= 1; | 189 rect.right -= 1; |
| 193 } | 190 } |
| 194 matrix->TransformRect(rect); | 191 matrix->TransformRect(rect); |
| 195 FX_RECT re = rect.GetOutterRect(); | 192 FX_RECT re = rect.GetOutterRect(); |
| 196 device->FillRect(&re, m_backgroundColor); | 193 device->FillRect(&re, m_backgroundColor); |
| 197 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (FX_FLOAT)locX, | 194 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (FX_FLOAT)locX, |
| 198 (FX_FLOAT)(locY + iFontSize)); | 195 (FX_FLOAT)(locY + iFontSize)); |
| 199 if (matrix != NULL) { | 196 if (matrix) { |
| 200 affine_matrix.Concat(*matrix); | 197 affine_matrix.Concat(*matrix); |
| 201 } | 198 } |
| 202 device->DrawNormalText(str.GetLength(), pCharPos, m_pFont, | 199 device->DrawNormalText(str.GetLength(), pCharPos, m_pFont, |
| 203 CFX_GEModule::Get()->GetFontCache(), | 200 CFX_GEModule::Get()->GetFontCache(), |
| 204 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix, | 201 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix, |
| 205 m_fontColor, FXTEXT_CLEARTYPE); | 202 m_fontColor, FXTEXT_CLEARTYPE); |
| 206 } | 203 } |
| 207 void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, | 204 void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, |
| 208 const CFX_ByteString str, | 205 const CFX_ByteString str, |
| 209 FX_FLOAT geWidth, | 206 FX_FLOAT geWidth, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 locY = m_Height - iTextHeight; | 274 locY = m_Height - iTextHeight; |
| 278 geWidth = charsLen; | 275 geWidth = charsLen; |
| 279 break; | 276 break; |
| 280 case BC_TEXT_LOC_BELOW: | 277 case BC_TEXT_LOC_BELOW: |
| 281 default: | 278 default: |
| 282 locX = 0; | 279 locX = 0; |
| 283 locY = m_Height - iTextHeight; | 280 locY = m_Height - iTextHeight; |
| 284 geWidth = (FX_FLOAT)barWidth; | 281 geWidth = (FX_FLOAT)barWidth; |
| 285 break; | 282 break; |
| 286 } | 283 } |
| 287 if (device != NULL) { | 284 if (device) { |
| 288 ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (FX_FLOAT)locX, | 285 ShowDeviceChars(device, matrix, str, geWidth, pCharPos, (FX_FLOAT)locX, |
| 289 (FX_FLOAT)locY, barWidth); | 286 (FX_FLOAT)locY, barWidth); |
| 290 } else { | 287 } else { |
| 291 ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (FX_FLOAT)locX, | 288 ShowBitmapChars(pOutBitmap, str, geWidth, pCharPos, (FX_FLOAT)locX, |
| 292 (FX_FLOAT)locY, barWidth); | 289 (FX_FLOAT)locY, barWidth); |
| 293 } | 290 } |
| 294 FX_Free(pCharPos); | 291 FX_Free(pCharPos); |
| 295 } | 292 } |
| 296 void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap, | 293 void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap, |
| 297 const CFX_WideStringC& contents, | 294 const CFX_WideStringC& contents, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { | 428 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { |
| 432 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); | 429 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); |
| 433 break; | 430 break; |
| 434 } | 431 } |
| 435 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); | 432 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); |
| 436 BC_EXCEPTION_CHECK_ReturnVoid(e); | 433 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 437 } | 434 } |
| 438 outputX += m_multiple; | 435 outputX += m_multiple; |
| 439 } | 436 } |
| 440 } | 437 } |
| OLD | NEW |