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 "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
12 | 12 |
13 namespace WebKit { | 13 namespace WebKit { |
| 14 class WebGraphicsContext3D; |
14 class WebLayer; | 15 class WebLayer; |
15 } | 16 } |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 // An interface to the browser-side compositor. | 20 // An interface to the browser-side compositor. |
20 class Compositor { | 21 class Compositor { |
21 public: | 22 public: |
22 virtual ~Compositor() {} | 23 virtual ~Compositor() {} |
23 | 24 |
(...skipping 11 matching lines...) Expand all Loading... |
35 virtual void SetWindowBounds(const gfx::Size& size) = 0; | 36 virtual void SetWindowBounds(const gfx::Size& size) = 0; |
36 | 37 |
37 // Set the output surface handle which the compositor renders into. | 38 // Set the output surface handle which the compositor renders into. |
38 virtual void SetWindowSurface(ANativeWindow* window) = 0; | 39 virtual void SetWindowSurface(ANativeWindow* window) = 0; |
39 | 40 |
40 // Attempts to composite and read back the result into the provided buffer. | 41 // Attempts to composite and read back the result into the provided buffer. |
41 // The buffer must be at least window width * height * 4 (RGBA) bytes large. | 42 // The buffer must be at least window width * height * 4 (RGBA) bytes large. |
42 // The buffer is not modified if false is returned. | 43 // The buffer is not modified if false is returned. |
43 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) = 0; | 44 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) = 0; |
44 | 45 |
| 46 // Gives a pointer to the current WebGraphicsContext3D. Should not be stored |
| 47 // by the caller. |
| 48 virtual WebKit::WebGraphicsContext3D* GetContext3D() = 0; |
| 49 |
45 // Callback to be run after the frame has been drawn. It passes back | 50 // Callback to be run after the frame has been drawn. It passes back |
46 // a synchronization point identifier. | 51 // a synchronization point identifier. |
47 typedef base::Callback<void(uint32)> SurfacePresentedCallback; | 52 typedef base::Callback<void(uint32)> SurfacePresentedCallback; |
48 | 53 |
49 virtual void OnSurfaceUpdated(const SurfacePresentedCallback& callback) = 0; | 54 virtual void OnSurfaceUpdated(const SurfacePresentedCallback& callback) = 0; |
50 | 55 |
51 protected: | 56 protected: |
52 Compositor() {} | 57 Compositor() {} |
53 }; | 58 }; |
54 | 59 |
55 } // namespace content | 60 } // namespace content |
56 | 61 |
57 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 62 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ |
OLD | NEW |