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 "cc/resources/ui_resource_client.h" | 10 #include "cc/resources/ui_resource_client.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Set the output surface handle which the compositor renders into. | 57 // Set the output surface handle which the compositor renders into. |
58 // DEPRECATED: Use SetSurface() which takes a Java Surface object. | 58 // DEPRECATED: Use SetSurface() which takes a Java Surface object. |
59 virtual void SetWindowSurface(ANativeWindow* window) = 0; | 59 virtual void SetWindowSurface(ANativeWindow* window) = 0; |
60 | 60 |
61 // Set the output surface which the compositor renders into. | 61 // Set the output surface which the compositor renders into. |
62 virtual void SetSurface(jobject surface) = 0; | 62 virtual void SetSurface(jobject surface) = 0; |
63 | 63 |
64 // Tells the view tree to assume a transparent background when rendering. | 64 // Tells the view tree to assume a transparent background when rendering. |
65 virtual void SetHasTransparentBackground(bool flag) = 0; | 65 virtual void SetHasTransparentBackground(bool flag) = 0; |
66 | 66 |
67 // Attempts to composite and read back the result into the provided buffer. | |
68 // The buffer must be at least window width * height * 4 (RGBA) bytes large. | |
69 // The buffer is not modified if false is returned. | |
70 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) = 0; | |
71 | |
72 // Request layout and draw. You only need to call this if you need to trigger | 67 // Request layout and draw. You only need to call this if you need to trigger |
73 // Composite *without* having modified the layer tree. | 68 // Composite *without* having modified the layer tree. |
74 virtual void SetNeedsComposite() = 0; | 69 virtual void SetNeedsComposite() = 0; |
75 | 70 |
76 // Generates a UIResource and returns a UIResourceId. |is_transient| | 71 // Generates a UIResource and returns a UIResourceId. |is_transient| |
77 // indicates whether or not to release the resource once the bitmap | 72 // indicates whether or not to release the resource once the bitmap |
78 // has been uploaded. May return 0. | 73 // has been uploaded. May return 0. |
79 virtual cc::UIResourceId GenerateUIResource(const SkBitmap& bitmap, | 74 virtual cc::UIResourceId GenerateUIResource(const SkBitmap& bitmap, |
80 bool is_transient) = 0; | 75 bool is_transient) = 0; |
81 | 76 |
82 // Generates an ETC1 compressed UIResource. See above for |is_transient|. | 77 // Generates an ETC1 compressed UIResource. See above for |is_transient|. |
83 // May return 0. | 78 // May return 0. |
84 virtual cc::UIResourceId GenerateCompressedUIResource(const gfx::Size& size, | 79 virtual cc::UIResourceId GenerateCompressedUIResource(const gfx::Size& size, |
85 void* pixels, | 80 void* pixels, |
86 bool is_transient) = 0; | 81 bool is_transient) = 0; |
87 | 82 |
88 // Deletes a UIResource. | 83 // Deletes a UIResource. |
89 virtual void DeleteUIResource(cc::UIResourceId resource_id) = 0; | 84 virtual void DeleteUIResource(cc::UIResourceId resource_id) = 0; |
90 | 85 |
91 protected: | 86 protected: |
92 Compositor() {} | 87 Compositor() {} |
93 }; | 88 }; |
94 | 89 |
95 } // namespace content | 90 } // namespace content |
96 | 91 |
97 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 92 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ |
OLD | NEW |