OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ | |
6 #define BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ | |
7 | |
8 #include "base/android/jni_android.h" | |
9 #include "base/macros.h" | |
10 #include "blimp/client/compositor/blimp_compositor.h" | |
11 #include "ui/gfx/geometry/size.h" | |
12 #include "ui/gfx/native_widget_types.h" | |
13 | |
14 namespace base { | |
15 class SingleThreadTaskRunner; | |
16 class Thread; | |
17 } | |
18 | |
19 namespace cc { | |
20 class LayerTreeHost; | |
21 } | |
22 | |
23 namespace blimp { | |
24 namespace client { | |
25 | |
26 class RenderWidgetFeature; | |
27 | |
28 // An Android specific version of the BlimpCompositor. This class builds a | |
29 // gfx::AcceleratedWidget out of an Android SurfaceView's surface. | |
30 class BlimpCompositorAndroid : public BlimpCompositor { | |
31 public: | |
32 // |real_size| is the total display area including system decorations (see | |
33 // android.view.Display.getRealSize()). |size| is the total display | |
34 // area not including system decorations (see android.view.Display.getSize()). | |
35 // |dp_to_px| is the scale factor that is required to convert from dp device | |
36 // pixels) to px. | |
37 static scoped_ptr<BlimpCompositorAndroid> Create( | |
38 const gfx::Size& real_size, | |
39 const gfx::Size& size, | |
40 float dp_to_px, | |
41 RenderWidgetFeature* render_widget_feature); | |
42 | |
43 ~BlimpCompositorAndroid() override; | |
44 | |
45 protected: | |
46 // |size| is the size of the display. |real_size_supported| determines | |
47 // whether or not this size is the real display size or the display size | |
48 // not including the system decorations. |dp_to_px| is the scale factor that | |
49 // is required to convert from dp (device pixels) to px. | |
50 BlimpCompositorAndroid(const gfx::Size& size, | |
51 bool real_size_supported, | |
52 float dp_to_px, | |
53 RenderWidgetFeature* render_widget_feature); | |
54 | |
55 // BlimpCompositor implementation. | |
56 void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings); | |
57 | |
58 private: | |
59 // Used to determine tile size for the compositor's rastered tiles. For a | |
60 // device of width X height |portrait_width_| will be min(width, height) and | |
61 // |landscape_width_| will be max(width, height). | |
62 int portrait_width_; | |
63 int landscape_width_; | |
64 | |
65 // True if the |portrait_width_| and |landscape_width_| represent the device's | |
66 // physical dimensions, including any area occupied by system decorations. | |
67 bool real_size_supported_; | |
68 | |
69 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorAndroid); | |
70 }; | |
71 | |
72 } // namespace client | |
73 } // namespace blimp | |
74 | |
75 #endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ | |
OLD | NEW |