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 // |real_size| is the total display area including system decorations (see |
| 30 // android.view.Display.getRealSize()). |size| is the total display |
| 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 |
| 33 // pixels) to px. |
| 34 static scoped_ptr<BlimpCompositorAndroid> Create(const gfx::Size& real_size, |
| 35 const gfx::Size& size, |
| 36 float dp_to_px); |
| 37 |
| 38 ~BlimpCompositorAndroid() override; |
| 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: |
| 45 // |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 |
| 47 // not including the system decorations. |dp_to_px| is the scale factor that |
| 48 // is required to convert from dp (device pixels) to px. |
| 49 BlimpCompositorAndroid(const gfx::Size& size, |
| 50 bool real_size_supported, |
| 51 float dp_to_px); |
| 52 |
| 53 // BlimpCompositor implementation. |
| 54 gfx::AcceleratedWidget GetWindow() override; |
| 55 void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings); |
| 56 |
| 57 private: |
| 58 // 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 |
| 60 // |landscape_width_| will be max(width, height). |
| 61 int portrait_width_; |
| 62 int landscape_width_; |
| 63 |
| 64 // True if the |portrait_width_| and |landscape_width_| represent the device's |
| 65 // physical dimensions, including any area occupied by system decorations. |
| 66 bool real_size_supported_; |
| 67 |
| 68 gfx::AcceleratedWidget window_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorAndroid); |
| 71 }; |
| 72 |
| 73 } // namespace blimp |
| 74 |
| 75 #endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ |
OLD | NEW |