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 | |
25 // An Android specific version of the BlimpCompositor. This class builds a | |
26 // gfx::AcceleratedWidget out of an Android SurfaceView's surface. | |
27 class BlimpCompositorAndroid : public BlimpCompositor { | |
28 public: | |
29 // |physical_size| is the total display area including system decorations (see | |
30 // android.view.Display.getRealSize()). |display_size| is the total display | |
31 // area not including system decorations (see android.view.Display.getSize()). | |
32 // |dp_to_pixel| is the scale factor that is required to move from dp | |
33 // (device pixels) to pixels. | |
Wez
2015/09/03 18:26:11
See comment on the BlimpView and note that you've
David Trainor- moved to gerrit
2015/09/03 19:06:01
Done.
| |
34 static scoped_ptr<BlimpCompositorAndroid> Create( | |
35 const gfx::Size& physical_size, | |
36 const gfx::Size& display_size, | |
37 float device_scale_factor); | |
38 | |
39 ~BlimpCompositorAndroid() override; | |
40 | |
41 // Takes a reference to the ANativeWindow backing |jsurface|, to use to render | |
42 // to, and releases any previously-held reference. | |
43 void SetSurface(JNIEnv* env, jobject jsurface); | |
44 | |
45 protected: | |
46 // |physical_size| is the total display area including system decorations (see | |
47 // android.view.Display.getRealSize()). |display_size| is the total display | |
48 // area not including system decorations (see android.view.Display.getSize()). | |
49 // |dp_to_pixel| is the scale factor that is required to move from dp | |
50 // (device pixels) to pixels. | |
Wez
2015/09/03 18:26:11
This is a copy of the comment on Create() - it doe
David Trainor- moved to gerrit
2015/09/03 19:06:01
Yeah my bad. Fixed this.
| |
51 BlimpCompositorAndroid(const gfx::Size& device_size, | |
52 bool real_size_supported, | |
53 float device_scale_factor); | |
54 | |
55 // BlimpCompositor implementation. | |
56 gfx::AcceleratedWidget GetWindow() override; | |
57 void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings); | |
58 | |
59 private: | |
60 // Used to determine tile size for the compositor's rastered tiles. For a | |
61 // device of width X height |portrait_width_| will be min(width, height) and | |
62 // |landscape_width_| will be max(width, height). | |
63 int portrait_width_; | |
64 int landscape_width_; | |
65 | |
66 // True if the |portrait_width_| and |landscape_width_| represent the device's | |
67 // physical dimensions, including any area occupied by system decorations. | |
68 bool real_size_supported_; | |
69 | |
70 gfx::AcceleratedWidget window_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorAndroid); | |
73 }; | |
74 | |
75 } // namespace blimp | |
76 | |
77 #endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ | |
OLD | NEW |