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 "public/fpdf_formfill.h" | 7 #include "public/fpdf_formfill.h" |
8 | 8 |
9 #include "../include/fpdfxfa/fpdfxfa_app.h" | 9 #include "../include/fpdfxfa/fpdfxfa_app.h" |
10 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 10 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, | 263 DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, |
264 FPDF_BITMAP bitmap, | 264 FPDF_BITMAP bitmap, |
265 FPDF_PAGE page, | 265 FPDF_PAGE page, |
266 int start_x, | 266 int start_x, |
267 int start_y, | 267 int start_y, |
268 int size_x, | 268 int size_x, |
269 int size_y, | 269 int size_y, |
270 int rotate, | 270 int rotate, |
271 int flags) { | 271 int flags) { |
272 if (!hHandle || !page) | 272 if (!hHandle) |
273 return; | 273 return; |
274 | 274 |
275 CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; | 275 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 276 if (!pPage) |
| 277 return; |
| 278 |
276 CPDFXFA_Document* pDocument = pPage->GetDocument(); | 279 CPDFXFA_Document* pDocument = pPage->GetDocument(); |
277 if (!pDocument) | 280 if (!pDocument) |
278 return; | 281 return; |
| 282 |
279 CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); | 283 CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); |
280 if (!pPDFDoc) | 284 if (!pPDFDoc) |
281 return; | 285 return; |
282 | 286 |
283 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; | 287 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; |
284 CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument(); | 288 CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument(); |
285 if (!pFXDoc) | 289 if (!pFXDoc) |
286 return; | 290 return; |
287 | 291 |
288 CFX_AffineMatrix matrix; | 292 CFX_AffineMatrix matrix; |
(...skipping 25 matching lines...) Expand all Loading... |
314 | 318 |
315 // Grayscale output | 319 // Grayscale output |
316 if (flags & FPDF_GRAYSCALE) { | 320 if (flags & FPDF_GRAYSCALE) { |
317 options.m_ColorMode = RENDER_COLOR_GRAY; | 321 options.m_ColorMode = RENDER_COLOR_GRAY; |
318 options.m_ForeColor = 0; | 322 options.m_ForeColor = 0; |
319 options.m_BackColor = 0xffffff; | 323 options.m_BackColor = 0xffffff; |
320 } | 324 } |
321 options.m_AddFlags = flags >> 8; | 325 options.m_AddFlags = flags >> 8; |
322 options.m_pOCContext = new CPDF_OCContext(pPDFDoc); | 326 options.m_pOCContext = new CPDF_OCContext(pPDFDoc); |
323 | 327 |
324 if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView((CPDFXFA_Page*)page)) | 328 if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage)) |
325 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); | 329 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); |
326 | 330 |
327 pDevice->RestoreState(); | 331 pDevice->RestoreState(); |
328 delete options.m_pOCContext; | 332 delete options.m_pOCContext; |
329 options.m_pOCContext = NULL; | 333 options.m_pOCContext = NULL; |
330 } | 334 } |
331 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, | 335 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, |
332 FPDF_WIDGET hWidget) { | 336 FPDF_WIDGET hWidget) { |
333 if (NULL == hWidget || NULL == document) | 337 if (NULL == hWidget || NULL == document) |
334 return; | 338 return; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); | 682 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); |
679 } | 683 } |
680 } else { | 684 } else { |
681 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 685 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
682 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 686 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
683 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 687 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
684 } | 688 } |
685 } | 689 } |
686 } | 690 } |
687 } | 691 } |
OLD | NEW |