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 | 6 |
7 #include "pre.h" | 7 #include "pre.h" |
8 #include "fx_path_generator.h" | 8 #include "fx_path_generator.h" |
9 class CAGG_Graphics { | 9 class CAGG_Graphics { |
10 public: | 10 public: |
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1091 delete bmp1; | 1091 delete bmp1; |
1092 bmp1 = NULL; | 1092 bmp1 = NULL; |
1093 } | 1093 } |
1094 } | 1094 } |
1095 return FX_ERR_Succeeded; | 1095 return FX_ERR_Succeeded; |
1096 } | 1096 } |
1097 FX_ERR CFX_Graphics::CalcTextInfo(const CFX_WideString& text, | 1097 FX_ERR CFX_Graphics::CalcTextInfo(const CFX_WideString& text, |
1098 FX_DWORD* charCodes, | 1098 FX_DWORD* charCodes, |
1099 FXTEXT_CHARPOS* charPos, | 1099 FXTEXT_CHARPOS* charPos, |
1100 CFX_RectF& rect) { | 1100 CFX_RectF& rect) { |
1101 IFX_FontEncoding* encoding = FXGE_CreateUnicodeEncoding(_info._font); | 1101 CFX_UnicodeEncoding* encoding = new CFX_UnicodeEncoding(_info._font); |
Tom Sepez
2015/08/17 23:49:29
same here.
Lei Zhang
2015/08/18 01:36:39
Done.
| |
1102 int32_t length = text.GetLength(); | 1102 int32_t length = text.GetLength(); |
1103 FX_FLOAT penX = (FX_FLOAT)rect.left; | 1103 FX_FLOAT penX = (FX_FLOAT)rect.left; |
1104 FX_FLOAT penY = (FX_FLOAT)rect.top; | 1104 FX_FLOAT penY = (FX_FLOAT)rect.top; |
1105 FX_FLOAT left = (FX_FLOAT)(0); | 1105 FX_FLOAT left = (FX_FLOAT)(0); |
1106 FX_FLOAT top = (FX_FLOAT)(0); | 1106 FX_FLOAT top = (FX_FLOAT)(0); |
1107 charCodes[0] = text.GetAt(0); | 1107 charCodes[0] = text.GetAt(0); |
1108 charPos[0].m_OriginX = penX + left; | 1108 charPos[0].m_OriginX = penX + left; |
1109 charPos[0].m_OriginY = penY + top; | 1109 charPos[0].m_OriginY = penY + top; |
1110 charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(charCodes[0]); | 1110 charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(charCodes[0]); |
1111 charPos[0].m_FontCharWidth = FXSYS_round( | 1111 charPos[0].m_FontCharWidth = FXSYS_round( |
(...skipping 17 matching lines...) Expand all Loading... | |
1129 charPos[i].m_AdjustMatrix[0] = -1; | 1129 charPos[i].m_AdjustMatrix[0] = -1; |
1130 charPos[i].m_AdjustMatrix[1] = 0; | 1130 charPos[i].m_AdjustMatrix[1] = 0; |
1131 charPos[i].m_AdjustMatrix[2] = 0; | 1131 charPos[i].m_AdjustMatrix[2] = 0; |
1132 charPos[i].m_AdjustMatrix[3] = 1; | 1132 charPos[i].m_AdjustMatrix[3] = 1; |
1133 penX += (FX_FLOAT)(charPos[i].m_FontCharWidth) * _info._fontSize / 1000 + | 1133 penX += (FX_FLOAT)(charPos[i].m_FontCharWidth) * _info._fontSize / 1000 + |
1134 _info._fontSpacing; | 1134 _info._fontSpacing; |
1135 } | 1135 } |
1136 rect.width = (FX_FLOAT)penX - rect.left; | 1136 rect.width = (FX_FLOAT)penX - rect.left; |
1137 rect.height = rect.top + _info._fontSize * _info._fontHScale - rect.top; | 1137 rect.height = rect.top + _info._fontSize * _info._fontHScale - rect.top; |
1138 delete encoding; | 1138 delete encoding; |
1139 encoding = NULL; | 1139 encoding = NULL; |
Tom Sepez
2015/08/17 23:49:29
and here. Looks like there's some duplication for
Lei Zhang
2015/08/18 01:36:39
Done.
| |
1140 return FX_ERR_Succeeded; | 1140 return FX_ERR_Succeeded; |
1141 } | 1141 } |
1142 CAGG_Graphics::CAGG_Graphics() { | 1142 CAGG_Graphics::CAGG_Graphics() { |
1143 _owner = NULL; | 1143 _owner = NULL; |
1144 } | 1144 } |
1145 FX_ERR CAGG_Graphics::Create(CFX_Graphics* owner, | 1145 FX_ERR CAGG_Graphics::Create(CFX_Graphics* owner, |
1146 int32_t width, | 1146 int32_t width, |
1147 int32_t height, | 1147 int32_t height, |
1148 FXDIB_Format format) { | 1148 FXDIB_Format format) { |
1149 if (owner->_renderDevice) { | 1149 if (owner->_renderDevice) { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1450 b3 = (int32_t)(i * bScale); | 1450 b3 = (int32_t)(i * bScale); |
1451 _argbArray[i] = | 1451 _argbArray[i] = |
1452 FXARGB_TODIB(FXARGB_MAKE((a1 + a3), (r1 + r3), (g1 + g3), (b1 + b3))); | 1452 FXARGB_TODIB(FXARGB_MAKE((a1 + a3), (r1 + r3), (g1 + g3), (b1 + b3))); |
1453 } | 1453 } |
1454 return FX_ERR_Succeeded; | 1454 return FX_ERR_Succeeded; |
1455 } | 1455 } |
1456 class CFX_Pause : public IFX_Pause { | 1456 class CFX_Pause : public IFX_Pause { |
1457 public: | 1457 public: |
1458 virtual FX_BOOL NeedToPauseNow() { return TRUE; } | 1458 virtual FX_BOOL NeedToPauseNow() { return TRUE; } |
1459 }; | 1459 }; |
OLD | NEW |