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 #ifndef BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ | 5 #ifndef BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ |
6 #define BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ | 6 #define BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ |
7 | 7 |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "blimp/client/compositor/blimp_compositor.h" | 10 #include "blimp/client/compositor/blimp_compositor.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // android.view.Display.getRealSize()). |size| is the total display | 30 // android.view.Display.getRealSize()). |size| is the total display |
31 // area not including system decorations (see android.view.Display.getSize()). | 31 // area not including system decorations (see android.view.Display.getSize()). |
32 // |dp_to_px| is the scale factor that is required to convert from dp device | 32 // |dp_to_px| is the scale factor that is required to convert from dp device |
33 // pixels) to px. | 33 // pixels) to px. |
34 static scoped_ptr<BlimpCompositorAndroid> Create(const gfx::Size& real_size, | 34 static scoped_ptr<BlimpCompositorAndroid> Create(const gfx::Size& real_size, |
35 const gfx::Size& size, | 35 const gfx::Size& size, |
36 float dp_to_px); | 36 float dp_to_px); |
37 | 37 |
38 ~BlimpCompositorAndroid() override; | 38 ~BlimpCompositorAndroid() override; |
39 | 39 |
40 // Takes a reference to the ANativeWindow backing |jsurface|, to use to render | |
41 // to, and releases any previously-held reference. | |
42 void SetSurface(JNIEnv* env, jobject jsurface); | |
43 | |
44 protected: | 40 protected: |
45 // |size| is the size of the display. |real_size_supported| determines | 41 // |size| is the size of the display. |real_size_supported| determines |
46 // whether or not this size is the real display size or the display size | 42 // whether or not this size is the real display size or the display size |
47 // not including the system decorations. |dp_to_px| is the scale factor that | 43 // not including the system decorations. |dp_to_px| is the scale factor that |
48 // is required to convert from dp (device pixels) to px. | 44 // is required to convert from dp (device pixels) to px. |
49 BlimpCompositorAndroid(const gfx::Size& size, | 45 BlimpCompositorAndroid(const gfx::Size& size, |
50 bool real_size_supported, | 46 bool real_size_supported, |
51 float dp_to_px); | 47 float dp_to_px); |
52 | 48 |
53 // BlimpCompositor implementation. | 49 // BlimpCompositor implementation. |
54 gfx::AcceleratedWidget GetWindow() override; | |
55 void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings); | 50 void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings); |
56 | 51 |
57 private: | 52 private: |
58 // Used to determine tile size for the compositor's rastered tiles. For a | 53 // Used to determine tile size for the compositor's rastered tiles. For a |
59 // device of width X height |portrait_width_| will be min(width, height) and | 54 // device of width X height |portrait_width_| will be min(width, height) and |
60 // |landscape_width_| will be max(width, height). | 55 // |landscape_width_| will be max(width, height). |
61 int portrait_width_; | 56 int portrait_width_; |
62 int landscape_width_; | 57 int landscape_width_; |
63 | 58 |
64 // True if the |portrait_width_| and |landscape_width_| represent the device's | 59 // True if the |portrait_width_| and |landscape_width_| represent the device's |
65 // physical dimensions, including any area occupied by system decorations. | 60 // physical dimensions, including any area occupied by system decorations. |
66 bool real_size_supported_; | 61 bool real_size_supported_; |
67 | 62 |
68 gfx::AcceleratedWidget window_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorAndroid); | 63 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorAndroid); |
71 }; | 64 }; |
72 | 65 |
73 } // namespace blimp | 66 } // namespace blimp |
74 | 67 |
75 #endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ | 68 #endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ |
OLD | NEW |