| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/android/display_android_manager.h" | 5 #include "ui/android/display_android_manager.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if (bounds_in_pixels.IsEmpty()) | 88 if (bounds_in_pixels.IsEmpty()) |
| 89 bounds_in_pixels = gfx::Rect(width, height); | 89 bounds_in_pixels = gfx::Rect(width, height); |
| 90 | 90 |
| 91 const gfx::Rect bounds_in_dip = gfx::Rect( | 91 const gfx::Rect bounds_in_dip = gfx::Rect( |
| 92 gfx::ScaleToCeiledSize(bounds_in_pixels.size(), 1.0f / dipScale)); | 92 gfx::ScaleToCeiledSize(bounds_in_pixels.size(), 1.0f / dipScale)); |
| 93 | 93 |
| 94 display::Display display(sdkDisplayId, bounds_in_dip); | 94 display::Display display(sdkDisplayId, bounds_in_dip); |
| 95 if (!Display::HasForceDeviceScaleFactor()) | 95 if (!Display::HasForceDeviceScaleFactor()) |
| 96 display.set_device_scale_factor(dipScale); | 96 display.set_device_scale_factor(dipScale); |
| 97 | 97 |
| 98 display.set_size_in_pixels(bounds_in_pixels.size()); |
| 98 display.SetRotationAsDegree(rotationDegrees); | 99 display.SetRotationAsDegree(rotationDegrees); |
| 99 display.set_color_depth(bitsPerPixel); | 100 display.set_color_depth(bitsPerPixel); |
| 100 display.set_depth_per_component(bitsPerComponent); | 101 display.set_depth_per_component(bitsPerComponent); |
| 101 display.set_is_monochrome(bitsPerComponent == 0); | 102 display.set_is_monochrome(bitsPerComponent == 0); |
| 102 | 103 |
| 103 ProcessDisplayChanged(display, sdkDisplayId == primary_display_id_); | 104 ProcessDisplayChanged(display, sdkDisplayId == primary_display_id_); |
| 104 } | 105 } |
| 105 | 106 |
| 106 void DisplayAndroidManager::RemoveDisplay( | 107 void DisplayAndroidManager::RemoveDisplay( |
| 107 JNIEnv* env, | 108 JNIEnv* env, |
| 108 const base::android::JavaParamRef<jobject>& jobject, | 109 const base::android::JavaParamRef<jobject>& jobject, |
| 109 jint sdkDisplayId) { | 110 jint sdkDisplayId) { |
| 110 display_list().RemoveDisplay(sdkDisplayId); | 111 display_list().RemoveDisplay(sdkDisplayId); |
| 111 } | 112 } |
| 112 | 113 |
| 113 void DisplayAndroidManager::SetPrimaryDisplayId( | 114 void DisplayAndroidManager::SetPrimaryDisplayId( |
| 114 JNIEnv* env, | 115 JNIEnv* env, |
| 115 const base::android::JavaParamRef<jobject>& jobject, | 116 const base::android::JavaParamRef<jobject>& jobject, |
| 116 jint sdkDisplayId) { | 117 jint sdkDisplayId) { |
| 117 primary_display_id_ = sdkDisplayId; | 118 primary_display_id_ = sdkDisplayId; |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace ui | 121 } // namespace ui |
| OLD | NEW |