| 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/fxgraphics/cfx_graphics.h" | 7 #include "xfa/fxgraphics/cfx_graphics.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 } | 947 } |
| 948 | 948 |
| 949 FWL_Error CFX_Graphics::ShowText(const CFX_PointF& point, | 949 FWL_Error CFX_Graphics::ShowText(const CFX_PointF& point, |
| 950 const CFX_WideString& text, | 950 const CFX_WideString& text, |
| 951 CFX_Matrix* matrix) { | 951 CFX_Matrix* matrix) { |
| 952 if (m_type == FX_CONTEXT_Device && m_renderDevice) | 952 if (m_type == FX_CONTEXT_Device && m_renderDevice) |
| 953 return RenderDeviceShowText(point, text, matrix); | 953 return RenderDeviceShowText(point, text, matrix); |
| 954 return FWL_Error::PropertyInvalid; | 954 return FWL_Error::PropertyInvalid; |
| 955 } | 955 } |
| 956 | 956 |
| 957 FWL_Error CFX_Graphics::CalcTextRect(CFX_RectF& rect, | 957 void CFX_Graphics::CalcTextRect(CFX_RectF& rect, |
| 958 const CFX_WideString& text, | 958 const CFX_WideString& text, |
| 959 FX_BOOL isMultiline, | 959 FX_BOOL isMultiline, |
| 960 CFX_Matrix* matrix) { | 960 CFX_Matrix* matrix) { |
| 961 if (m_type == FX_CONTEXT_Device && m_renderDevice) { | 961 if (m_type != FX_CONTEXT_Device || !m_renderDevice) |
| 962 int32_t length = text.GetLength(); | 962 return; |
| 963 uint32_t* charCodes = FX_Alloc(uint32_t, length); | 963 |
| 964 FXTEXT_CHARPOS* charPos = FX_Alloc(FXTEXT_CHARPOS, length); | 964 int32_t length = text.GetLength(); |
| 965 CalcTextInfo(text, charCodes, charPos, rect); | 965 uint32_t* charCodes = FX_Alloc(uint32_t, length); |
| 966 FX_Free(charPos); | 966 FXTEXT_CHARPOS* charPos = FX_Alloc(FXTEXT_CHARPOS, length); |
| 967 FX_Free(charCodes); | 967 CalcTextInfo(text, charCodes, charPos, rect); |
| 968 return FWL_Error::Succeeded; | 968 FX_Free(charPos); |
| 969 } | 969 FX_Free(charCodes); |
| 970 return FWL_Error::PropertyInvalid; | |
| 971 } | 970 } |
| 972 | 971 |
| 973 FWL_Error CFX_Graphics::Transfer(CFX_Graphics* graphics, | 972 FWL_Error CFX_Graphics::Transfer(CFX_Graphics* graphics, |
| 974 const CFX_Matrix* matrix) { | 973 const CFX_Matrix* matrix) { |
| 975 if (!graphics || !graphics->m_renderDevice) | 974 if (!graphics || !graphics->m_renderDevice) |
| 976 return FWL_Error::ParameterInvalid; | 975 return FWL_Error::ParameterInvalid; |
| 977 CFX_Matrix m; | 976 CFX_Matrix m; |
| 978 m.Set(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, m_info.CTM.e, | 977 m.Set(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, m_info.CTM.e, |
| 979 m_info.CTM.f); | 978 m_info.CTM.f); |
| 980 if (matrix) { | 979 if (matrix) { |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 CTM = other.CTM; | 1569 CTM = other.CTM; |
| 1571 isActOnDash = other.isActOnDash; | 1570 isActOnDash = other.isActOnDash; |
| 1572 strokeColor = other.strokeColor; | 1571 strokeColor = other.strokeColor; |
| 1573 fillColor = other.fillColor; | 1572 fillColor = other.fillColor; |
| 1574 font = other.font; | 1573 font = other.font; |
| 1575 fontSize = other.fontSize; | 1574 fontSize = other.fontSize; |
| 1576 fontHScale = other.fontHScale; | 1575 fontHScale = other.fontHScale; |
| 1577 fontSpacing = other.fontSpacing; | 1576 fontSpacing = other.fontSpacing; |
| 1578 return *this; | 1577 return *this; |
| 1579 } | 1578 } |
| OLD | NEW |