| 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 <memory> |
| 10 |
| 9 #include "fpdfsdk/include/fsdk_define.h" | 11 #include "fpdfsdk/include/fsdk_define.h" |
| 10 #include "fpdfsdk/include/fsdk_mgr.h" | 12 #include "fpdfsdk/include/fsdk_mgr.h" |
| 11 #include "public/fpdfview.h" | 13 #include "public/fpdfview.h" |
| 12 #include "third_party/base/nonstd_unique_ptr.h" | |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 CPDFSDK_Document* FormHandleToSDKDoc(FPDF_FORMHANDLE hHandle) { | 17 CPDFSDK_Document* FormHandleToSDKDoc(FPDF_FORMHANDLE hHandle) { |
| 17 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; | 18 CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; |
| 18 return pEnv ? pEnv->GetSDKDocument() : nullptr; | 19 return pEnv ? pEnv->GetSDKDocument() : nullptr; |
| 19 } | 20 } |
| 20 | 21 |
| 21 CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) { | 22 CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) { |
| 22 CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); | 23 CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 CFX_Matrix matrix; | 222 CFX_Matrix matrix; |
| 222 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); | 223 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); |
| 223 | 224 |
| 224 FX_RECT clip; | 225 FX_RECT clip; |
| 225 clip.left = start_x; | 226 clip.left = start_x; |
| 226 clip.right = start_x + size_x; | 227 clip.right = start_x + size_x; |
| 227 clip.top = start_y; | 228 clip.top = start_y; |
| 228 clip.bottom = start_y + size_y; | 229 clip.bottom = start_y + size_y; |
| 229 | 230 |
| 230 #ifdef _SKIA_SUPPORT_ | 231 #ifdef _SKIA_SUPPORT_ |
| 231 nonstd::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice); | 232 std::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice); |
| 232 #else | 233 #else |
| 233 nonstd::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice); | 234 std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice); |
| 234 #endif | 235 #endif |
| 235 pDevice->Attach((CFX_DIBitmap*)bitmap); | 236 pDevice->Attach((CFX_DIBitmap*)bitmap); |
| 236 pDevice->SaveState(); | 237 pDevice->SaveState(); |
| 237 pDevice->SetClip_Rect(&clip); | 238 pDevice->SetClip_Rect(&clip); |
| 238 | 239 |
| 239 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage)) | 240 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage)) |
| 240 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options); | 241 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options); |
| 241 | 242 |
| 242 pDevice->RestoreState(); | 243 pDevice->RestoreState(); |
| 243 delete options.m_pOCContext; | 244 delete options.m_pOCContext; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); | 343 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); |
| 343 } | 344 } |
| 344 } else { | 345 } else { |
| 345 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 346 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
| 346 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 347 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
| 347 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 348 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
| 348 } | 349 } |
| 349 } | 350 } |
| 350 } | 351 } |
| 351 } | 352 } |
| OLD | NEW |