| 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 "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" | 7 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" |
| 8 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" | 8 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" |
| 9 #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" |
| 10 #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h" |
| 11 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" | 11 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" |
| 12 #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" | 12 #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" |
| 13 #include "core/fpdfdoc/include/cpvt_word.h" |
| 14 #include "core/fpdfdoc/include/ipvt_fontmap.h" |
| 13 #include "core/include/fxge/fx_ge.h" | 15 #include "core/include/fxge/fx_ge.h" |
| 14 #include "fpdfsdk/include/fx_systemhandler.h" | 16 #include "fpdfsdk/include/fx_systemhandler.h" |
| 15 #include "fpdfsdk/include/fxedit/fx_edit.h" | 17 #include "fpdfsdk/include/fxedit/fx_edit.h" |
| 16 #include "fpdfsdk/include/fxedit/fxet_edit.h" | 18 #include "fpdfsdk/include/fxedit/fxet_edit.h" |
| 17 | 19 |
| 18 #define FX_EDIT_UNDERLINEHALFWIDTH 0.5f | 20 #define FX_EDIT_UNDERLINEHALFWIDTH 0.5f |
| 19 #define FX_EDIT_CROSSOUTHALFWIDTH 0.5f | 21 #define FX_EDIT_CROSSOUTHALFWIDTH 0.5f |
| 20 | 22 |
| 21 CFX_FloatRect GetUnderLineRect(const CPVT_Word& word) { | 23 CFX_FloatRect GetUnderLineRect(const CPVT_Word& word) { |
| 22 return CFX_FloatRect(word.ptWord.x, word.ptWord.y + word.fDescent * 0.5f, | 24 return CFX_FloatRect(word.ptWord.x, word.ptWord.y + word.fDescent * 0.5f, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 173 |
| 172 pDevice->SaveState(); | 174 pDevice->SaveState(); |
| 173 | 175 |
| 174 if (!rcClip.IsEmpty()) { | 176 if (!rcClip.IsEmpty()) { |
| 175 CFX_FloatRect rcTemp = rcClip; | 177 CFX_FloatRect rcTemp = rcClip; |
| 176 pUser2Device->TransformRect(rcTemp); | 178 pUser2Device->TransformRect(rcTemp); |
| 177 pDevice->SetClip_Rect(rcTemp.ToFxRect()); | 179 pDevice->SetClip_Rect(rcTemp.ToFxRect()); |
| 178 } | 180 } |
| 179 | 181 |
| 180 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { | 182 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { |
| 181 if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { | 183 if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) { |
| 182 if (pRange) | 184 if (pRange) |
| 183 pIterator->SetAt(pRange->BeginPos); | 185 pIterator->SetAt(pRange->BeginPos); |
| 184 else | 186 else |
| 185 pIterator->SetAt(0); | 187 pIterator->SetAt(0); |
| 186 | 188 |
| 187 CPVT_WordPlace oldplace; | 189 CPVT_WordPlace oldplace; |
| 188 | 190 |
| 189 while (pIterator->NextWord()) { | 191 while (pIterator->NextWord()) { |
| 190 CPVT_WordPlace place = pIterator->GetAt(); | 192 CPVT_WordPlace place = pIterator->GetAt(); |
| 191 if (pRange && place.WordCmp(pRange->EndPos) > 0) | 193 if (pRange && place.WordCmp(pRange->EndPos) > 0) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 294 |
| 293 pDevice->SaveState(); | 295 pDevice->SaveState(); |
| 294 | 296 |
| 295 if (!rcClip.IsEmpty()) { | 297 if (!rcClip.IsEmpty()) { |
| 296 CFX_FloatRect rcTemp = rcClip; | 298 CFX_FloatRect rcTemp = rcClip; |
| 297 pUser2Device->TransformRect(rcTemp); | 299 pUser2Device->TransformRect(rcTemp); |
| 298 pDevice->SetClip_Rect(rcTemp.ToFxRect()); | 300 pDevice->SetClip_Rect(rcTemp.ToFxRect()); |
| 299 } | 301 } |
| 300 | 302 |
| 301 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { | 303 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { |
| 302 if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { | 304 if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) { |
| 303 if (pRange) | 305 if (pRange) |
| 304 pIterator->SetAt(pRange->BeginPos); | 306 pIterator->SetAt(pRange->BeginPos); |
| 305 else | 307 else |
| 306 pIterator->SetAt(0); | 308 pIterator->SetAt(0); |
| 307 | 309 |
| 308 CPVT_WordPlace oldplace; | 310 CPVT_WordPlace oldplace; |
| 309 | 311 |
| 310 while (pIterator->NextWord()) { | 312 while (pIterator->NextWord()) { |
| 311 CPVT_WordPlace place = pIterator->GetAt(); | 313 CPVT_WordPlace place = pIterator->GetAt(); |
| 312 if (pRange && place.WordCmp(pRange->EndPos) > 0) | 314 if (pRange && place.WordCmp(pRange->EndPos) > 0) |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 FX_FLOAT fFontSize = pEdit->GetFontSize(); | 468 FX_FLOAT fFontSize = pEdit->GetFontSize(); |
| 467 | 469 |
| 468 int32_t nOldFontIndex = -1; | 470 int32_t nOldFontIndex = -1; |
| 469 | 471 |
| 470 CFX_ByteTextBuf sTextBuf; | 472 CFX_ByteTextBuf sTextBuf; |
| 471 CFX_FloatPoint ptBT(0.0f, 0.0f); | 473 CFX_FloatPoint ptBT(0.0f, 0.0f); |
| 472 | 474 |
| 473 ObjArray.RemoveAll(); | 475 ObjArray.RemoveAll(); |
| 474 | 476 |
| 475 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { | 477 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { |
| 476 if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { | 478 if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) { |
| 477 if (pRange) | 479 if (pRange) |
| 478 pIterator->SetAt(pRange->BeginPos); | 480 pIterator->SetAt(pRange->BeginPos); |
| 479 else | 481 else |
| 480 pIterator->SetAt(0); | 482 pIterator->SetAt(0); |
| 481 | 483 |
| 482 CPVT_WordPlace oldplace; | 484 CPVT_WordPlace oldplace; |
| 483 | 485 |
| 484 while (pIterator->NextWord()) { | 486 while (pIterator->NextWord()) { |
| 485 CPVT_WordPlace place = pIterator->GetAt(); | 487 CPVT_WordPlace place = pIterator->GetAt(); |
| 486 if (pRange && place.WordCmp(pRange->EndPos) > 0) | 488 if (pRange && place.WordCmp(pRange->EndPos) > 0) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0); | 532 FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0); |
| 531 FX_COLORREF crOld = crCurText; | 533 FX_COLORREF crOld = crCurText; |
| 532 | 534 |
| 533 CFX_ByteTextBuf sTextBuf; | 535 CFX_ByteTextBuf sTextBuf; |
| 534 CPVT_WordProps wp; | 536 CPVT_WordProps wp; |
| 535 CFX_FloatPoint ptBT(0.0f, 0.0f); | 537 CFX_FloatPoint ptBT(0.0f, 0.0f); |
| 536 | 538 |
| 537 ObjArray.RemoveAll(); | 539 ObjArray.RemoveAll(); |
| 538 | 540 |
| 539 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { | 541 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { |
| 540 if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { | 542 if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) { |
| 541 if (pRange) | 543 if (pRange) |
| 542 pIterator->SetAt(pRange->BeginPos); | 544 pIterator->SetAt(pRange->BeginPos); |
| 543 else | 545 else |
| 544 pIterator->SetAt(0); | 546 pIterator->SetAt(0); |
| 545 | 547 |
| 546 CPVT_WordPlace oldplace; | 548 CPVT_WordPlace oldplace; |
| 547 | 549 |
| 548 while (pIterator->NextWord()) { | 550 while (pIterator->NextWord()) { |
| 549 CPVT_WordPlace place = pIterator->GetAt(); | 551 CPVT_WordPlace place = pIterator->GetAt(); |
| 550 if (pRange && place.WordCmp(pRange->EndPos) > 0) | 552 if (pRange && place.WordCmp(pRange->EndPos) > 0) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 rcUnderline.left += ptOffset.x; | 642 rcUnderline.left += ptOffset.x; |
| 641 rcUnderline.right += ptOffset.x; | 643 rcUnderline.right += ptOffset.x; |
| 642 rcUnderline.top += ptOffset.y; | 644 rcUnderline.top += ptOffset.y; |
| 643 rcUnderline.bottom += ptOffset.y; | 645 rcUnderline.bottom += ptOffset.y; |
| 644 AddRectToPageObjects(pObjectHolder, color, rcUnderline); | 646 AddRectToPageObjects(pObjectHolder, color, rcUnderline); |
| 645 } | 647 } |
| 646 } | 648 } |
| 647 } | 649 } |
| 648 } | 650 } |
| 649 } | 651 } |
| OLD | NEW |