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 "xfa/fde/tto/fde_textout.h" | 7 #include "xfa/fde/tto/fde_textout.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
53 FX_Free(m_pCharPos); | 53 FX_Free(m_pCharPos); |
54 m_ttoLines.RemoveAll(); | 54 m_ttoLines.RemoveAll(FALSE); |
55 } | 55 } |
56 void CFDE_TextOut::SetFont(CFGAS_GEFont* pFont) { | 56 void CFDE_TextOut::SetFont(CFGAS_GEFont* pFont) { |
57 ASSERT(pFont); | 57 ASSERT(pFont); |
58 m_pFont = pFont; | 58 m_pFont = pFont; |
59 m_pTxtBreak->SetFont(pFont); | 59 m_pTxtBreak->SetFont(pFont); |
60 } | 60 } |
61 void CFDE_TextOut::SetFontSize(FX_FLOAT fFontSize) { | 61 void CFDE_TextOut::SetFontSize(FX_FLOAT fFontSize) { |
62 ASSERT(fFontSize > 0); | 62 ASSERT(fFontSize > 0); |
63 m_fFontSize = fFontSize; | 63 m_fFontSize = fFontSize; |
64 m_pTxtBreak->SetFontSize(fFontSize); | 64 m_pTxtBreak->SetFontSize(fFontSize); |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 if (iLineCount > 0) | 900 if (iLineCount > 0) |
901 m_pRenderDevice->DrawPath(pPen, 1, pPath.get(), &m_Matrix); | 901 m_pRenderDevice->DrawPath(pPen, 1, pPath.get(), &m_Matrix); |
902 } | 902 } |
903 | 903 |
904 CFDE_TTOLine::CFDE_TTOLine() | 904 CFDE_TTOLine::CFDE_TTOLine() |
905 : m_bNewReload(FALSE), m_pieces(5), m_iPieceCount(0) {} | 905 : m_bNewReload(FALSE), m_pieces(5), m_iPieceCount(0) {} |
906 | 906 |
907 CFDE_TTOLine::CFDE_TTOLine(const CFDE_TTOLine& ttoLine) : m_pieces(5) { | 907 CFDE_TTOLine::CFDE_TTOLine(const CFDE_TTOLine& ttoLine) : m_pieces(5) { |
908 m_bNewReload = ttoLine.m_bNewReload; | 908 m_bNewReload = ttoLine.m_bNewReload; |
909 m_iPieceCount = ttoLine.m_iPieceCount; | 909 m_iPieceCount = ttoLine.m_iPieceCount; |
910 m_pieces.Copy(ttoLine.m_pieces); | 910 m_pieces.Copy(ttoLine.m_pieces, 0, -1); |
911 } | 911 } |
912 | 912 |
913 CFDE_TTOLine::~CFDE_TTOLine() {} | 913 CFDE_TTOLine::~CFDE_TTOLine() {} |
914 | 914 |
915 int32_t CFDE_TTOLine::AddPiece(int32_t index, const FDE_TTOPIECE& ttoPiece) { | 915 int32_t CFDE_TTOLine::AddPiece(int32_t index, const FDE_TTOPIECE& ttoPiece) { |
916 if (index >= m_iPieceCount) { | 916 if (index >= m_iPieceCount) { |
917 index = m_pieces.Add(ttoPiece) + 1; | 917 index = m_pieces.Add(ttoPiece) + 1; |
918 m_iPieceCount++; | 918 m_iPieceCount++; |
919 } else { | 919 } else { |
920 FDE_TTOPIECE& piece = m_pieces.GetAt(index); | 920 FDE_TTOPIECE& piece = m_pieces.GetAt(index); |
921 piece = ttoPiece; | 921 piece = ttoPiece; |
922 } | 922 } |
923 return index; | 923 return index; |
924 } | 924 } |
925 int32_t CFDE_TTOLine::GetSize() const { | 925 int32_t CFDE_TTOLine::GetSize() const { |
926 return m_iPieceCount; | 926 return m_iPieceCount; |
927 } | 927 } |
928 FDE_TTOPIECE* CFDE_TTOLine::GetPtrAt(int32_t index) { | 928 FDE_TTOPIECE* CFDE_TTOLine::GetPtrAt(int32_t index) { |
929 if (index >= m_iPieceCount) { | 929 if (index >= m_iPieceCount) { |
930 return nullptr; | 930 return nullptr; |
931 } | 931 } |
932 return m_pieces.GetPtrAt(index); | 932 return m_pieces.GetPtrAt(index); |
933 } | 933 } |
934 void CFDE_TTOLine::RemoveLast(int32_t iCount) { | 934 void CFDE_TTOLine::RemoveLast(int32_t iCount) { |
935 m_pieces.RemoveLast(iCount); | 935 m_pieces.RemoveLast(iCount); |
936 } | 936 } |
937 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { | 937 void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { |
938 m_pieces.RemoveAll(bLeaveMemory); | 938 m_pieces.RemoveAll(bLeaveMemory); |
939 } | 939 } |
OLD | NEW |