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 "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
8 #include "fde_render.h" | 8 #include "fde_render.h" |
9 void FDE_GetPageMatrix(CFX_Matrix &pageMatrix, const CFX_RectF &docPageRect, con
st CFX_Rect &devicePageRect, FX_INT32 iRotate, FX_DWORD dwCoordinatesType) | 9 void FDE_GetPageMatrix(CFX_Matrix &pageMatrix, const CFX_RectF &docPageRect, con
st CFX_Rect &devicePageRect, int32_t iRotate, FX_DWORD dwCoordinatesType) |
10 { | 10 { |
11 FXSYS_assert(iRotate >= 0 && iRotate <= 3); | 11 FXSYS_assert(iRotate >= 0 && iRotate <= 3); |
12 FX_BOOL bFlipX = (dwCoordinatesType & 0x01) != 0; | 12 FX_BOOL bFlipX = (dwCoordinatesType & 0x01) != 0; |
13 FX_BOOL bFlipY = (dwCoordinatesType & 0x02) != 0; | 13 FX_BOOL bFlipY = (dwCoordinatesType & 0x02) != 0; |
14 CFX_Matrix m; | 14 CFX_Matrix m; |
15 m.Set((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0); | 15 m.Set((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0); |
16 if (iRotate == 0 || iRotate == 2) { | 16 if (iRotate == 0 || iRotate == 2) { |
17 m.a *= (FX_FLOAT)devicePageRect.width / docPageRect.width; | 17 m.a *= (FX_FLOAT)devicePageRect.width / docPageRect.width; |
18 m.d *= (FX_FLOAT)devicePageRect.height / docPageRect.height; | 18 m.d *= (FX_FLOAT)devicePageRect.height / docPageRect.height; |
19 } else { | 19 } else { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 CFX_RectF rtDocClip = m_pRenderDevice->GetClipRect(); | 101 CFX_RectF rtDocClip = m_pRenderDevice->GetClipRect(); |
102 if (rtDocClip.IsEmpty()) { | 102 if (rtDocClip.IsEmpty()) { |
103 rtDocClip.left = rtDocClip.top = 0; | 103 rtDocClip.left = rtDocClip.top = 0; |
104 rtDocClip.width = (FX_FLOAT)m_pRenderDevice->GetWidth(); | 104 rtDocClip.width = (FX_FLOAT)m_pRenderDevice->GetWidth(); |
105 rtDocClip.height = (FX_FLOAT)m_pRenderDevice->GetHeight(); | 105 rtDocClip.height = (FX_FLOAT)m_pRenderDevice->GetHeight(); |
106 } | 106 } |
107 rm.TransformRect(rtDocClip); | 107 rm.TransformRect(rtDocClip); |
108 IFDE_VisualSet *pVisualSet; | 108 IFDE_VisualSet *pVisualSet; |
109 FDE_HVISUALOBJ hVisualObj; | 109 FDE_HVISUALOBJ hVisualObj; |
110 CFX_RectF rtObj; | 110 CFX_RectF rtObj; |
111 FX_INT32 iCount = 0; | 111 int32_t iCount = 0; |
112 while(TRUE) { | 112 while(TRUE) { |
113 hVisualObj = m_pIterator->GetNext(pVisualSet); | 113 hVisualObj = m_pIterator->GetNext(pVisualSet); |
114 if (hVisualObj == NULL || pVisualSet == NULL) { | 114 if (hVisualObj == NULL || pVisualSet == NULL) { |
115 eStatus = FDE_RENDERSTATUS_Done; | 115 eStatus = FDE_RENDERSTATUS_Done; |
116 break; | 116 break; |
117 } | 117 } |
118 rtObj.Empty(); | 118 rtObj.Empty(); |
119 pVisualSet->GetRect(hVisualObj, rtObj); | 119 pVisualSet->GetRect(hVisualObj, rtObj); |
120 if (!rtDocClip.IntersectWith(rtObj)) { | 120 if (!rtDocClip.IntersectWith(rtObj)) { |
121 continue; | 121 continue; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 Unlock(); | 168 Unlock(); |
169 } | 169 } |
170 void CFDE_RenderContext::RenderText(IFDE_TextSet *pTextSet, FDE_HVISUALOBJ hText
) | 170 void CFDE_RenderContext::RenderText(IFDE_TextSet *pTextSet, FDE_HVISUALOBJ hText
) |
171 { | 171 { |
172 FXSYS_assert(m_pRenderDevice != NULL); | 172 FXSYS_assert(m_pRenderDevice != NULL); |
173 FXSYS_assert(pTextSet != NULL && hText != NULL); | 173 FXSYS_assert(pTextSet != NULL && hText != NULL); |
174 IFX_Font *pFont = pTextSet->GetFont(hText); | 174 IFX_Font *pFont = pTextSet->GetFont(hText); |
175 if (pFont == NULL) { | 175 if (pFont == NULL) { |
176 return; | 176 return; |
177 } | 177 } |
178 FX_INT32 iCount = pTextSet->GetDisplayPos(hText, NULL, FALSE); | 178 int32_t iCount = pTextSet->GetDisplayPos(hText, NULL, FALSE); |
179 if (iCount < 1) { | 179 if (iCount < 1) { |
180 return; | 180 return; |
181 } | 181 } |
182 if (m_pSolidBrush == NULL) { | 182 if (m_pSolidBrush == NULL) { |
183 m_pSolidBrush = (IFDE_SolidBrush*)IFDE_Brush::Create(FDE_BRUSHTYPE_Solid
); | 183 m_pSolidBrush = (IFDE_SolidBrush*)IFDE_Brush::Create(FDE_BRUSHTYPE_Solid
); |
184 if (m_pSolidBrush == NULL) { | 184 if (m_pSolidBrush == NULL) { |
185 return; | 185 return; |
186 } | 186 } |
187 } | 187 } |
188 if (m_pCharPos == NULL) { | 188 if (m_pCharPos == NULL) { |
(...skipping 18 matching lines...) Expand all Loading... |
207 void CFDE_RenderContext::RenderPath(IFDE_PathSet *pPathSet, FDE_HVISUALOBJ hPath
) | 207 void CFDE_RenderContext::RenderPath(IFDE_PathSet *pPathSet, FDE_HVISUALOBJ hPath
) |
208 { | 208 { |
209 FXSYS_assert(m_pRenderDevice != NULL); | 209 FXSYS_assert(m_pRenderDevice != NULL); |
210 FXSYS_assert(pPathSet != NULL && hPath != NULL); | 210 FXSYS_assert(pPathSet != NULL && hPath != NULL); |
211 IFDE_Path *pPath = pPathSet->GetPath(hPath); | 211 IFDE_Path *pPath = pPathSet->GetPath(hPath); |
212 if (pPath == NULL) { | 212 if (pPath == NULL) { |
213 return; | 213 return; |
214 } | 214 } |
215 FDE_HDEVICESTATE hState; | 215 FDE_HDEVICESTATE hState; |
216 FX_BOOL bClip = ApplyClip(pPathSet, hPath, hState); | 216 FX_BOOL bClip = ApplyClip(pPathSet, hPath, hState); |
217 FX_INT32 iRenderMode = pPathSet->GetRenderMode(hPath); | 217 int32_t iRenderMode = pPathSet->GetRenderMode(hPath); |
218 if (iRenderMode & FDE_PATHRENDER_Stroke) { | 218 if (iRenderMode & FDE_PATHRENDER_Stroke) { |
219 IFDE_Pen *pPen = pPathSet->GetPen(hPath); | 219 IFDE_Pen *pPen = pPathSet->GetPen(hPath); |
220 FX_FLOAT fWidth = pPathSet->GetPenWidth(hPath); | 220 FX_FLOAT fWidth = pPathSet->GetPenWidth(hPath); |
221 if (pPen != NULL && fWidth > 0) { | 221 if (pPen != NULL && fWidth > 0) { |
222 m_pRenderDevice->DrawPath(pPen, fWidth, pPath, &m_Transform); | 222 m_pRenderDevice->DrawPath(pPen, fWidth, pPath, &m_Transform); |
223 } | 223 } |
224 } | 224 } |
225 if (iRenderMode & FDE_PATHRENDER_Fill) { | 225 if (iRenderMode & FDE_PATHRENDER_Fill) { |
226 IFDE_Brush *pBrush = pPathSet->GetBrush(hPath); | 226 IFDE_Brush *pBrush = pPathSet->GetBrush(hPath); |
227 if (pBrush != NULL) { | 227 if (pBrush != NULL) { |
(...skipping 16 matching lines...) Expand all Loading... |
244 m_Transform.TransformRect(rtClip); | 244 m_Transform.TransformRect(rtClip); |
245 const CFX_RectF &rtDevClip = m_pRenderDevice->GetClipRect(); | 245 const CFX_RectF &rtDevClip = m_pRenderDevice->GetClipRect(); |
246 rtClip.Intersect(rtDevClip); | 246 rtClip.Intersect(rtDevClip); |
247 hState = m_pRenderDevice->SaveState(); | 247 hState = m_pRenderDevice->SaveState(); |
248 return m_pRenderDevice->SetClipRect(rtClip); | 248 return m_pRenderDevice->SetClipRect(rtClip); |
249 } | 249 } |
250 void CFDE_RenderContext::RestoreClip(FDE_HDEVICESTATE hState) | 250 void CFDE_RenderContext::RestoreClip(FDE_HDEVICESTATE hState) |
251 { | 251 { |
252 m_pRenderDevice->RestoreState(hState); | 252 m_pRenderDevice->RestoreState(hState); |
253 } | 253 } |
OLD | NEW |