| 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) { |
| 29 gfx::Size device_size(real_size); | 30 gfx::Size device_size(real_size); |
| 30 bool real_size_supported = true; | 31 bool real_size_supported = true; |
| 31 if (device_size.IsEmpty()) { | 32 if (device_size.IsEmpty()) { |
| 32 real_size_supported = false; | 33 real_size_supported = false; |
| 33 device_size = size; | 34 device_size = size; |
| 34 } | 35 } |
| 35 return base::WrapUnique(new BlimpCompositorManagerAndroid( | 36 return base::WrapUnique(new BlimpCompositorManagerAndroid( |
| 36 device_size, real_size_supported, render_widget_feature)); | 37 device_size, real_size_supported, render_widget_feature, client)); |
| 37 } | 38 } |
| 38 | 39 |
| 39 BlimpCompositorManagerAndroid::BlimpCompositorManagerAndroid( | 40 BlimpCompositorManagerAndroid::BlimpCompositorManagerAndroid( |
| 40 const gfx::Size& size, | 41 const gfx::Size& size, |
| 41 bool real_size_supported, | 42 bool real_size_supported, |
| 42 RenderWidgetFeature* render_widget_feature) | 43 RenderWidgetFeature* render_widget_feature, |
| 43 : BlimpCompositorManager(render_widget_feature), | 44 BlimpCompositorManagerClient* client) |
| 45 : BlimpCompositorManager(render_widget_feature, client), |
| 44 portrait_width_(std::min(size.width(), size.height())), | 46 portrait_width_(std::min(size.width(), size.height())), |
| 45 landscape_width_(std::max(size.width(), size.height())), | 47 landscape_width_(std::max(size.width(), size.height())), |
| 46 real_size_supported_(real_size_supported) {} | 48 real_size_supported_(real_size_supported) {} |
| 47 | 49 |
| 48 BlimpCompositorManagerAndroid::~BlimpCompositorManagerAndroid() {} | 50 BlimpCompositorManagerAndroid::~BlimpCompositorManagerAndroid() {} |
| 49 | 51 |
| 50 void BlimpCompositorManagerAndroid::GenerateLayerTreeSettings( | 52 void BlimpCompositorManagerAndroid::GenerateLayerTreeSettings( |
| 51 cc::LayerTreeSettings* settings) { | 53 cc::LayerTreeSettings* settings) { |
| 52 BlimpCompositorManager::GenerateLayerTreeSettings(settings); | 54 BlimpCompositorManager::GenerateLayerTreeSettings(settings); |
| 53 | 55 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if (numTiles > 16) | 90 if (numTiles > 16) |
| 89 default_tile_size = 384; | 91 default_tile_size = 384; |
| 90 if (numTiles >= 40) | 92 if (numTiles >= 40) |
| 91 default_tile_size = 512; | 93 default_tile_size = 512; |
| 92 } | 94 } |
| 93 settings->default_tile_size.SetSize(default_tile_size, default_tile_size); | 95 settings->default_tile_size.SetSize(default_tile_size, default_tile_size); |
| 94 } | 96 } |
| 95 | 97 |
| 96 } // namespace client | 98 } // namespace client |
| 97 } // namespace blimp | 99 } // namespace blimp |
| OLD | NEW |