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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 engine_->ScrolledToYPosition(scroll_offset_float.y() * device_scale_); | 599 engine_->ScrolledToYPosition(scroll_offset_float.y() * device_scale_); |
600 } | 600 } |
601 } | 601 } |
602 | 602 |
603 void OutOfProcessInstance::GetPrintPresetOptionsFromDocument( | 603 void OutOfProcessInstance::GetPrintPresetOptionsFromDocument( |
604 PP_PdfPrintPresetOptions_Dev* options) { | 604 PP_PdfPrintPresetOptions_Dev* options) { |
605 options->is_scaling_disabled = PP_FromBool(IsPrintScalingDisabled()); | 605 options->is_scaling_disabled = PP_FromBool(IsPrintScalingDisabled()); |
606 options->duplex = | 606 options->duplex = |
607 static_cast<PP_PrivateDuplexMode_Dev>(engine_->GetDuplexType()); | 607 static_cast<PP_PrivateDuplexMode_Dev>(engine_->GetDuplexType()); |
608 options->copies = engine_->GetCopiesToPrint(); | 608 options->copies = engine_->GetCopiesToPrint(); |
609 pp::Size uniform_page_size; | |
610 options->is_page_size_uniform = | |
611 PP_FromBool(engine_->GetPageSizeAndUniformity(&uniform_page_size)); | |
612 options->uniform_page_size = PP_Size(uniform_page_size); | |
raymes
2015/03/09 00:12:31
is this a cast? Can you just do:
options->uniform_
Lei Zhang
2015/03/09 22:03:26
Done. I wasn't sure whether this was doable: PP_Si
| |
609 } | 613 } |
610 | 614 |
611 pp::Var OutOfProcessInstance::GetLinkAtPosition( | 615 pp::Var OutOfProcessInstance::GetLinkAtPosition( |
612 const pp::Point& point) { | 616 const pp::Point& point) { |
613 pp::Point offset_point(point); | 617 pp::Point offset_point(point); |
614 ScalePoint(device_scale_, &offset_point); | 618 ScalePoint(device_scale_, &offset_point); |
615 offset_point.set_x(offset_point.x() - available_area_.x()); | 619 offset_point.set_x(offset_point.x() - available_area_.x()); |
616 return engine_->GetLinkAtPosition(offset_point); | 620 return engine_->GetLinkAtPosition(offset_point); |
617 } | 621 } |
618 | 622 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1409 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( | 1413 pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( |
1410 const pp::FloatPoint& scroll_offset) { | 1414 const pp::FloatPoint& scroll_offset) { |
1411 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); | 1415 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); |
1412 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); | 1416 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); |
1413 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); | 1417 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); |
1414 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); | 1418 float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); |
1415 return pp::FloatPoint(x, y); | 1419 return pp::FloatPoint(x, y); |
1416 } | 1420 } |
1417 | 1421 |
1418 } // namespace chrome_pdf | 1422 } // namespace chrome_pdf |
OLD | NEW |