| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/gfx/android/shared_device_display_info.h" | 5 #include "ui/gfx/android/shared_device_display_info.h" |
| 6 | 6 |
| 7 #include "base/android/context_utils.h" | 7 #include "base/android/context_utils.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 : display_height_(0), | 118 : display_height_(0), |
| 119 display_width_(0), | 119 display_width_(0), |
| 120 bits_per_pixel_(0), | 120 bits_per_pixel_(0), |
| 121 bits_per_component_(0), | 121 bits_per_component_(0), |
| 122 dip_scale_(0), | 122 dip_scale_(0), |
| 123 smallest_dip_width_(0) { | 123 smallest_dip_width_(0) { |
| 124 JNIEnv* env = base::android::AttachCurrentThread(); | 124 JNIEnv* env = base::android::AttachCurrentThread(); |
| 125 j_device_info_.Reset( | 125 j_device_info_.Reset( |
| 126 Java_DeviceDisplayInfo_create( | 126 Java_DeviceDisplayInfo_create( |
| 127 env, base::android::GetApplicationContext())); | 127 env, base::android::GetApplicationContext())); |
| 128 UpdateDisplayInfo(env, j_device_info_.obj(), | 128 UpdateDisplayInfo( |
| 129 Java_DeviceDisplayInfo_getDisplayHeight(env, j_device_info_.obj()), | 129 env, j_device_info_.obj(), |
| 130 Java_DeviceDisplayInfo_getDisplayWidth(env, j_device_info_.obj()), | 130 Java_DeviceDisplayInfo_getDisplayHeight(env, j_device_info_), |
| 131 Java_DeviceDisplayInfo_getPhysicalDisplayHeight(env, | 131 Java_DeviceDisplayInfo_getDisplayWidth(env, j_device_info_), |
| 132 j_device_info_.obj()), | 132 Java_DeviceDisplayInfo_getPhysicalDisplayHeight(env, j_device_info_), |
| 133 Java_DeviceDisplayInfo_getPhysicalDisplayWidth(env, j_device_info_.obj()), | 133 Java_DeviceDisplayInfo_getPhysicalDisplayWidth(env, j_device_info_), |
| 134 Java_DeviceDisplayInfo_getBitsPerPixel(env, j_device_info_.obj()), | 134 Java_DeviceDisplayInfo_getBitsPerPixel(env, j_device_info_), |
| 135 Java_DeviceDisplayInfo_getBitsPerComponent(env, j_device_info_.obj()), | 135 Java_DeviceDisplayInfo_getBitsPerComponent(env, j_device_info_), |
| 136 Java_DeviceDisplayInfo_getDIPScale(env, j_device_info_.obj()), | 136 Java_DeviceDisplayInfo_getDIPScale(env, j_device_info_), |
| 137 Java_DeviceDisplayInfo_getSmallestDIPWidth(env, j_device_info_.obj()), | 137 Java_DeviceDisplayInfo_getSmallestDIPWidth(env, j_device_info_), |
| 138 Java_DeviceDisplayInfo_getRotationDegrees(env, j_device_info_.obj())); | 138 Java_DeviceDisplayInfo_getRotationDegrees(env, j_device_info_)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 SharedDeviceDisplayInfo::~SharedDeviceDisplayInfo() { | 141 SharedDeviceDisplayInfo::~SharedDeviceDisplayInfo() { |
| 142 } | 142 } |
| 143 | 143 |
| 144 void SharedDeviceDisplayInfo::UpdateDisplayInfo(JNIEnv* env, | 144 void SharedDeviceDisplayInfo::UpdateDisplayInfo(JNIEnv* env, |
| 145 jobject jobj, | 145 jobject jobj, |
| 146 jint display_height, | 146 jint display_height, |
| 147 jint display_width, | 147 jint display_width, |
| 148 jint physical_display_height, | 148 jint physical_display_height, |
| 149 jint physical_display_width, | 149 jint physical_display_width, |
| 150 jint bits_per_pixel, | 150 jint bits_per_pixel, |
| 151 jint bits_per_component, | 151 jint bits_per_component, |
| 152 jdouble dip_scale, | 152 jdouble dip_scale, |
| 153 jint smallest_dip_width, | 153 jint smallest_dip_width, |
| 154 jint rotation_degrees) { | 154 jint rotation_degrees) { |
| 155 display_height_ = static_cast<int>(display_height); | 155 display_height_ = static_cast<int>(display_height); |
| 156 display_width_ = static_cast<int>(display_width); | 156 display_width_ = static_cast<int>(display_width); |
| 157 physical_display_height_ = static_cast<int>(physical_display_height); | 157 physical_display_height_ = static_cast<int>(physical_display_height); |
| 158 physical_display_width_ = static_cast<int>(physical_display_width); | 158 physical_display_width_ = static_cast<int>(physical_display_width); |
| 159 bits_per_pixel_ = static_cast<int>(bits_per_pixel); | 159 bits_per_pixel_ = static_cast<int>(bits_per_pixel); |
| 160 bits_per_component_ = static_cast<int>(bits_per_component); | 160 bits_per_component_ = static_cast<int>(bits_per_component); |
| 161 dip_scale_ = static_cast<double>(dip_scale); | 161 dip_scale_ = static_cast<double>(dip_scale); |
| 162 smallest_dip_width_ = static_cast<int>(smallest_dip_width); | 162 smallest_dip_width_ = static_cast<int>(smallest_dip_width); |
| 163 rotation_degrees_ = static_cast<int>(rotation_degrees); | 163 rotation_degrees_ = static_cast<int>(rotation_degrees); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace gfx | 166 } // namespace gfx |
| OLD | NEW |