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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 rect.right -= 1; | 189 rect.right -= 1; |
190 } | 190 } |
191 matrix->TransformRect(rect); | 191 matrix->TransformRect(rect); |
192 FX_RECT re = rect.GetOutterRect(); | 192 FX_RECT re = rect.GetOutterRect(); |
193 device->FillRect(&re, m_backgroundColor); | 193 device->FillRect(&re, m_backgroundColor); |
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( |
200 CFX_GEModule::Get()->GetFontCache(), | 200 str.GetLength(), pCharPos, m_pFont, CFX_GEModule::Get()->GetFontCache(), |
201 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix, | 201 (FX_FLOAT)iFontSize, &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); |
202 m_fontColor, FXTEXT_CLEARTYPE); | |
203 } | 202 } |
204 | 203 |
205 void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, | 204 void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, |
206 const CFX_ByteString str, | 205 const CFX_ByteString str, |
207 FX_FLOAT geWidth, | 206 FX_FLOAT geWidth, |
208 FXTEXT_CHARPOS* pCharPos, | 207 FXTEXT_CHARPOS* pCharPos, |
209 FX_FLOAT locX, | 208 FX_FLOAT locX, |
210 FX_FLOAT locY, | 209 FX_FLOAT locY, |
211 int32_t barWidth) { | 210 int32_t barWidth) { |
212 int32_t iFontSize = (int32_t)fabs(m_fFontSize); | 211 int32_t iFontSize = (int32_t)fabs(m_fFontSize); |
213 int32_t iTextHeight = iFontSize + 1; | 212 int32_t iTextHeight = iFontSize + 1; |
214 CFX_FxgeDevice ge; | 213 CFX_FxgeDevice ge; |
215 ge.Create((int)geWidth, iTextHeight, m_colorSpace, nullptr); | 214 ge.Create((int)geWidth, iTextHeight, m_colorSpace, nullptr); |
216 FX_RECT geRect(0, 0, (int)geWidth, iTextHeight); | 215 FX_RECT geRect(0, 0, (int)geWidth, iTextHeight); |
217 ge.FillRect(&geRect, m_backgroundColor); | 216 ge.FillRect(&geRect, m_backgroundColor); |
218 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); | 217 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); |
219 ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont, | 218 ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont, |
220 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | 219 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, |
221 (CFX_Matrix*)&affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); | 220 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); |
222 CFX_FxgeDevice geBitmap; | 221 CFX_FxgeDevice geBitmap; |
223 geBitmap.Attach(pOutBitmap, false, nullptr, false); | 222 geBitmap.Attach(pOutBitmap, false, nullptr, false); |
224 geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY); | 223 geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY); |
225 } | 224 } |
226 | 225 |
227 void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, | 226 void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, |
228 CFX_DIBitmap* pOutBitmap, | 227 CFX_DIBitmap* pOutBitmap, |
229 CFX_RenderDevice* device, | 228 CFX_RenderDevice* device, |
230 const CFX_Matrix* matrix, | 229 const CFX_Matrix* matrix, |
231 int32_t barWidth, | 230 int32_t barWidth, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { | 428 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { |
430 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); | 429 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); |
431 break; | 430 break; |
432 } | 431 } |
433 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); | 432 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); |
434 BC_EXCEPTION_CHECK_ReturnVoid(e); | 433 BC_EXCEPTION_CHECK_ReturnVoid(e); |
435 } | 434 } |
436 outputX += m_multiple; | 435 outputX += m_multiple; |
437 } | 436 } |
438 } | 437 } |
OLD | NEW |