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

Side by Side Diff: fpdfsdk/src/fpdfformfill.cpp

Issue 1776313002: Add bitmaps and skp output to Skia port (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: match existing define Created 4 years, 9 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
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 "public/fpdf_formfill.h" 7 #include "public/fpdf_formfill.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 280 }
281 281
282 DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle) { 282 DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle) {
283 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); 283 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle);
284 if (!pSDKDoc) 284 if (!pSDKDoc)
285 return FALSE; 285 return FALSE;
286 286
287 return pSDKDoc->KillFocusAnnot(0); 287 return pSDKDoc->KillFocusAnnot(0);
288 } 288 }
289 289
290 DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, 290 static void FFLCommon(FPDF_FORMHANDLE hHandle,
291 FPDF_BITMAP bitmap, 291 FPDF_BITMAP bitmap,
292 FPDF_PAGE page, 292 FPDF_RECORDER recorder,
293 int start_x, 293 FPDF_PAGE page,
294 int start_y, 294 int start_x,
295 int size_x, 295 int start_y,
296 int size_y, 296 int size_x,
297 int rotate, 297 int size_y,
298 int flags) { 298 int rotate,
299 int flags) {
299 if (!hHandle) 300 if (!hHandle)
300 return; 301 return;
301 302
302 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); 303 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
303 if (!pPage) 304 if (!pPage)
304 return; 305 return;
305 306
306 #ifndef PDF_ENABLE_XFA 307 #ifndef PDF_ENABLE_XFA
307 CPDF_RenderOptions options; 308 CPDF_RenderOptions options;
308 if (flags & FPDF_LCD_TEXT) 309 if (flags & FPDF_LCD_TEXT)
(...skipping 20 matching lines...) Expand all
329 if (!pFXDoc) 330 if (!pFXDoc)
330 return; 331 return;
331 #endif // PDF_ENABLE_XFA 332 #endif // PDF_ENABLE_XFA
332 333
333 CFX_Matrix matrix; 334 CFX_Matrix matrix;
334 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); 335 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate);
335 336
336 FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y); 337 FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y);
337 338
338 #ifdef _SKIA_SUPPORT_ 339 #ifdef _SKIA_SUPPORT_
339 std::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice); 340 std::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice());
341 pDevice->AttachRecorder((SkPictureRecorder*)recorder);
Tom Sepez 2016/03/11 17:38:46 nit: prefer static_cast<>
caryclark 2016/03/13 01:02:38 Done.
340 #else 342 #else
341 std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice); 343 std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice);
342 #endif 344 #endif
343 pDevice->Attach((CFX_DIBitmap*)bitmap); 345 pDevice->Attach((CFX_DIBitmap*)bitmap);
344 pDevice->SaveState(); 346 pDevice->SaveState();
345 pDevice->SetClip_Rect(clip); 347 pDevice->SetClip_Rect(clip);
346 348
347 #ifndef PDF_ENABLE_XFA 349 #ifndef PDF_ENABLE_XFA
348 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage)) 350 if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage))
349 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options); 351 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options);
(...skipping 17 matching lines...) Expand all
367 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); 369 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip);
368 #endif // PDF_ENABLE_XFA 370 #endif // PDF_ENABLE_XFA
369 371
370 pDevice->RestoreState(); 372 pDevice->RestoreState();
371 delete options.m_pOCContext; 373 delete options.m_pOCContext;
372 #ifdef PDF_ENABLE_XFA 374 #ifdef PDF_ENABLE_XFA
373 options.m_pOCContext = NULL; 375 options.m_pOCContext = NULL;
374 #endif // PDF_ENABLE_XFA 376 #endif // PDF_ENABLE_XFA
375 } 377 }
376 378
379 DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
380 FPDF_BITMAP bitmap,
381 FPDF_PAGE page,
382 int start_x,
383 int start_y,
384 int size_x,
385 int size_y,
386 int rotate,
387 int flags) {
388 FFLCommon(hHandle, bitmap, nullptr, page, start_x, start_y, size_x, size_y,
389 rotate, flags);
390 }
391
392 #ifdef _SKIA_SUPPORT_
393 DLLEXPORT void STDCALL FPDF_FFLRecord(FPDF_FORMHANDLE hHandle,
394 FPDF_RECORDER recorder,
395 FPDF_PAGE page,
396 int start_x,
397 int start_y,
398 int size_x,
399 int size_y,
400 int rotate,
401 int flags) {
402 FFLCommon(hHandle, nullptr, recorder, page, start_x, start_y, size_x, size_y,
403 rotate, flags);
404 }
405 #endif
406
377 #ifdef PDF_ENABLE_XFA 407 #ifdef PDF_ENABLE_XFA
378 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, 408 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document,
379 FPDF_WIDGET hWidget) { 409 FPDF_WIDGET hWidget) {
380 if (NULL == hWidget || NULL == document) 410 if (NULL == hWidget || NULL == document)
381 return; 411 return;
382 412
383 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; 413 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
384 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && 414 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
385 pDocument->GetDocType() != XFA_DOCTYPE_Static) 415 pDocument->GetDocType() != XFA_DOCTYPE_Static)
386 return; 416 return;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); 753 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc);
724 } 754 }
725 } else { 755 } else {
726 if (aa.ActionExist(CPDF_AAction::ClosePage)) { 756 if (aa.ActionExist(CPDF_AAction::ClosePage)) {
727 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); 757 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage);
728 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); 758 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc);
729 } 759 }
730 } 760 }
731 } 761 }
732 } 762 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698