| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/app/android/blimp_compositor_manager_android.h" | 5 #include "blimp/client/app/android/blimp_compositor_manager_android.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 // The minimum valid content width in a tile. This is used to make sure the | 15 // The minimum valid content width in a tile. This is used to make sure the |
| 16 // width of the content on the rightmost tile isn't a tiny sliver. | 16 // width of the content on the rightmost tile isn't a tiny sliver. |
| 17 const int kMinimumTileContentWidthPixels = 64; | 17 const int kMinimumTileContentWidthPixels = 64; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace blimp { | 20 namespace blimp { |
| 21 namespace client { | 21 namespace client { |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 std::unique_ptr<BlimpCompositorManagerAndroid> | 24 std::unique_ptr<BlimpCompositorManagerAndroid> |
| 25 BlimpCompositorManagerAndroid::Create( | 25 BlimpCompositorManagerAndroid::Create( |
| 26 const gfx::Size& real_size, | 26 const gfx::Size& real_size, |
| 27 const gfx::Size& size, | 27 const gfx::Size& size, |
| 28 RenderWidgetFeature* render_widget_feature, | 28 RenderWidgetFeature* render_widget_feature) { |
| 29 BlimpCompositorManagerClient* client) { | |
| 30 gfx::Size device_size(real_size); | 29 gfx::Size device_size(real_size); |
| 31 bool real_size_supported = true; | 30 bool real_size_supported = true; |
| 32 if (device_size.IsEmpty()) { | 31 if (device_size.IsEmpty()) { |
| 33 real_size_supported = false; | 32 real_size_supported = false; |
| 34 device_size = size; | 33 device_size = size; |
| 35 } | 34 } |
| 36 return base::WrapUnique(new BlimpCompositorManagerAndroid( | 35 return base::WrapUnique(new BlimpCompositorManagerAndroid( |
| 37 device_size, real_size_supported, render_widget_feature, client)); | 36 device_size, real_size_supported, render_widget_feature)); |
| 38 } | 37 } |
| 39 | 38 |
| 40 BlimpCompositorManagerAndroid::BlimpCompositorManagerAndroid( | 39 BlimpCompositorManagerAndroid::BlimpCompositorManagerAndroid( |
| 41 const gfx::Size& size, | 40 const gfx::Size& size, |
| 42 bool real_size_supported, | 41 bool real_size_supported, |
| 43 RenderWidgetFeature* render_widget_feature, | 42 RenderWidgetFeature* render_widget_feature) |
| 44 BlimpCompositorManagerClient* client) | 43 : BlimpCompositorManager(render_widget_feature), |
| 45 : BlimpCompositorManager(render_widget_feature, client), | |
| 46 portrait_width_(std::min(size.width(), size.height())), | 44 portrait_width_(std::min(size.width(), size.height())), |
| 47 landscape_width_(std::max(size.width(), size.height())), | 45 landscape_width_(std::max(size.width(), size.height())), |
| 48 real_size_supported_(real_size_supported) {} | 46 real_size_supported_(real_size_supported) {} |
| 49 | 47 |
| 50 BlimpCompositorManagerAndroid::~BlimpCompositorManagerAndroid() {} | 48 BlimpCompositorManagerAndroid::~BlimpCompositorManagerAndroid() {} |
| 51 | 49 |
| 52 void BlimpCompositorManagerAndroid::GenerateLayerTreeSettings( | 50 void BlimpCompositorManagerAndroid::GenerateLayerTreeSettings( |
| 53 cc::LayerTreeSettings* settings) { | 51 cc::LayerTreeSettings* settings) { |
| 54 BlimpCompositorManager::GenerateLayerTreeSettings(settings); | 52 BlimpCompositorManager::GenerateLayerTreeSettings(settings); |
| 55 | 53 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (numTiles > 16) | 88 if (numTiles > 16) |
| 91 default_tile_size = 384; | 89 default_tile_size = 384; |
| 92 if (numTiles >= 40) | 90 if (numTiles >= 40) |
| 93 default_tile_size = 512; | 91 default_tile_size = 512; |
| 94 } | 92 } |
| 95 settings->default_tile_size.SetSize(default_tile_size, default_tile_size); | 93 settings->default_tile_size.SetSize(default_tile_size, default_tile_size); |
| 96 } | 94 } |
| 97 | 95 |
| 98 } // namespace client | 96 } // namespace client |
| 99 } // namespace blimp | 97 } // namespace blimp |
| OLD | NEW |