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/instance.h" | 5 #include "pdf/instance.h" |
6 | 6 |
7 #include <algorithm> // for min() | 7 #include <algorithm> // for min() |
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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 return; | 947 return; |
948 } | 948 } |
949 } | 949 } |
950 | 950 |
951 pp::Rect location_dip = location; | 951 pp::Rect location_dip = location; |
952 ScaleRect(1.0f / device_scale_, &location_dip); | 952 ScaleRect(1.0f / device_scale_, &location_dip); |
953 | 953 |
954 DCHECK(!image_data_.is_null()); | 954 DCHECK(!image_data_.is_null()); |
955 widget->Paint(location_dip, &image_data_); | 955 widget->Paint(location_dip, &image_data_); |
956 | 956 |
957 // Re-scale the rectangle from DIPs to device pixels, so we ensure that we | |
958 // don't miss any pixels due to rounding outwards in ScaleRect. | |
959 location = location_dip; | |
960 ScaleRect(device_scale_, &location); | |
961 | |
962 ready->push_back(PaintManager::ReadyRect(location, image_data_, true)); | 957 ready->push_back(PaintManager::ReadyRect(location, image_data_, true)); |
963 } | 958 } |
964 | 959 |
965 void Instance::OnTimerFired(int32_t) { | 960 void Instance::OnTimerFired(int32_t) { |
966 HandleInputEvent(last_mouse_event_); | 961 HandleInputEvent(last_mouse_event_); |
967 } | 962 } |
968 | 963 |
969 void Instance::OnClientTimerFired(int32_t id) { | 964 void Instance::OnClientTimerFired(int32_t id) { |
970 engine_->OnCallback(id); | 965 engine_->OnCallback(id); |
971 } | 966 } |
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 return instance_->HasScriptableMethod(name, exception); | 2714 return instance_->HasScriptableMethod(name, exception); |
2720 } | 2715 } |
2721 | 2716 |
2722 pp::Var PDFScriptableObject::Call(const pp::Var& method, | 2717 pp::Var PDFScriptableObject::Call(const pp::Var& method, |
2723 const std::vector<pp::Var>& args, | 2718 const std::vector<pp::Var>& args, |
2724 pp::Var* exception) { | 2719 pp::Var* exception) { |
2725 return instance_->CallScriptableMethod(method, args, exception); | 2720 return instance_->CallScriptableMethod(method, args, exception); |
2726 } | 2721 } |
2727 | 2722 |
2728 } // namespace chrome_pdf | 2723 } // namespace chrome_pdf |
OLD | NEW |