| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium 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 #include <limits.h> | 5 #include <limits.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <wchar.h> | 9 #include <wchar.h> |
| 10 | 10 |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 } | 407 } |
| 408 | 408 |
| 409 int Get_Block(void* param, unsigned long pos, unsigned char* pBuf, | 409 int Get_Block(void* param, unsigned long pos, unsigned char* pBuf, |
| 410 unsigned long size) { | 410 unsigned long size) { |
| 411 TestLoader* pLoader = (TestLoader*) param; | 411 TestLoader* pLoader = (TestLoader*) param; |
| 412 if (pos + size < pos || pos + size > pLoader->m_Len) return 0; | 412 if (pos + size < pos || pos + size > pLoader->m_Len) return 0; |
| 413 memcpy(pBuf, pLoader->m_pBuf + pos, size); | 413 memcpy(pBuf, pLoader->m_pBuf + pos, size); |
| 414 return 1; | 414 return 1; |
| 415 } | 415 } |
| 416 | 416 |
| 417 bool Is_Data_Avail(FX_FILEAVAIL* pThis, size_t offset, size_t size) { | 417 FPDF_BOOL Is_Data_Avail(FX_FILEAVAIL* pThis, size_t offset, size_t size) { |
| 418 return true; | 418 return true; |
| 419 } | 419 } |
| 420 | 420 |
| 421 void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) { | 421 void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) { |
| 422 } | 422 } |
| 423 | 423 |
| 424 void RenderPdf(const std::string& name, const char* pBuf, size_t len, | 424 void RenderPdf(const std::string& name, const char* pBuf, size_t len, |
| 425 const Options& options) { | 425 const Options& options) { |
| 426 fprintf(stderr, "Rendering PDF file %s.\n", name.c_str()); | 426 fprintf(stderr, "Rendering PDF file %s.\n", name.c_str()); |
| 427 | 427 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 { | 471 { |
| 472 fprintf(stderr, "Load pdf docs unsuccessful.\n"); | 472 fprintf(stderr, "Load pdf docs unsuccessful.\n"); |
| 473 return; | 473 return; |
| 474 } | 474 } |
| 475 | 475 |
| 476 (void) FPDF_GetDocPermissions(doc); | 476 (void) FPDF_GetDocPermissions(doc); |
| 477 (void) FPDFAvail_IsFormAvail(pdf_avail, &hints); | 477 (void) FPDFAvail_IsFormAvail(pdf_avail, &hints); |
| 478 | 478 |
| 479 FPDF_FORMHANDLE form = FPDFDOC_InitFormFillEnvironment(doc, &form_callbacks); | 479 FPDF_FORMHANDLE form = FPDFDOC_InitFormFillEnvironment(doc, &form_callbacks); |
| 480 int docType = DOCTYPE_PDF; | 480 int docType = DOCTYPE_PDF; |
| 481 if (FPDF_HasXFAField(doc, docType)) | 481 if (FPDF_HasXFAField(doc, &docType)) |
| 482 { | 482 { |
| 483 if (docType != DOCTYPE_PDF && !FPDF_LoadXFA(doc)) | 483 if (docType != DOCTYPE_PDF && !FPDF_LoadXFA(doc)) |
| 484 fprintf(stderr, "LoadXFA unsuccessful, continuing anyway.\n"); | 484 fprintf(stderr, "LoadXFA unsuccessful, continuing anyway.\n"); |
| 485 } | 485 } |
| 486 FPDF_SetFormFieldHighlightColor(form, 0, 0xFFE4DD); | 486 FPDF_SetFormFieldHighlightColor(form, 0, 0xFFE4DD); |
| 487 FPDF_SetFormFieldHighlightAlpha(form, 100); | 487 FPDF_SetFormFieldHighlightAlpha(form, 100); |
| 488 | 488 |
| 489 int first_page = FPDFAvail_GetFirstPageNum(doc); | 489 int first_page = FPDFAvail_GetFirstPageNum(doc); |
| 490 (void) FPDFAvail_IsPageAvail(pdf_avail, first_page, &hints); | 490 (void) FPDFAvail_IsPageAvail(pdf_avail, first_page, &hints); |
| 491 | 491 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 RenderPdf(filename, file_contents, file_length, options); | 626 RenderPdf(filename, file_contents, file_length, options); |
| 627 free(file_contents); | 627 free(file_contents); |
| 628 } | 628 } |
| 629 | 629 |
| 630 FPDF_DestroyLibrary(); | 630 FPDF_DestroyLibrary(); |
| 631 v8::V8::ShutdownPlatform(); | 631 v8::V8::ShutdownPlatform(); |
| 632 delete platform; | 632 delete platform; |
| 633 | 633 |
| 634 return 0; | 634 return 0; |
| 635 } | 635 } |
| OLD | NEW |