Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: xfa/fde/tto/fde_textout.cpp

Issue 2031873003: Get rid of NULLs in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_fpdfsdk
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fde/fde_visualset.h ('k') | xfa/fde/xml/fde_xml_imp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "xfa/fde/tto/fde_textout.h" 7 #include "xfa/fde/tto/fde_textout.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "core/fxcrt/include/fx_coordinates.h" 11 #include "core/fxcrt/include/fx_coordinates.h"
12 #include "core/fxcrt/include/fx_system.h" 12 #include "core/fxcrt/include/fx_system.h"
13 #include "xfa/fde/cfde_path.h" 13 #include "xfa/fde/cfde_path.h"
14 #include "xfa/fde/fde_gedevice.h" 14 #include "xfa/fde/fde_gedevice.h"
15 #include "xfa/fde/fde_object.h" 15 #include "xfa/fde/fde_object.h"
16 #include "xfa/fgas/crt/fgas_memory.h" 16 #include "xfa/fgas/crt/fgas_memory.h"
17 #include "xfa/fgas/crt/fgas_utils.h" 17 #include "xfa/fgas/crt/fgas_utils.h"
18 #include "xfa/fgas/layout/fgas_textbreak.h" 18 #include "xfa/fgas/layout/fgas_textbreak.h"
19 19
20 CFDE_TextOut::CFDE_TextOut() 20 CFDE_TextOut::CFDE_TextOut()
21 : m_pFont(NULL), 21 : m_pFont(nullptr),
22 m_fFontSize(12.0f), 22 m_fFontSize(12.0f),
23 m_fLineSpace(m_fFontSize), 23 m_fLineSpace(m_fFontSize),
24 m_fLinePos(0.0f), 24 m_fLinePos(0.0f),
25 m_fTolerance(0.0f), 25 m_fTolerance(0.0f),
26 m_iAlignment(0), 26 m_iAlignment(0),
27 m_iTxtBkAlignment(0), 27 m_iTxtBkAlignment(0),
28 m_pCharWidths(NULL), 28 m_pCharWidths(nullptr),
29 m_iChars(0), 29 m_iChars(0),
30 m_pEllCharWidths(NULL), 30 m_pEllCharWidths(nullptr),
31 m_iEllChars(0), 31 m_iEllChars(0),
32 m_wParagraphBkChar(L'\n'), 32 m_wParagraphBkChar(L'\n'),
33 m_TxtColor(0xFF000000), 33 m_TxtColor(0xFF000000),
34 m_dwStyles(0), 34 m_dwStyles(0),
35 m_dwTxtBkStyles(0), 35 m_dwTxtBkStyles(0),
36 m_bElliChanged(FALSE), 36 m_bElliChanged(FALSE),
37 m_iEllipsisWidth(0), 37 m_iEllipsisWidth(0),
38 m_ttoLines(5), 38 m_ttoLines(5),
39 m_iCurLine(0), 39 m_iCurLine(0),
40 m_iCurPiece(0), 40 m_iCurPiece(0),
41 m_iTotalLines(0), 41 m_iTotalLines(0),
42 m_pCharPos(NULL), 42 m_pCharPos(nullptr),
43 m_iCharPosSize(0) { 43 m_iCharPosSize(0) {
44 m_pTxtBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None); 44 m_pTxtBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None);
45 m_Matrix.SetIdentity(); 45 m_Matrix.SetIdentity();
46 m_rtClip.Reset(); 46 m_rtClip.Reset();
47 m_rtLogicClip.Reset(); 47 m_rtLogicClip.Reset();
48 } 48 }
49 CFDE_TextOut::~CFDE_TextOut() { 49 CFDE_TextOut::~CFDE_TextOut() {
50 delete m_pTxtBreak; 50 delete m_pTxtBreak;
51 FX_Free(m_pCharWidths); 51 FX_Free(m_pCharWidths);
52 FX_Free(m_pEllCharWidths); 52 FX_Free(m_pEllCharWidths);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 CFX_RectF rtText; 184 CFX_RectF rtText;
185 rtText.Set((FX_FLOAT)rect.left, (FX_FLOAT)rect.top, (FX_FLOAT)rect.Width(), 185 rtText.Set((FX_FLOAT)rect.left, (FX_FLOAT)rect.top, (FX_FLOAT)rect.Width(),
186 (FX_FLOAT)rect.Height()); 186 (FX_FLOAT)rect.Height());
187 CalcSize(pwsStr, iLength, rtText); 187 CalcSize(pwsStr, iLength, rtText);
188 rect.Set((int32_t)rtText.left, (int32_t)rtText.top, (int32_t)rtText.Width(), 188 rect.Set((int32_t)rtText.left, (int32_t)rtText.top, (int32_t)rtText.Width(),
189 (int32_t)rtText.Height()); 189 (int32_t)rtText.Height());
190 } 190 }
191 void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr, 191 void CFDE_TextOut::CalcSize(const FX_WCHAR* pwsStr,
192 int32_t iLength, 192 int32_t iLength,
193 CFX_RectF& rect) { 193 CFX_RectF& rect) {
194 if (pwsStr == NULL || iLength < 1) { 194 if (!pwsStr || iLength < 1) {
195 rect.width = 0.0f; 195 rect.width = 0.0f;
196 rect.height = 0.0f; 196 rect.height = 0.0f;
197 } else { 197 } else {
198 CFX_Matrix rm; 198 CFX_Matrix rm;
199 rm.SetReverse(m_Matrix); 199 rm.SetReverse(m_Matrix);
200 rm.TransformRect(rect); 200 rm.TransformRect(rect);
201 CalcTextSize(pwsStr, iLength, rect); 201 CalcTextSize(pwsStr, iLength, rect);
202 m_Matrix.TransformRect(rect); 202 m_Matrix.TransformRect(rect);
203 } 203 }
204 } 204 }
205 void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, 205 void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr,
206 int32_t iLength, 206 int32_t iLength,
207 CFX_SizeF& size) { 207 CFX_SizeF& size) {
208 CFX_RectF rtText; 208 CFX_RectF rtText;
209 rtText.Set(0.0f, 0.0f, size.x, size.y); 209 rtText.Set(0.0f, 0.0f, size.x, size.y);
210 CalcLogicSize(pwsStr, iLength, rtText); 210 CalcLogicSize(pwsStr, iLength, rtText);
211 size.x = rtText.Width(); 211 size.x = rtText.Width();
212 size.y = rtText.Height(); 212 size.y = rtText.Height();
213 } 213 }
214 void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, 214 void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr,
215 int32_t iLength, 215 int32_t iLength,
216 CFX_RectF& rect) { 216 CFX_RectF& rect) {
217 if (pwsStr == NULL || iLength < 1) { 217 if (!pwsStr || iLength < 1) {
218 rect.width = 0.0f; 218 rect.width = 0.0f;
219 rect.height = 0.0f; 219 rect.height = 0.0f;
220 } else { 220 } else {
221 CalcTextSize(pwsStr, iLength, rect); 221 CalcTextSize(pwsStr, iLength, rect);
222 } 222 }
223 } 223 }
224 void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr, 224 void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr,
225 int32_t iLength, 225 int32_t iLength,
226 CFX_RectF& rect) { 226 CFX_RectF& rect) {
227 ASSERT(m_pFont != NULL && m_fFontSize >= 1.0f); 227 ASSERT(m_pFont && m_fFontSize >= 1.0f);
228 SetLineWidth(rect); 228 SetLineWidth(rect);
229 m_iTotalLines = 0; 229 m_iTotalLines = 0;
230 const FX_WCHAR* pStr = pwsStr; 230 const FX_WCHAR* pStr = pwsStr;
231 FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); 231 FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
232 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); 232 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
233 FX_FLOAT fWidth = 0.0f; 233 FX_FLOAT fWidth = 0.0f;
234 FX_FLOAT fHeight = 0.0f; 234 FX_FLOAT fHeight = 0.0f;
235 FX_FLOAT fStartPos = bVertical ? rect.bottom() : rect.right(); 235 FX_FLOAT fStartPos = bVertical ? rect.bottom() : rect.right();
236 uint32_t dwBreakStatus = 0; 236 uint32_t dwBreakStatus = 0;
237 FX_WCHAR wPreChar = 0; 237 FX_WCHAR wPreChar = 0;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 CFX_RectF rtClip; 379 CFX_RectF rtClip;
380 rtClip.Set(m_rtLogicClip.left, m_rtLogicClip.top, m_rtLogicClip.width, 380 rtClip.Set(m_rtLogicClip.left, m_rtLogicClip.top, m_rtLogicClip.width,
381 m_rtLogicClip.height); 381 m_rtLogicClip.height);
382 m_Matrix.TransformRect(rtClip); 382 m_Matrix.TransformRect(rtClip);
383 DrawText(pwsStr, iLength, rect, rtClip); 383 DrawText(pwsStr, iLength, rect, rtClip);
384 } 384 }
385 void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, 385 void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr,
386 int32_t iLength, 386 int32_t iLength,
387 const CFX_RectF& rect, 387 const CFX_RectF& rect,
388 const CFX_RectF& rtClip) { 388 const CFX_RectF& rtClip) {
389 ASSERT(m_pFont != NULL && m_fFontSize >= 1.0f); 389 ASSERT(m_pFont && m_fFontSize >= 1.0f);
390 if (pwsStr == NULL || iLength < 1) { 390 if (!pwsStr || iLength < 1)
391 return; 391 return;
392 } 392
393 if (rect.width < m_fFontSize || rect.height < m_fFontSize) { 393 if (rect.width < m_fFontSize || rect.height < m_fFontSize) {
394 return; 394 return;
395 } 395 }
396 FX_FLOAT fLineWidth = rect.width; 396 FX_FLOAT fLineWidth = rect.width;
397 if (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) { 397 if (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) {
398 fLineWidth = rect.height; 398 fLineWidth = rect.height;
399 } 399 }
400 m_pTxtBreak->SetLineWidth(fLineWidth); 400 m_pTxtBreak->SetLineWidth(fLineWidth);
401 m_ttoLines.RemoveAll(TRUE); 401 m_ttoLines.RemoveAll(TRUE);
402 m_wsText.clear(); 402 m_wsText.clear();
(...skipping 21 matching lines...) Expand all
424 if (!m_pEllCharWidths) { 424 if (!m_pEllCharWidths) {
425 m_pEllCharWidths = FX_Alloc(int32_t, iSize); 425 m_pEllCharWidths = FX_Alloc(int32_t, iSize);
426 m_iEllChars = iSize; 426 m_iEllChars = iSize;
427 } else if (m_iEllChars < iSize) { 427 } else if (m_iEllChars < iSize) {
428 m_pEllCharWidths = FX_Realloc(int32_t, m_pEllCharWidths, iSize); 428 m_pEllCharWidths = FX_Realloc(int32_t, m_pEllCharWidths, iSize);
429 m_iEllChars = iSize; 429 m_iEllChars = iSize;
430 } 430 }
431 FXSYS_memset(m_pEllCharWidths, 0, iSize * sizeof(int32_t)); 431 FXSYS_memset(m_pEllCharWidths, 0, iSize * sizeof(int32_t));
432 break; 432 break;
433 case 2: 433 case 2:
434 if (m_pCharPos == NULL) { 434 if (!m_pCharPos) {
435 m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, iSize); 435 m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, iSize);
436 m_iCharPosSize = iSize; 436 m_iCharPosSize = iSize;
437 } else if (m_iCharPosSize < iSize) { 437 } else if (m_iCharPosSize < iSize) {
438 m_pCharPos = FX_Realloc(FXTEXT_CHARPOS, m_pCharPos, iSize); 438 m_pCharPos = FX_Realloc(FXTEXT_CHARPOS, m_pCharPos, iSize);
439 m_iCharPosSize = iSize; 439 m_iCharPosSize = iSize;
440 } 440 }
441 break; 441 break;
442 } 442 }
443 } 443 }
444 void CFDE_TextOut::LoadEllipsis() { 444 void CFDE_TextOut::LoadEllipsis() {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 } 506 }
507 m_hotKeys.RemoveAll(); 507 m_hotKeys.RemoveAll();
508 int32_t iStartChar = 0; 508 int32_t iStartChar = 0;
509 int32_t iChars = 0; 509 int32_t iChars = 0;
510 int32_t iPieceWidths = 0; 510 int32_t iPieceWidths = 0;
511 uint32_t dwBreakStatus; 511 uint32_t dwBreakStatus;
512 FX_WCHAR wch; 512 FX_WCHAR wch;
513 FX_BOOL bRet = FALSE; 513 FX_BOOL bRet = FALSE;
514 while (iTxtLength-- > 0) { 514 while (iTxtLength-- > 0) {
515 wch = *pwsStr++; 515 wch = *pwsStr++;
516 if (wch == L'&' && bHotKey && (pStr - 1) != NULL && *(pStr - 1) != L'&') { 516 if (wch == L'&' && bHotKey && pStr - 1 && *(pStr - 1) != L'&') {
517 if (iTxtLength > 0) { 517 if (iTxtLength > 0) {
518 m_hotKeys.Add(iChars); 518 m_hotKeys.Add(iChars);
519 } 519 }
520 continue; 520 continue;
521 } 521 }
522 *pStr++ = wch; 522 *pStr++ = wch;
523 iChars++; 523 iChars++;
524 dwBreakStatus = m_pTxtBreak->AppendChar(wch); 524 dwBreakStatus = m_pTxtBreak->AppendChar(wch);
525 if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { 525 if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
526 FX_BOOL bEndofLine = 526 FX_BOOL bEndofLine =
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 FX_BOOL bReload, 558 FX_BOOL bReload,
559 const CFX_RectF& rect) { 559 const CFX_RectF& rect) {
560 FX_BOOL bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine); 560 FX_BOOL bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine);
561 FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); 561 FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
562 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); 562 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
563 FX_FLOAT fLineStep = 563 FX_FLOAT fLineStep =
564 (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; 564 (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
565 if (bVertical) { 565 if (bVertical) {
566 fLineStep = -fLineStep; 566 fLineStep = -fLineStep;
567 } 567 }
568 CFX_Char* pTC = NULL; 568 CFX_Char* pTC = nullptr;
569 FX_BOOL bNeedReload = FALSE; 569 FX_BOOL bNeedReload = FALSE;
570 FX_FLOAT fLineWidth = bVertical ? rect.Height() : rect.Width(); 570 FX_FLOAT fLineWidth = bVertical ? rect.Height() : rect.Width();
571 int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f); 571 int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f);
572 int32_t iCount = m_pTxtBreak->CountBreakPieces(); 572 int32_t iCount = m_pTxtBreak->CountBreakPieces();
573 for (int32_t i = 0; i < iCount; i++) { 573 for (int32_t i = 0; i < iCount; i++) {
574 const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i); 574 const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i);
575 int32_t iPieceChars = pPiece->GetLength(); 575 int32_t iPieceChars = pPiece->GetLength();
576 int32_t iChar = iStartChar; 576 int32_t iChar = iStartChar;
577 int32_t iWidth = 0; 577 int32_t iWidth = 0;
578 int32_t j = 0; 578 int32_t j = 0;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); 656 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i);
657 if (!pLine->m_bNewReload) { 657 if (!pLine->m_bNewReload) {
658 continue; 658 continue;
659 } 659 }
660 int32_t iEllipsisCharIndex = iLength - 1; 660 int32_t iEllipsisCharIndex = iLength - 1;
661 int32_t iCharWidth = 0; 661 int32_t iCharWidth = 0;
662 int32_t iCharCount = 0; 662 int32_t iCharCount = 0;
663 int32_t iPiece = pLine->GetSize(); 663 int32_t iPiece = pLine->GetSize();
664 while (iPiece-- > 0) { 664 while (iPiece-- > 0) {
665 FDE_TTOPIECE* pPiece = pLine->GetPtrAt(iPiece); 665 FDE_TTOPIECE* pPiece = pLine->GetPtrAt(iPiece);
666 if (pPiece == NULL) { 666 if (!pPiece)
667 break; 667 break;
668 } 668
669 for (int32_t j = pPiece->iChars - 1; j >= 0; j--) { 669 for (int32_t j = pPiece->iChars - 1; j >= 0; j--) {
670 if (iEllipsisCharIndex < 0) { 670 if (iEllipsisCharIndex < 0) {
671 break; 671 break;
672 } 672 }
673 int32_t index = pPiece->iStartChar + j; 673 int32_t index = pPiece->iStartChar + j;
674 iCharWidth += m_pCharWidths[index]; 674 iCharWidth += m_pCharWidths[index];
675 iCharCount++; 675 iCharCount++;
676 if (iCharCount <= iLength) { 676 if (iCharCount <= iLength) {
677 m_wsText.SetAt(index, m_wsEllipsis.GetAt(iEllipsisCharIndex)); 677 m_wsText.SetAt(index, m_wsEllipsis.GetAt(iEllipsisCharIndex));
678 m_pCharWidths[index] = m_pEllCharWidths[iEllipsisCharIndex]; 678 m_pCharWidths[index] = m_pEllCharWidths[iEllipsisCharIndex];
679 } else if (iCharWidth <= m_iEllipsisWidth) { 679 } else if (iCharWidth <= m_iEllipsisWidth) {
680 m_wsText.SetAt(index, 0); 680 m_wsText.SetAt(index, 0);
681 m_pCharWidths[index] = 0; 681 m_pCharWidths[index] = 0;
682 } 682 }
683 iEllipsisCharIndex--; 683 iEllipsisCharIndex--;
684 } 684 }
685 if (iEllipsisCharIndex < 0) { 685 if (iEllipsisCharIndex < 0) {
686 break; 686 break;
687 } 687 }
688 } 688 }
689 } 689 }
690 } 690 }
691 void CFDE_TextOut::Reload(const CFX_RectF& rect) { 691 void CFDE_TextOut::Reload(const CFX_RectF& rect) {
692 int32_t iCount = m_ttoLines.GetSize(); 692 int32_t iCount = m_ttoLines.GetSize();
693 for (int32_t i = 0; i < iCount; i++) { 693 for (int32_t i = 0; i < iCount; i++) {
694 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); 694 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i);
695 if (pLine == NULL || !pLine->m_bNewReload) { 695 if (!pLine || !pLine->m_bNewReload)
696 continue; 696 continue;
697 } 697
698 m_iCurLine = i; 698 m_iCurLine = i;
699 m_iCurPiece = 0; 699 m_iCurPiece = 0;
700 ReloadLinePiece(pLine, rect); 700 ReloadLinePiece(pLine, rect);
701 } 701 }
702 } 702 }
703 void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { 703 void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) {
704 const FX_WCHAR* pwsStr = m_wsText.c_str(); 704 const FX_WCHAR* pwsStr = m_wsText.c_str();
705 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); 705 FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
706 int32_t iPieceWidths = 0; 706 int32_t iPieceWidths = 0;
707 FDE_TTOPIECE* pPiece = pLine->GetPtrAt(0); 707 FDE_TTOPIECE* pPiece = pLine->GetPtrAt(0);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) { 767 void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) {
768 if (!m_pRenderDevice) 768 if (!m_pRenderDevice)
769 return; 769 return;
770 770
771 int32_t iLines = m_ttoLines.GetSize(); 771 int32_t iLines = m_ttoLines.GetSize();
772 if (iLines < 1) 772 if (iLines < 1)
773 return; 773 return;
774 774
775 CFDE_Brush* pBrush = new CFDE_Brush; 775 CFDE_Brush* pBrush = new CFDE_Brush;
776 pBrush->SetColor(m_TxtColor); 776 pBrush->SetColor(m_TxtColor);
777 CFDE_Pen* pPen = NULL; 777 CFDE_Pen* pPen = nullptr;
778 m_pRenderDevice->SaveState(); 778 m_pRenderDevice->SaveState();
779 if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) { 779 if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) {
780 m_pRenderDevice->SetClipRect(rtClip); 780 m_pRenderDevice->SetClipRect(rtClip);
781 } 781 }
782 for (int32_t i = 0; i < iLines; i++) { 782 for (int32_t i = 0; i < iLines; i++) {
783 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i); 783 CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i);
784 int32_t iPieces = pLine->GetSize(); 784 int32_t iPieces = pLine->GetSize();
785 for (int32_t j = 0; j < iPieces; j++) { 785 for (int32_t j = 0; j < iPieces; j++) {
786 FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j); 786 FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j);
787 if (pPiece == NULL) { 787 if (!pPiece)
788 continue; 788 continue;
789 } 789
790 int32_t iCount = GetDisplayPos(pPiece); 790 int32_t iCount = GetDisplayPos(pPiece);
791 if (iCount > 0) { 791 if (iCount > 0) {
792 m_pRenderDevice->DrawString(pBrush, m_pFont, m_pCharPos, iCount, 792 m_pRenderDevice->DrawString(pBrush, m_pFont, m_pCharPos, iCount,
793 m_fFontSize, &m_Matrix); 793 m_fFontSize, &m_Matrix);
794 } 794 }
795 DrawLine(pPiece, pPen); 795 DrawLine(pPiece, pPen);
796 } 796 }
797 } 797 }
798 m_pRenderDevice->RestoreState(); 798 m_pRenderDevice->RestoreState();
799 delete pBrush; 799 delete pBrush;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 FDE_TTOPIECE& piece = m_pieces.GetAt(index); 921 FDE_TTOPIECE& piece = m_pieces.GetAt(index);
922 piece = ttoPiece; 922 piece = ttoPiece;
923 } 923 }
924 return index; 924 return index;
925 } 925 }
926 int32_t CFDE_TTOLine::GetSize() const { 926 int32_t CFDE_TTOLine::GetSize() const {
927 return m_iPieceCount; 927 return m_iPieceCount;
928 } 928 }
929 FDE_TTOPIECE* CFDE_TTOLine::GetPtrAt(int32_t index) { 929 FDE_TTOPIECE* CFDE_TTOLine::GetPtrAt(int32_t index) {
930 if (index >= m_iPieceCount) { 930 if (index >= m_iPieceCount) {
931 return NULL; 931 return nullptr;
932 } 932 }
933 return m_pieces.GetPtrAt(index); 933 return m_pieces.GetPtrAt(index);
934 } 934 }
935 void CFDE_TTOLine::RemoveLast(int32_t iCount) { 935 void CFDE_TTOLine::RemoveLast(int32_t iCount) {
936 m_pieces.RemoveLast(iCount); 936 m_pieces.RemoveLast(iCount);
937 } 937 }
938 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { 938 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) {
939 m_pieces.RemoveAll(bLeaveMemory); 939 m_pieces.RemoveAll(bLeaveMemory);
940 } 940 }
OLDNEW
« no previous file with comments | « xfa/fde/fde_visualset.h ('k') | xfa/fde/xml/fde_xml_imp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698