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 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2497 for (size_t i = chrome_page_zoom::kPresetZoomFactorsSize; i > 0; --i) { | 2497 for (size_t i = chrome_page_zoom::kPresetZoomFactorsSize; i > 0; --i) { |
2498 double current_zoom = chrome_page_zoom::kPresetZoomFactors[i - 1]; | 2498 double current_zoom = chrome_page_zoom::kPresetZoomFactors[i - 1]; |
2499 if (current_zoom + content::kEpsilon < zoom_) | 2499 if (current_zoom + content::kEpsilon < zoom_) |
2500 return current_zoom; | 2500 return current_zoom; |
2501 } | 2501 } |
2502 } | 2502 } |
2503 return zoom_; | 2503 return zoom_; |
2504 } | 2504 } |
2505 | 2505 |
2506 pp::ImageData Instance::CreateResourceImage(PP_ResourceImage image_id) { | 2506 pp::ImageData Instance::CreateResourceImage(PP_ResourceImage image_id) { |
2507 if (hidpi_enabled_) | 2507 pp::ImageData resource_data; |
2508 return pp::PDF::GetResourceImageForScale(this, image_id, device_scale_); | 2508 if (hidpi_enabled_) { |
| 2509 resource_data = |
| 2510 pp::PDF::GetResourceImageForScale(this, image_id, device_scale_); |
| 2511 } |
2509 | 2512 |
2510 return pp::PDF::GetResourceImage(this, image_id); | 2513 return resource_data.data() ? resource_data |
| 2514 : pp::PDF::GetResourceImage(this, image_id); |
2511 } | 2515 } |
2512 | 2516 |
2513 std::string Instance::GetLocalizedString(PP_ResourceString id) { | 2517 std::string Instance::GetLocalizedString(PP_ResourceString id) { |
2514 pp::Var rv(pp::PDF::GetLocalizedString(this, id)); | 2518 pp::Var rv(pp::PDF::GetLocalizedString(this, id)); |
2515 if (!rv.is_string()) | 2519 if (!rv.is_string()) |
2516 return std::string(); | 2520 return std::string(); |
2517 | 2521 |
2518 return rv.AsString(); | 2522 return rv.AsString(); |
2519 } | 2523 } |
2520 | 2524 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2722 return instance_->HasScriptableMethod(name, exception); | 2726 return instance_->HasScriptableMethod(name, exception); |
2723 } | 2727 } |
2724 | 2728 |
2725 pp::Var PDFScriptableObject::Call(const pp::Var& method, | 2729 pp::Var PDFScriptableObject::Call(const pp::Var& method, |
2726 const std::vector<pp::Var>& args, | 2730 const std::vector<pp::Var>& args, |
2727 pp::Var* exception) { | 2731 pp::Var* exception) { |
2728 return instance_->CallScriptableMethod(method, args, exception); | 2732 return instance_->CallScriptableMethod(method, args, exception); |
2729 } | 2733 } |
2730 | 2734 |
2731 } // namespace chrome_pdf | 2735 } // namespace chrome_pdf |
OLD | NEW |