| 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_H_ | 5 #ifndef BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_H_ |
| 6 #define BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_H_ | 6 #define BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // surface this compositor draws to is defined by the gfx::AcceleratedWidget set | 39 // surface this compositor draws to is defined by the gfx::AcceleratedWidget set |
| 40 // by SetAcceleratedWidget(). This class should only be accessed from the main | 40 // by SetAcceleratedWidget(). This class should only be accessed from the main |
| 41 // thread. Any interaction with the compositing thread should happen through | 41 // thread. Any interaction with the compositing thread should happen through |
| 42 // the LayerTreeHost or RemoteChannelImpl. | 42 // the LayerTreeHost or RemoteChannelImpl. |
| 43 class BLIMP_CLIENT_EXPORT BlimpCompositor | 43 class BLIMP_CLIENT_EXPORT BlimpCompositor |
| 44 : public cc::LayerTreeHostClient, | 44 : public cc::LayerTreeHostClient, |
| 45 public cc::RemoteProtoChannel, | 45 public cc::RemoteProtoChannel, |
| 46 public RenderWidgetFeature::RenderWidgetFeatureDelegate, | 46 public RenderWidgetFeature::RenderWidgetFeatureDelegate, |
| 47 public BlimpInputManagerClient { | 47 public BlimpInputManagerClient { |
| 48 public: | 48 public: |
| 49 // |dp_to_px| is the scale factor required to move from dp (device pixels) to |
| 50 // px. See https://developer.android.com/guide/practices/screens_support.html |
| 51 // for more details. |
| 52 BlimpCompositor(float dp_to_px, RenderWidgetFeature* render_widget_feature); |
| 53 |
| 49 ~BlimpCompositor() override; | 54 ~BlimpCompositor() override; |
| 50 | 55 |
| 51 // Default layer settings for all Blimp layer instances. | 56 // Default layer settings for all Blimp layer instances. |
| 52 static cc::LayerSettings LayerSettings(); | 57 static cc::LayerSettings LayerSettings(); |
| 53 | 58 |
| 54 // Sets whether or not this compositor actually draws to the output surface. | 59 // Sets whether or not this compositor actually draws to the output surface. |
| 55 // Setting this to false will make the compositor drop all of its resources | 60 // Setting this to false will make the compositor drop all of its resources |
| 56 // and the output surface. Setting it to true again will rebuild the output | 61 // and the output surface. Setting it to true again will rebuild the output |
| 57 // surface from the gfx::AcceleratedWidget (see SetAcceleratedWidget). | 62 // surface from the gfx::AcceleratedWidget (see SetAcceleratedWidget). |
| 58 void SetVisible(bool visible); | 63 void SetVisible(bool visible); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 71 // Releases the internally stored gfx::AcceleratedWidget and the associated | 76 // Releases the internally stored gfx::AcceleratedWidget and the associated |
| 72 // output surface. This must be called before calling | 77 // output surface. This must be called before calling |
| 73 // SetAcceleratedWidget() with the same gfx::AcceleratedWidget on another | 78 // SetAcceleratedWidget() with the same gfx::AcceleratedWidget on another |
| 74 // compositor. | 79 // compositor. |
| 75 void ReleaseAcceleratedWidget(); | 80 void ReleaseAcceleratedWidget(); |
| 76 | 81 |
| 77 // Forwards the touch event to the |input_manager_|. | 82 // Forwards the touch event to the |input_manager_|. |
| 78 bool OnTouchEvent(const ui::MotionEvent& motion_event); | 83 bool OnTouchEvent(const ui::MotionEvent& motion_event); |
| 79 | 84 |
| 80 protected: | 85 protected: |
| 81 // |dp_to_px| is the scale factor required to move from dp (device pixels) to | |
| 82 // px. See https://developer.android.com/guide/practices/screens_support.html | |
| 83 // for more details. | |
| 84 BlimpCompositor(float dp_to_px, RenderWidgetFeature* render_widget_feature); | |
| 85 | |
| 86 // Populates the cc::LayerTreeSettings used by the cc::LayerTreeHost. Can be | 86 // Populates the cc::LayerTreeSettings used by the cc::LayerTreeHost. Can be |
| 87 // overridden to provide custom settings parameters. | 87 // overridden to provide custom settings parameters. |
| 88 virtual void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings); | 88 virtual void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings); |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 // LayerTreeHostClient implementation. | 91 // LayerTreeHostClient implementation. |
| 92 void WillBeginMainFrame() override; | 92 void WillBeginMainFrame() override; |
| 93 void DidBeginMainFrame() override; | 93 void DidBeginMainFrame() override; |
| 94 void BeginMainFrame(const cc::BeginFrameArgs& args) override; | 94 void BeginMainFrame(const cc::BeginFrameArgs& args) override; |
| 95 void BeginMainFrameNotExpectedSoon() override; | 95 void BeginMainFrameNotExpectedSoon() override; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // the manager to be handled by the client compositor for the current render | 173 // the manager to be handled by the client compositor for the current render |
| 174 // widget. | 174 // widget. |
| 175 scoped_ptr<BlimpInputManager> input_manager_; | 175 scoped_ptr<BlimpInputManager> input_manager_; |
| 176 | 176 |
| 177 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); | 177 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 } // namespace blimp | 180 } // namespace blimp |
| 181 | 181 |
| 182 #endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_H_ | 182 #endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_H_ |
| OLD | NEW |