| 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/out_of_process_instance.h" | 5 #include "pdf/out_of_process_instance.h" |
| 6 | 6 |
| 7 #include <algorithm> // for min/max() | 7 #include <algorithm> // for min/max() |
| 8 #define _USE_MATH_DEFINES // for M_PI | 8 #define _USE_MATH_DEFINES // for M_PI |
| 9 #include <cmath> // for log() and pow() | 9 #include <cmath> // for log() and pow() |
| 10 #include <math.h> | 10 #include <math.h> |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 engine_->ScrolledToYPosition(scroll_offset_float.y() * device_scale_); | 603 engine_->ScrolledToYPosition(scroll_offset_float.y() * device_scale_); |
| 604 } | 604 } |
| 605 } | 605 } |
| 606 | 606 |
| 607 void OutOfProcessInstance::GetPrintPresetOptionsFromDocument( | 607 void OutOfProcessInstance::GetPrintPresetOptionsFromDocument( |
| 608 PP_PdfPrintPresetOptions_Dev* options) { | 608 PP_PdfPrintPresetOptions_Dev* options) { |
| 609 options->is_scaling_disabled = PP_FromBool(IsPrintScalingDisabled()); | 609 options->is_scaling_disabled = PP_FromBool(IsPrintScalingDisabled()); |
| 610 options->duplex = | 610 options->duplex = |
| 611 static_cast<PP_PrivateDuplexMode_Dev>(engine_->GetDuplexType()); | 611 static_cast<PP_PrivateDuplexMode_Dev>(engine_->GetDuplexType()); |
| 612 options->copies = engine_->GetCopiesToPrint(); | 612 options->copies = engine_->GetCopiesToPrint(); |
| 613 pp::Size uniform_page_size; |
| 614 options->is_page_size_uniform = |
| 615 PP_FromBool(engine_->GetPageSizeAndUniformity(&uniform_page_size)); |
| 616 options->uniform_page_size = uniform_page_size; |
| 613 } | 617 } |
| 614 | 618 |
| 615 pp::Var OutOfProcessInstance::GetLinkAtPosition( | 619 pp::Var OutOfProcessInstance::GetLinkAtPosition( |
| 616 const pp::Point& point) { | 620 const pp::Point& point) { |
| 617 pp::Point offset_point(point); | 621 pp::Point offset_point(point); |
| 618 ScalePoint(device_scale_, &offset_point); | 622 ScalePoint(device_scale_, &offset_point); |
| 619 offset_point.set_x(offset_point.x() - available_area_.x()); | 623 offset_point.set_x(offset_point.x() - available_area_.x()); |
| 620 return engine_->GetLinkAtPosition(offset_point); | 624 return engine_->GetLinkAtPosition(offset_point); |
| 621 } | 625 } |
| 622 | 626 |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1417 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
| 1414 const pp::FloatPoint& scroll_offset) { | 1418 const pp::FloatPoint& scroll_offset) { |
| 1415 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1419 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
| 1416 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1420 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
| 1417 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1421 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
| 1418 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1422 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
| 1419 return pp::FloatPoint(x, y); | 1423 return pp::FloatPoint(x, y); |
| 1420 } | 1424 } |
| 1421 | 1425 |
| 1422 } // namespace chrome_pdf | 1426 } // namespace chrome_pdf |
| OLD | NEW |