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 pp::ImageData resource_data; | |
2507 if (hidpi_enabled_) | 2508 if (hidpi_enabled_) |
2508 return pp::PDF::GetResourceImageForScale(this, image_id, device_scale_); | 2509 resource_data = |
Lei Zhang
2014/08/20 04:21:17
nit: braces around the if block body.
sadrul
2014/08/20 04:44:40
Done.
| |
2510 pp::PDF::GetResourceImageForScale(this, image_id, device_scale_); | |
2509 | 2511 |
2510 return pp::PDF::GetResourceImage(this, image_id); | 2512 return resource_data.data() ? resource_data |
2513 : pp::PDF::GetResourceImage(this, image_id); | |
2511 } | 2514 } |
2512 | 2515 |
2513 std::string Instance::GetLocalizedString(PP_ResourceString id) { | 2516 std::string Instance::GetLocalizedString(PP_ResourceString id) { |
2514 pp::Var rv(pp::PDF::GetLocalizedString(this, id)); | 2517 pp::Var rv(pp::PDF::GetLocalizedString(this, id)); |
2515 if (!rv.is_string()) | 2518 if (!rv.is_string()) |
2516 return std::string(); | 2519 return std::string(); |
2517 | 2520 |
2518 return rv.AsString(); | 2521 return rv.AsString(); |
2519 } | 2522 } |
2520 | 2523 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2722 return instance_->HasScriptableMethod(name, exception); | 2725 return instance_->HasScriptableMethod(name, exception); |
2723 } | 2726 } |
2724 | 2727 |
2725 pp::Var PDFScriptableObject::Call(const pp::Var& method, | 2728 pp::Var PDFScriptableObject::Call(const pp::Var& method, |
2726 const std::vector<pp::Var>& args, | 2729 const std::vector<pp::Var>& args, |
2727 pp::Var* exception) { | 2730 pp::Var* exception) { |
2728 return instance_->CallScriptableMethod(method, args, exception); | 2731 return instance_->CallScriptableMethod(method, args, exception); |
2729 } | 2732 } |
2730 | 2733 |
2731 } // namespace chrome_pdf | 2734 } // namespace chrome_pdf |
OLD | NEW |