| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "cc/resources/ui_resource_bitmap.h" | 9 #include "cc/resources/ui_resource_bitmap.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "ui/android/resources/ui_resource_provider.h" | 11 #include "ui/android/resources/ui_resource_provider.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 | 15 |
| 16 class SkBitmap; | 16 class SkBitmap; |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 class Layer; | 19 class Layer; |
| 20 class LayerSettings; | |
| 21 } | 20 } |
| 22 | 21 |
| 23 namespace gfx { | 22 namespace gfx { |
| 24 class JavaBitmap; | 23 class JavaBitmap; |
| 25 } | 24 } |
| 26 | 25 |
| 27 namespace ui { | 26 namespace ui { |
| 28 class ResourceManager; | 27 class ResourceManager; |
| 29 class UIResourceProvider; | 28 class UIResourceProvider; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace content { | 31 namespace content { |
| 33 class CompositorClient; | 32 class CompositorClient; |
| 34 | 33 |
| 35 // An interface to the browser-side compositor. | 34 // An interface to the browser-side compositor. |
| 36 class CONTENT_EXPORT Compositor { | 35 class CONTENT_EXPORT Compositor { |
| 37 public: | 36 public: |
| 38 virtual ~Compositor() {} | 37 virtual ~Compositor() {} |
| 39 | 38 |
| 40 // Performs the global initialization needed before any compositor | 39 // Performs the global initialization needed before any compositor |
| 41 // instance can be used. This should be called only once. | 40 // instance can be used. This should be called only once. |
| 42 static void Initialize(); | 41 static void Initialize(); |
| 43 | 42 |
| 44 // Creates and returns a compositor instance. |root_window| needs to outlive | 43 // Creates and returns a compositor instance. |root_window| needs to outlive |
| 45 // the compositor as it manages callbacks on the compositor. | 44 // the compositor as it manages callbacks on the compositor. |
| 46 static Compositor* Create(CompositorClient* client, | 45 static Compositor* Create(CompositorClient* client, |
| 47 gfx::NativeWindow root_window); | 46 gfx::NativeWindow root_window); |
| 48 | 47 |
| 49 static const cc::LayerSettings& LayerSettings(); | |
| 50 static void SetLayerSettings(const cc::LayerSettings& settings); | |
| 51 | |
| 52 // Attaches the layer tree. | 48 // Attaches the layer tree. |
| 53 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) = 0; | 49 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) = 0; |
| 54 | 50 |
| 55 // Set the scale factor from DIP to pixel. | 51 // Set the scale factor from DIP to pixel. |
| 56 virtual void setDeviceScaleFactor(float factor) = 0; | 52 virtual void setDeviceScaleFactor(float factor) = 0; |
| 57 | 53 |
| 58 // Set the output surface bounds. | 54 // Set the output surface bounds. |
| 59 virtual void SetWindowBounds(const gfx::Size& size) = 0; | 55 virtual void SetWindowBounds(const gfx::Size& size) = 0; |
| 60 | 56 |
| 61 // Set the output surface which the compositor renders into. | 57 // Set the output surface which the compositor renders into. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 74 // Returns the resource manager associated with the compositor. | 70 // Returns the resource manager associated with the compositor. |
| 75 virtual ui::ResourceManager& GetResourceManager() = 0; | 71 virtual ui::ResourceManager& GetResourceManager() = 0; |
| 76 | 72 |
| 77 protected: | 73 protected: |
| 78 Compositor() {} | 74 Compositor() {} |
| 79 }; | 75 }; |
| 80 | 76 |
| 81 } // namespace content | 77 } // namespace content |
| 82 | 78 |
| 83 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 79 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ |
| OLD | NEW |