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/fxfa/app/xfa_textlayout.h" | 7 #include "xfa/fxfa/app/xfa_textlayout.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 } | 1180 } |
1181 FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, | 1181 FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, |
1182 const CFX_Matrix& tmDoc2Device, | 1182 const CFX_Matrix& tmDoc2Device, |
1183 const CFX_RectF& rtClip, | 1183 const CFX_RectF& rtClip, |
1184 int32_t iBlock) { | 1184 int32_t iBlock) { |
1185 if (!pFxDevice) | 1185 if (!pFxDevice) |
1186 return FALSE; | 1186 return FALSE; |
1187 | 1187 |
1188 std::unique_ptr<CFDE_RenderDevice> pDevice( | 1188 std::unique_ptr<CFDE_RenderDevice> pDevice( |
1189 new CFDE_RenderDevice(pFxDevice, FALSE)); | 1189 new CFDE_RenderDevice(pFxDevice, FALSE)); |
1190 FDE_HDEVICESTATE state = pDevice->SaveState(); | 1190 pDevice->SaveState(); |
1191 pDevice->SetClipRect(rtClip); | 1191 pDevice->SetClipRect(rtClip); |
1192 | 1192 |
1193 std::unique_ptr<CFDE_Brush> pSolidBrush(new CFDE_Brush); | 1193 std::unique_ptr<CFDE_Brush> pSolidBrush(new CFDE_Brush); |
1194 std::unique_ptr<CFDE_Pen> pPen(new CFDE_Pen); | 1194 std::unique_ptr<CFDE_Pen> pPen(new CFDE_Pen); |
1195 if (m_pieceLines.GetSize() == 0) { | 1195 if (m_pieceLines.GetSize() == 0) { |
1196 int32_t iBlockCount = CountBlocks(); | 1196 int32_t iBlockCount = CountBlocks(); |
1197 for (int32_t i = 0; i < iBlockCount; i++) { | 1197 for (int32_t i = 0; i < iBlockCount; i++) { |
1198 Layout(i); | 1198 Layout(i); |
1199 } | 1199 } |
1200 } | 1200 } |
(...skipping 28 matching lines...) Expand all Loading... |
1229 } | 1229 } |
1230 FXSYS_memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS)); | 1230 FXSYS_memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS)); |
1231 RenderString(pDevice.get(), pSolidBrush.get(), pPieceLine, j, pCharPos, | 1231 RenderString(pDevice.get(), pSolidBrush.get(), pPieceLine, j, pCharPos, |
1232 tmDoc2Device); | 1232 tmDoc2Device); |
1233 } | 1233 } |
1234 for (j = 0; j < iPieces; j++) { | 1234 for (j = 0; j < iPieces; j++) { |
1235 RenderPath(pDevice.get(), pPen.get(), pPieceLine, j, pCharPos, | 1235 RenderPath(pDevice.get(), pPen.get(), pPieceLine, j, pCharPos, |
1236 tmDoc2Device); | 1236 tmDoc2Device); |
1237 } | 1237 } |
1238 } | 1238 } |
1239 pDevice->RestoreState(state); | 1239 pDevice->RestoreState(); |
1240 FX_Free(pCharPos); | 1240 FX_Free(pCharPos); |
1241 return iPieceLines; | 1241 return iPieceLines; |
1242 } | 1242 } |
1243 void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) { | 1243 void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) { |
1244 fHeight -= fBottom; | 1244 fHeight -= fBottom; |
1245 if (fHeight < 0.1f) { | 1245 if (fHeight < 0.1f) { |
1246 return; | 1246 return; |
1247 } | 1247 } |
1248 switch (m_textParser.GetVAlign(m_pTextProvider)) { | 1248 switch (m_textParser.GetVAlign(m_pTextProvider)) { |
1249 case XFA_ATTRIBUTEENUM_Middle: | 1249 case XFA_ATTRIBUTEENUM_Middle: |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 tr.iLength = iLength; | 1957 tr.iLength = iLength; |
1958 tr.fFontSize = pPiece->fFontSize; | 1958 tr.fFontSize = pPiece->fFontSize; |
1959 tr.iBidiLevel = pPiece->iBidiLevel; | 1959 tr.iBidiLevel = pPiece->iBidiLevel; |
1960 tr.iCharRotation = 0; | 1960 tr.iCharRotation = 0; |
1961 tr.wLineBreakChar = L'\n'; | 1961 tr.wLineBreakChar = L'\n'; |
1962 tr.iVerticalScale = pPiece->iVerScale; | 1962 tr.iVerticalScale = pPiece->iVerScale; |
1963 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; | 1963 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; |
1964 tr.iHorizontalScale = pPiece->iHorScale; | 1964 tr.iHorizontalScale = pPiece->iHorScale; |
1965 return TRUE; | 1965 return TRUE; |
1966 } | 1966 } |
OLD | NEW |