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 real display area that can contain content including | |
30 // system decorations (See android.view.Display#getRealSize()). |display_size| | |
31 // is the display area that may contain an application window excluding | |
32 // system decorations (see android.view.Display#getSize()). | |
33 // |device_scale_factor| is the scale factor that is required to move from dp | |
34 // (device independent pixels) to pixels. | |
35 static scoped_ptr<BlimpCompositorAndroid> Create( | |
36 const gfx::Size& physical_size, | |
37 const gfx::Size& display_size, | |
38 float device_scale_factor); | |
39 | |
40 ~BlimpCompositorAndroid() override; | |
41 | |
42 // A strong reference to the ANativeWindow backing |jsurface| will be taken | |
43 // here. It will be released when the surface is replaced via another call | |
44 // to SetSurface or when this class dies. | |
Wez
2015/09/03 00:49:28
nit: This comment should be of the form:
Takes a
David Trainor- moved to gerrit
2015/09/03 06:33:22
Done.
| |
45 void SetSurface(JNIEnv* env, jobject jsurface); | |
46 | |
47 protected: | |
48 // |device_size| is the best representation of the real display area (some | |
49 // devices do not support it). |real_size_supported| represents whether or | |
50 // not |device_size| represents the real physical size or just the content | |
51 // area. |device_scale_factor| is the scale factor that is required to move | |
52 // from dp (device independent pixels) to pixels. | |
Wez
2015/09/03 00:49:28
nit: to device pixels.
David Trainor- moved to gerrit
2015/09/03 06:33:22
Done.
| |
53 BlimpCompositorAndroid(const gfx::Size& device_size, | |
54 bool real_size_supported, | |
55 float device_scale_factor); | |
56 | |
57 // BlimpCompositor implementation | |
58 gfx::AcceleratedWidget GetWindow() override; | |
59 void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings, | |
60 const base::CommandLine& cmd) override; | |
61 | |
62 private: | |
63 // These are used to determine tile size for the compositor's rastered tiles. | |
Wez
2015/09/03 00:49:28
nit: Drop "These are"
David Trainor- moved to gerrit
2015/09/03 06:33:22
Done.
| |
64 // For a device of width X height |portrait_width_| will be min(width, height) | |
65 // and |landscape_width_| will be max(width, height). | |
66 int portrait_width_; | |
67 int landscape_width_; | |
68 | |
69 // Whether or not |portrait_width_| and |landscape_width_| represent the real | |
70 // size of the device (includes the system decorations) or not. | |
Wez
2015/09/03 00:49:28
nit: Suggest "True if the |portrait_width_| and |l
David Trainor- moved to gerrit
2015/09/03 06:33:22
Done.
| |
71 bool real_size_supported_; | |
72 | |
73 gfx::AcceleratedWidget window_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorAndroid); | |
76 }; | |
77 | |
78 } // namespace blimp | |
79 | |
80 #endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ | |
OLD | NEW |