| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "pdf/pdfium/pdfium_engine.h" | 5 #include "pdf/pdfium/pdfium_engine.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 last_page_to_search_(-1), | 544 last_page_to_search_(-1), |
| 545 last_character_index_to_search_(-1), | 545 last_character_index_to_search_(-1), |
| 546 permissions_(0), | 546 permissions_(0), |
| 547 permissions_handler_revision_(-1), | 547 permissions_handler_revision_(-1), |
| 548 fpdf_availability_(nullptr), | 548 fpdf_availability_(nullptr), |
| 549 next_timer_id_(0), | 549 next_timer_id_(0), |
| 550 last_page_mouse_down_(-1), | 550 last_page_mouse_down_(-1), |
| 551 most_visible_page_(-1), | 551 most_visible_page_(-1), |
| 552 called_do_document_action_(false), | 552 called_do_document_action_(false), |
| 553 render_grayscale_(false), | 553 render_grayscale_(false), |
| 554 render_annots_(true), |
| 554 progressive_paint_timeout_(0), | 555 progressive_paint_timeout_(0), |
| 555 getting_password_(false) { | 556 getting_password_(false) { |
| 556 find_factory_.Initialize(this); | 557 find_factory_.Initialize(this); |
| 557 password_factory_.Initialize(this); | 558 password_factory_.Initialize(this); |
| 558 | 559 |
| 559 file_access_.m_FileLen = 0; | 560 file_access_.m_FileLen = 0; |
| 560 file_access_.m_GetBlock = &GetBlock; | 561 file_access_.m_GetBlock = &GetBlock; |
| 561 file_access_.m_Param = &doc_loader_; | 562 file_access_.m_Param = &doc_loader_; |
| 562 | 563 |
| 563 file_availability_.version = 1; | 564 file_availability_.version = 1; |
| (...skipping 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2979 *size_x = page_rect.width(); | 2980 *size_x = page_rect.width(); |
| 2980 *size_y = page_rect.height(); | 2981 *size_y = page_rect.height(); |
| 2981 } | 2982 } |
| 2982 | 2983 |
| 2983 int PDFiumEngine::GetRenderingFlags() const { | 2984 int PDFiumEngine::GetRenderingFlags() const { |
| 2984 int flags = FPDF_LCD_TEXT | FPDF_NO_CATCH; | 2985 int flags = FPDF_LCD_TEXT | FPDF_NO_CATCH; |
| 2985 if (render_grayscale_) | 2986 if (render_grayscale_) |
| 2986 flags |= FPDF_GRAYSCALE; | 2987 flags |= FPDF_GRAYSCALE; |
| 2987 if (client_->IsPrintPreview()) | 2988 if (client_->IsPrintPreview()) |
| 2988 flags |= FPDF_PRINTING; | 2989 flags |= FPDF_PRINTING; |
| 2990 if (render_annots_) |
| 2991 flags |= FPDF_ANNOT; |
| 2989 return flags; | 2992 return flags; |
| 2990 } | 2993 } |
| 2991 | 2994 |
| 2992 pp::Rect PDFiumEngine::GetVisibleRect() const { | 2995 pp::Rect PDFiumEngine::GetVisibleRect() const { |
| 2993 pp::Rect rv; | 2996 pp::Rect rv; |
| 2994 rv.set_x(static_cast<int>(position_.x() / current_zoom_)); | 2997 rv.set_x(static_cast<int>(position_.x() / current_zoom_)); |
| 2995 rv.set_y(static_cast<int>(position_.y() / current_zoom_)); | 2998 rv.set_y(static_cast<int>(position_.y() / current_zoom_)); |
| 2996 rv.set_width(static_cast<int>(ceil(plugin_size_.width() / current_zoom_))); | 2999 rv.set_width(static_cast<int>(ceil(plugin_size_.width() / current_zoom_))); |
| 2997 rv.set_height(static_cast<int>(ceil(plugin_size_.height() / current_zoom_))); | 3000 rv.set_height(static_cast<int>(ceil(plugin_size_.height() / current_zoom_))); |
| 2998 return rv; | 3001 return rv; |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3972 FPDF_DOCUMENT doc = | 3975 FPDF_DOCUMENT doc = |
| 3973 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 3976 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
| 3974 if (!doc) | 3977 if (!doc) |
| 3975 return false; | 3978 return false; |
| 3976 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3979 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 3977 FPDF_CloseDocument(doc); | 3980 FPDF_CloseDocument(doc); |
| 3978 return success; | 3981 return success; |
| 3979 } | 3982 } |
| 3980 | 3983 |
| 3981 } // namespace chrome_pdf | 3984 } // namespace chrome_pdf |
| OLD | NEW |