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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 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, |
195 (FX_FLOAT)(locY + iFontSize)); | 195 (FX_FLOAT)(locY + iFontSize)); |
196 if (matrix) { | 196 if (matrix) { |
197 affine_matrix.Concat(*matrix); | 197 affine_matrix.Concat(*matrix); |
198 } | 198 } |
199 device->DrawNormalText(str.GetLength(), pCharPos, m_pFont, | 199 device->DrawNormalText(str.GetLength(), pCharPos, m_pFont, |
200 CFX_GEModule::Get()->GetFontCache(), | 200 CFX_GEModule::Get()->GetFontCache(), |
201 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix, | 201 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix, |
202 m_fontColor, FXTEXT_CLEARTYPE); | 202 m_fontColor, FXTEXT_CLEARTYPE); |
203 } | 203 } |
| 204 |
204 void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, | 205 void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, |
205 const CFX_ByteString str, | 206 const CFX_ByteString str, |
206 FX_FLOAT geWidth, | 207 FX_FLOAT geWidth, |
207 FXTEXT_CHARPOS* pCharPos, | 208 FXTEXT_CHARPOS* pCharPos, |
208 FX_FLOAT locX, | 209 FX_FLOAT locX, |
209 FX_FLOAT locY, | 210 FX_FLOAT locY, |
210 int32_t barWidth) { | 211 int32_t barWidth) { |
211 int32_t iFontSize = (int32_t)fabs(m_fFontSize); | 212 int32_t iFontSize = (int32_t)fabs(m_fFontSize); |
212 int32_t iTextHeight = iFontSize + 1; | 213 int32_t iTextHeight = iFontSize + 1; |
213 CFX_FxgeDevice ge; | 214 CFX_FxgeDevice ge; |
214 ge.Create((int)geWidth, iTextHeight, m_colorSpace); | 215 ge.Create((int)geWidth, iTextHeight, m_colorSpace, nullptr); |
215 FX_RECT geRect(0, 0, (int)geWidth, iTextHeight); | 216 FX_RECT geRect(0, 0, (int)geWidth, iTextHeight); |
216 ge.FillRect(&geRect, m_backgroundColor); | 217 ge.FillRect(&geRect, m_backgroundColor); |
217 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); | 218 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); |
218 ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont, | 219 ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont, |
219 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | 220 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, |
220 (CFX_Matrix*)&affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); | 221 (CFX_Matrix*)&affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); |
221 CFX_FxgeDevice geBitmap; | 222 CFX_FxgeDevice geBitmap; |
222 geBitmap.Attach(pOutBitmap); | 223 geBitmap.Attach(pOutBitmap, false, nullptr, false); |
223 geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY); | 224 geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY); |
224 } | 225 } |
| 226 |
225 void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, | 227 void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, |
226 CFX_DIBitmap* pOutBitmap, | 228 CFX_DIBitmap* pOutBitmap, |
227 CFX_RenderDevice* device, | 229 CFX_RenderDevice* device, |
228 const CFX_Matrix* matrix, | 230 const CFX_Matrix* matrix, |
229 int32_t barWidth, | 231 int32_t barWidth, |
230 int32_t multiple, | 232 int32_t multiple, |
231 int32_t& e) { | 233 int32_t& e) { |
232 if (device == NULL && pOutBitmap == NULL) { | 234 if (!device && !pOutBitmap) { |
233 e = BCExceptionIllegalArgument; | 235 e = BCExceptionIllegalArgument; |
234 return; | 236 return; |
235 } | 237 } |
236 if (m_pFont == NULL) { | 238 if (!m_pFont) { |
237 e = BCExceptionNullPointer; | 239 e = BCExceptionNullPointer; |
238 return; | 240 return; |
239 } | 241 } |
240 CFX_ByteString str = FX_UTF8Encode(contents); | 242 CFX_ByteString str = FX_UTF8Encode(contents); |
241 int32_t iLen = str.GetLength(); | 243 int32_t iLen = str.GetLength(); |
242 FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen); | 244 FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen); |
243 FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen); | 245 FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen); |
244 FX_FLOAT charsLen = 0; | 246 FX_FLOAT charsLen = 0; |
245 FX_FLOAT geWidth = 0; | 247 FX_FLOAT geWidth = 0; |
246 if (m_locTextLoc == BC_TEXT_LOC_ABOVEEMBED || | 248 if (m_locTextLoc == BC_TEXT_LOC_ABOVEEMBED || |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { | 430 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { |
429 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); | 431 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); |
430 break; | 432 break; |
431 } | 433 } |
432 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); | 434 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); |
433 BC_EXCEPTION_CHECK_ReturnVoid(e); | 435 BC_EXCEPTION_CHECK_ReturnVoid(e); |
434 } | 436 } |
435 outputX += m_multiple; | 437 outputX += m_multiple; |
436 } | 438 } |
437 } | 439 } |
OLD | NEW |