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 |
11 #include "core/fxcrt/fx_coordinates.h" | 11 #include "core/fxcrt/fx_coordinates.h" |
12 #include "core/fxcrt/fx_system.h" | 12 #include "core/fxcrt/fx_system.h" |
| 13 #include "third_party/base/ptr_util.h" |
13 #include "xfa/fde/cfde_path.h" | 14 #include "xfa/fde/cfde_path.h" |
14 #include "xfa/fde/fde_gedevice.h" | 15 #include "xfa/fde/fde_gedevice.h" |
15 #include "xfa/fde/fde_object.h" | 16 #include "xfa/fde/fde_object.h" |
16 #include "xfa/fgas/crt/fgas_memory.h" | 17 #include "xfa/fgas/crt/fgas_memory.h" |
17 #include "xfa/fgas/crt/fgas_utils.h" | 18 #include "xfa/fgas/crt/fgas_utils.h" |
18 #include "xfa/fgas/layout/fgas_textbreak.h" | 19 #include "xfa/fgas/layout/fgas_textbreak.h" |
19 | 20 |
20 CFDE_TextOut::CFDE_TextOut() | 21 CFDE_TextOut::CFDE_TextOut() |
21 : m_pTxtBreak(new CFX_TxtBreak(FX_TXTBREAKPOLICY_None)), | 22 : m_pTxtBreak(new CFX_TxtBreak(FX_TXTBREAKPOLICY_None)), |
22 m_pFont(nullptr), | 23 m_pFont(nullptr), |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 ASSERT(fLineSpace > 1.0f); | 126 ASSERT(fLineSpace > 1.0f); |
126 m_fLineSpace = fLineSpace; | 127 m_fLineSpace = fLineSpace; |
127 } | 128 } |
128 | 129 |
129 void CFDE_TextOut::SetDIBitmap(CFX_DIBitmap* pDIB) { | 130 void CFDE_TextOut::SetDIBitmap(CFX_DIBitmap* pDIB) { |
130 ASSERT(pDIB); | 131 ASSERT(pDIB); |
131 | 132 |
132 m_pRenderDevice.reset(); | 133 m_pRenderDevice.reset(); |
133 CFX_FxgeDevice* device = new CFX_FxgeDevice; | 134 CFX_FxgeDevice* device = new CFX_FxgeDevice; |
134 device->Attach(pDIB, false, nullptr, false); | 135 device->Attach(pDIB, false, nullptr, false); |
135 m_pRenderDevice.reset(new CFDE_RenderDevice(device, false)); | 136 m_pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(device, false); |
136 } | 137 } |
137 | 138 |
138 void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) { | 139 void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) { |
139 ASSERT(pDevice); | 140 ASSERT(pDevice); |
140 m_pRenderDevice.reset(new CFDE_RenderDevice(pDevice, false)); | 141 m_pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pDevice, false); |
141 } | 142 } |
142 | 143 |
143 void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) { | 144 void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) { |
144 m_rtClip.Set((FX_FLOAT)rtClip.left, (FX_FLOAT)rtClip.top, | 145 m_rtClip.Set((FX_FLOAT)rtClip.left, (FX_FLOAT)rtClip.top, |
145 (FX_FLOAT)rtClip.Width(), (FX_FLOAT)rtClip.Height()); | 146 (FX_FLOAT)rtClip.Width(), (FX_FLOAT)rtClip.Height()); |
146 } | 147 } |
147 | 148 |
148 void CFDE_TextOut::SetClipRect(const CFX_RectF& rtClip) { | 149 void CFDE_TextOut::SetClipRect(const CFX_RectF& rtClip) { |
149 m_rtClip = rtClip; | 150 m_rtClip = rtClip; |
150 } | 151 } |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 return m_pieces.GetPtrAt(index); | 945 return m_pieces.GetPtrAt(index); |
945 } | 946 } |
946 | 947 |
947 void CFDE_TTOLine::RemoveLast(int32_t iCount) { | 948 void CFDE_TTOLine::RemoveLast(int32_t iCount) { |
948 m_pieces.RemoveLast(iCount); | 949 m_pieces.RemoveLast(iCount); |
949 } | 950 } |
950 | 951 |
951 void CFDE_TTOLine::RemoveAll(bool bLeaveMemory) { | 952 void CFDE_TTOLine::RemoveAll(bool bLeaveMemory) { |
952 m_pieces.RemoveAll(bLeaveMemory); | 953 m_pieces.RemoveAll(bLeaveMemory); |
953 } | 954 } |
OLD | NEW |