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 "fpdfsdk/include/fxedit/fx_edit.h" | 7 #include "fpdfsdk/include/fxedit/fx_edit.h" |
8 #include "fpdfsdk/include/fxedit/fxet_edit.h" | 8 #include "fpdfsdk/include/fxedit/fxet_edit.h" |
9 #include "fpdfsdk/include/fxedit/fxet_stub.h" | 9 #include "fpdfsdk/include/fxedit/fxet_stub.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 word.ptWord.y + (word.fAscent + word.fDescent) * 0.5f + | 22 word.ptWord.y + (word.fAscent + word.fDescent) * 0.5f + |
23 word.fDescent * 0.25f, | 23 word.fDescent * 0.25f, |
24 word.ptWord.x + word.fWidth, | 24 word.ptWord.x + word.fWidth, |
25 word.ptWord.y + (word.fAscent + word.fDescent) * 0.5f); | 25 word.ptWord.y + (word.fAscent + word.fDescent) * 0.5f); |
26 } | 26 } |
27 | 27 |
28 static void DrawTextString(CFX_RenderDevice* pDevice, | 28 static void DrawTextString(CFX_RenderDevice* pDevice, |
29 const CPDF_Point& pt, | 29 const CPDF_Point& pt, |
30 CPDF_Font* pFont, | 30 CPDF_Font* pFont, |
31 FX_FLOAT fFontSize, | 31 FX_FLOAT fFontSize, |
32 CPDF_Matrix* pUser2Device, | 32 CFX_Matrix* pUser2Device, |
33 const CFX_ByteString& str, | 33 const CFX_ByteString& str, |
34 FX_ARGB crTextFill, | 34 FX_ARGB crTextFill, |
35 FX_ARGB crTextStroke, | 35 FX_ARGB crTextStroke, |
36 int32_t nHorzScale) { | 36 int32_t nHorzScale) { |
37 FX_FLOAT x = pt.x, y = pt.y; | 37 FX_FLOAT x = pt.x, y = pt.y; |
38 pUser2Device->Transform(x, y); | 38 pUser2Device->Transform(x, y); |
39 | 39 |
40 if (pFont) { | 40 if (pFont) { |
41 if (nHorzScale != 100) { | 41 if (nHorzScale != 100) { |
42 CPDF_Matrix mt(nHorzScale / 100.0f, 0, 0, 1, 0, 0); | 42 CFX_Matrix mt(nHorzScale / 100.0f, 0, 0, 1, 0, 0); |
43 mt.Concat(*pUser2Device); | 43 mt.Concat(*pUser2Device); |
44 | 44 |
45 CPDF_RenderOptions ro; | 45 CPDF_RenderOptions ro; |
46 ro.m_Flags = RENDER_CLEARTYPE; | 46 ro.m_Flags = RENDER_CLEARTYPE; |
47 ro.m_ColorMode = RENDER_COLOR_NORMAL; | 47 ro.m_ColorMode = RENDER_COLOR_NORMAL; |
48 | 48 |
49 if (crTextStroke != 0) { | 49 if (crTextStroke != 0) { |
50 CPDF_Point pt1(0, 0), pt2(1, 0); | 50 CPDF_Point pt1(0, 0), pt2(1, 0); |
51 pUser2Device->Transform(pt1.x, pt1.y); | 51 pUser2Device->Transform(pt1.x, pt1.y); |
52 pUser2Device->Transform(pt2.x, pt2.y); | 52 pUser2Device->Transform(pt2.x, pt2.y); |
(...skipping 25 matching lines...) Expand all Loading... |
78 crTextStroke, &gsd, &ro); | 78 crTextStroke, &gsd, &ro); |
79 } else | 79 } else |
80 CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, | 80 CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, |
81 pUser2Device, str, crTextFill, 0, | 81 pUser2Device, str, crTextFill, 0, |
82 NULL, &ro); | 82 NULL, &ro); |
83 } | 83 } |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, | 87 void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, |
88 CPDF_Matrix* pUser2Device, | 88 CFX_Matrix* pUser2Device, |
89 IFX_Edit* pEdit, | 89 IFX_Edit* pEdit, |
90 FX_COLORREF color, | 90 FX_COLORREF color, |
91 const CPDF_Rect& rcClip, | 91 const CPDF_Rect& rcClip, |
92 const CPDF_Point& ptOffset, | 92 const CPDF_Point& ptOffset, |
93 const CPVT_WordRange* pRange) { | 93 const CPVT_WordRange* pRange) { |
94 pDevice->SaveState(); | 94 pDevice->SaveState(); |
95 | 95 |
96 if (!rcClip.IsEmpty()) { | 96 if (!rcClip.IsEmpty()) { |
97 CPDF_Rect rcTemp = rcClip; | 97 CPDF_Rect rcTemp = rcClip; |
98 pUser2Device->TransformRect(rcTemp); | 98 pUser2Device->TransformRect(rcTemp); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 FXFILL_WINDING); | 131 FXFILL_WINDING); |
132 } | 132 } |
133 } | 133 } |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 pDevice->RestoreState(); | 137 pDevice->RestoreState(); |
138 } | 138 } |
139 | 139 |
140 void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, | 140 void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, |
141 CPDF_Matrix* pUser2Device, | 141 CFX_Matrix* pUser2Device, |
142 IFX_Edit* pEdit, | 142 IFX_Edit* pEdit, |
143 FX_COLORREF crTextFill, | 143 FX_COLORREF crTextFill, |
144 FX_COLORREF crTextStroke, | 144 FX_COLORREF crTextStroke, |
145 const CPDF_Rect& rcClip, | 145 const CPDF_Rect& rcClip, |
146 const CPDF_Point& ptOffset, | 146 const CPDF_Point& ptOffset, |
147 const CPVT_WordRange* pRange, | 147 const CPVT_WordRange* pRange, |
148 IFX_SystemHandler* pSystemHandler, | 148 IFX_SystemHandler* pSystemHandler, |
149 void* pFFLData) { | 149 void* pFFLData) { |
150 FX_BOOL bContinuous = pEdit->GetCharArray() == 0; | 150 FX_BOOL bContinuous = pEdit->GetCharArray() == 0; |
151 if (pEdit->GetCharSpace() > 0.0f) | 151 if (pEdit->GetCharSpace() > 0.0f) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, | 270 pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, |
271 sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); | 271 sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); |
272 } | 272 } |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 pDevice->RestoreState(); | 276 pDevice->RestoreState(); |
277 } | 277 } |
278 | 278 |
279 void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, | 279 void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, |
280 CPDF_Matrix* pUser2Device, | 280 CFX_Matrix* pUser2Device, |
281 IFX_Edit* pEdit, | 281 IFX_Edit* pEdit, |
282 const CPDF_Rect& rcClip, | 282 const CPDF_Rect& rcClip, |
283 const CPDF_Point& ptOffset, | 283 const CPDF_Point& ptOffset, |
284 const CPVT_WordRange* pRange) { | 284 const CPVT_WordRange* pRange) { |
285 // FX_FLOAT fFontSize = pEdit->GetFontSize(); | 285 // FX_FLOAT fFontSize = pEdit->GetFontSize(); |
286 CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); | 286 CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); |
287 | 287 |
288 FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0); | 288 FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0); |
289 FX_COLORREF crOld = crCurText; | 289 FX_COLORREF crOld = crCurText; |
290 FX_BOOL bSelect = FALSE; | 290 FX_BOOL bSelect = FALSE; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 rcUnderline.left += ptOffset.x; | 658 rcUnderline.left += ptOffset.x; |
659 rcUnderline.right += ptOffset.x; | 659 rcUnderline.right += ptOffset.x; |
660 rcUnderline.top += ptOffset.y; | 660 rcUnderline.top += ptOffset.y; |
661 rcUnderline.bottom += ptOffset.y; | 661 rcUnderline.bottom += ptOffset.y; |
662 AddRectToPageObjects(pPageObjects, color, rcUnderline); | 662 AddRectToPageObjects(pPageObjects, color, rcUnderline); |
663 } | 663 } |
664 } | 664 } |
665 } | 665 } |
666 } | 666 } |
667 } | 667 } |
OLD | NEW |