Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: xfa/fde/fde_render.cpp

Issue 2044623002: Remove FDE_HDEVICESTATE. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fde/fde_render.h ('k') | xfa/fde/tto/fde_textout.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/fde_render.h" 7 #include "xfa/fde/fde_render.h"
8 8
9 #include "xfa/fde/fde_gedevice.h" 9 #include "xfa/fde/fde_gedevice.h"
10 #include "xfa/fde/fde_object.h" 10 #include "xfa/fde/fde_object.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 else if (m_iCharPosCount < iCount) 127 else if (m_iCharPosCount < iCount)
128 m_pCharPos = FX_Realloc(FXTEXT_CHARPOS, m_pCharPos, iCount); 128 m_pCharPos = FX_Realloc(FXTEXT_CHARPOS, m_pCharPos, iCount);
129 129
130 if (m_iCharPosCount < iCount) 130 if (m_iCharPosCount < iCount)
131 m_iCharPosCount = iCount; 131 m_iCharPosCount = iCount;
132 132
133 iCount = pTextSet->GetDisplayPos(hText, m_pCharPos, FALSE); 133 iCount = pTextSet->GetDisplayPos(hText, m_pCharPos, FALSE);
134 FX_FLOAT fFontSize = pTextSet->GetFontSize(hText); 134 FX_FLOAT fFontSize = pTextSet->GetFontSize(hText);
135 FX_ARGB dwColor = pTextSet->GetFontColor(hText); 135 FX_ARGB dwColor = pTextSet->GetFontColor(hText);
136 m_pBrush->SetColor(dwColor); 136 m_pBrush->SetColor(dwColor);
137 FDE_HDEVICESTATE hState; 137 FX_BOOL bClip = ApplyClip(pTextSet, hText);
138 FX_BOOL bClip = ApplyClip(pTextSet, hText, hState);
139 m_pRenderDevice->DrawString(m_pBrush.get(), pFont, m_pCharPos, iCount, 138 m_pRenderDevice->DrawString(m_pBrush.get(), pFont, m_pCharPos, iCount,
140 fFontSize, &m_Transform); 139 fFontSize, &m_Transform);
141 if (bClip) 140 if (bClip)
142 RestoreClip(hState); 141 RestoreClip();
143 } 142 }
144 143
145 FX_BOOL CFDE_RenderContext::ApplyClip(IFDE_VisualSet* pVisualSet, 144 FX_BOOL CFDE_RenderContext::ApplyClip(IFDE_VisualSet* pVisualSet,
146 FDE_HVISUALOBJ hObj, 145 FDE_HVISUALOBJ hObj) {
147 FDE_HDEVICESTATE& hState) {
148 CFX_RectF rtClip; 146 CFX_RectF rtClip;
149 if (!pVisualSet->GetClip(hObj, rtClip)) 147 if (!pVisualSet->GetClip(hObj, rtClip))
150 return FALSE; 148 return FALSE;
151 149
152 CFX_RectF rtObj; 150 CFX_RectF rtObj;
153 pVisualSet->GetRect(hObj, rtObj); 151 pVisualSet->GetRect(hObj, rtObj);
154 rtClip.Offset(rtObj.left, rtObj.top); 152 rtClip.Offset(rtObj.left, rtObj.top);
155 m_Transform.TransformRect(rtClip); 153 m_Transform.TransformRect(rtClip);
156 const CFX_RectF& rtDevClip = m_pRenderDevice->GetClipRect(); 154 const CFX_RectF& rtDevClip = m_pRenderDevice->GetClipRect();
157 rtClip.Intersect(rtDevClip); 155 rtClip.Intersect(rtDevClip);
158 hState = m_pRenderDevice->SaveState(); 156 m_pRenderDevice->SaveState();
159 return m_pRenderDevice->SetClipRect(rtClip); 157 return m_pRenderDevice->SetClipRect(rtClip);
160 } 158 }
161 159
162 void CFDE_RenderContext::RestoreClip(FDE_HDEVICESTATE hState) { 160 void CFDE_RenderContext::RestoreClip() {
163 m_pRenderDevice->RestoreState(hState); 161 m_pRenderDevice->RestoreState();
164 } 162 }
OLDNEW
« no previous file with comments | « xfa/fde/fde_render.h ('k') | xfa/fde/tto/fde_textout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698