| 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" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 rcUnderline.bottom += ptOffset.y; | 129 rcUnderline.bottom += ptOffset.y; |
| 130 pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, | 130 pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, |
| 131 rcUnderline.right, rcUnderline.top); | 131 rcUnderline.right, rcUnderline.top); |
| 132 | 132 |
| 133 pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, color, 0, | 133 pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, color, 0, |
| 134 FXFILL_WINDING); | 134 FXFILL_WINDING); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 pDevice->RestoreState(); | 139 pDevice->RestoreState(false); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, | 142 void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, |
| 143 CFX_Matrix* pUser2Device, | 143 CFX_Matrix* pUser2Device, |
| 144 IFX_Edit* pEdit, | 144 IFX_Edit* pEdit, |
| 145 FX_COLORREF crTextFill, | 145 FX_COLORREF crTextFill, |
| 146 FX_COLORREF crTextStroke, | 146 FX_COLORREF crTextStroke, |
| 147 const CFX_FloatRect& rcClip, | 147 const CFX_FloatRect& rcClip, |
| 148 const CFX_FloatPoint& ptOffset, | 148 const CFX_FloatPoint& ptOffset, |
| 149 const CPVT_WordRange* pRange, | 149 const CPVT_WordRange* pRange, |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 | 254 |
| 255 if (sTextBuf.GetLength() > 0) { | 255 if (sTextBuf.GetLength() > 0) { |
| 256 DrawTextString( | 256 DrawTextString( |
| 257 pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), | 257 pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), |
| 258 pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, | 258 pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, |
| 259 sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); | 259 sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 pDevice->RestoreState(); | 263 pDevice->RestoreState(false); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, | 266 void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, |
| 267 CFX_Matrix* pUser2Device, | 267 CFX_Matrix* pUser2Device, |
| 268 IFX_Edit* pEdit, | 268 IFX_Edit* pEdit, |
| 269 const CFX_FloatRect& rcClip, | 269 const CFX_FloatRect& rcClip, |
| 270 const CFX_FloatPoint& ptOffset, | 270 const CFX_FloatPoint& ptOffset, |
| 271 const CPVT_WordRange* pRange) { | 271 const CPVT_WordRange* pRange) { |
| 272 CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); | 272 CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); |
| 273 | 273 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 } | 378 } |
| 379 | 379 |
| 380 if (sTextBuf.GetLength() > 0) { | 380 if (sTextBuf.GetLength() > 0) { |
| 381 DrawTextString( | 381 DrawTextString( |
| 382 pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), | 382 pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), |
| 383 pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, | 383 pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, |
| 384 sTextBuf.MakeString(), crOld, 0, wp.nHorzScale); | 384 sTextBuf.MakeString(), crOld, 0, wp.nHorzScale); |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 | 387 |
| 388 pDevice->RestoreState(); | 388 pDevice->RestoreState(false); |
| 389 } | 389 } |
| 390 | 390 |
| 391 static void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder, | 391 static void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder, |
| 392 FX_COLORREF crFill, | 392 FX_COLORREF crFill, |
| 393 const CFX_FloatRect& rcFill) { | 393 const CFX_FloatRect& rcFill) { |
| 394 std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject); | 394 std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject); |
| 395 CFX_PathData* pPathData = pPathObj->m_Path.GetModify(); | 395 CFX_PathData* pPathData = pPathObj->m_Path.GetModify(); |
| 396 pPathData->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, rcFill.top); | 396 pPathData->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, rcFill.top); |
| 397 | 397 |
| 398 FX_FLOAT rgb[3]; | 398 FX_FLOAT rgb[3]; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 CFX_FloatRect rcUnderline = GetUnderLineRect(word); | 623 CFX_FloatRect rcUnderline = GetUnderLineRect(word); |
| 624 rcUnderline.left += ptOffset.x; | 624 rcUnderline.left += ptOffset.x; |
| 625 rcUnderline.right += ptOffset.x; | 625 rcUnderline.right += ptOffset.x; |
| 626 rcUnderline.top += ptOffset.y; | 626 rcUnderline.top += ptOffset.y; |
| 627 rcUnderline.bottom += ptOffset.y; | 627 rcUnderline.bottom += ptOffset.y; |
| 628 AddRectToPageObjects(pObjectHolder, color, rcUnderline); | 628 AddRectToPageObjects(pObjectHolder, color, rcUnderline); |
| 629 } | 629 } |
| 630 } | 630 } |
| 631 } | 631 } |
| 632 } | 632 } |
| OLD | NEW |