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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 } | 1167 } |
1168 FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, | 1168 FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, |
1169 const CFX_Matrix& tmDoc2Device, | 1169 const CFX_Matrix& tmDoc2Device, |
1170 const CFX_RectF& rtClip, | 1170 const CFX_RectF& rtClip, |
1171 int32_t iBlock) { | 1171 int32_t iBlock) { |
1172 if (!pFxDevice) | 1172 if (!pFxDevice) |
1173 return FALSE; | 1173 return FALSE; |
1174 | 1174 |
1175 std::unique_ptr<CFDE_RenderDevice> pDevice( | 1175 std::unique_ptr<CFDE_RenderDevice> pDevice( |
1176 new CFDE_RenderDevice(pFxDevice, FALSE)); | 1176 new CFDE_RenderDevice(pFxDevice, FALSE)); |
1177 FDE_HDEVICESTATE state = pDevice->SaveState(); | 1177 pDevice->SaveState(); |
1178 pDevice->SetClipRect(rtClip); | 1178 pDevice->SetClipRect(rtClip); |
1179 | 1179 |
1180 std::unique_ptr<CFDE_Brush> pSolidBrush(new CFDE_Brush); | 1180 std::unique_ptr<CFDE_Brush> pSolidBrush(new CFDE_Brush); |
1181 std::unique_ptr<CFDE_Pen> pPen(new CFDE_Pen); | 1181 std::unique_ptr<CFDE_Pen> pPen(new CFDE_Pen); |
1182 if (m_pieceLines.GetSize() == 0) { | 1182 if (m_pieceLines.GetSize() == 0) { |
1183 int32_t iBlockCount = CountBlocks(); | 1183 int32_t iBlockCount = CountBlocks(); |
1184 for (int32_t i = 0; i < iBlockCount; i++) { | 1184 for (int32_t i = 0; i < iBlockCount; i++) { |
1185 Layout(i); | 1185 Layout(i); |
1186 } | 1186 } |
1187 } | 1187 } |
(...skipping 28 matching lines...) Expand all Loading... |
1216 } | 1216 } |
1217 FXSYS_memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS)); | 1217 FXSYS_memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS)); |
1218 RenderString(pDevice.get(), pSolidBrush.get(), pPieceLine, j, pCharPos, | 1218 RenderString(pDevice.get(), pSolidBrush.get(), pPieceLine, j, pCharPos, |
1219 tmDoc2Device); | 1219 tmDoc2Device); |
1220 } | 1220 } |
1221 for (j = 0; j < iPieces; j++) { | 1221 for (j = 0; j < iPieces; j++) { |
1222 RenderPath(pDevice.get(), pPen.get(), pPieceLine, j, pCharPos, | 1222 RenderPath(pDevice.get(), pPen.get(), pPieceLine, j, pCharPos, |
1223 tmDoc2Device); | 1223 tmDoc2Device); |
1224 } | 1224 } |
1225 } | 1225 } |
1226 pDevice->RestoreState(state); | 1226 pDevice->RestoreState(); |
1227 FX_Free(pCharPos); | 1227 FX_Free(pCharPos); |
1228 return iPieceLines; | 1228 return iPieceLines; |
1229 } | 1229 } |
1230 void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) { | 1230 void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) { |
1231 fHeight -= fBottom; | 1231 fHeight -= fBottom; |
1232 if (fHeight < 0.1f) { | 1232 if (fHeight < 0.1f) { |
1233 return; | 1233 return; |
1234 } | 1234 } |
1235 switch (m_textParser.GetVAlign(m_pTextProvider)) { | 1235 switch (m_textParser.GetVAlign(m_pTextProvider)) { |
1236 case XFA_ATTRIBUTEENUM_Middle: | 1236 case XFA_ATTRIBUTEENUM_Middle: |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1942 tr.iLength = iLength; | 1942 tr.iLength = iLength; |
1943 tr.fFontSize = pPiece->fFontSize; | 1943 tr.fFontSize = pPiece->fFontSize; |
1944 tr.iBidiLevel = pPiece->iBidiLevel; | 1944 tr.iBidiLevel = pPiece->iBidiLevel; |
1945 tr.iCharRotation = 0; | 1945 tr.iCharRotation = 0; |
1946 tr.wLineBreakChar = L'\n'; | 1946 tr.wLineBreakChar = L'\n'; |
1947 tr.iVerticalScale = pPiece->iVerScale; | 1947 tr.iVerticalScale = pPiece->iVerScale; |
1948 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; | 1948 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; |
1949 tr.iHorizontalScale = pPiece->iHorScale; | 1949 tr.iHorizontalScale = pPiece->iHorScale; |
1950 return TRUE; | 1950 return TRUE; |
1951 } | 1951 } |
OLD | NEW |