| 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" | |
| 11 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/android/ui_resource_provider.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 15 | 15 |
| 16 class SkBitmap; | 16 class SkBitmap; |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 class Layer; | 19 class Layer; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace gfx { | 22 namespace gfx { |
| 23 class JavaBitmap; | 23 class JavaBitmap; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 class CompositorClient; | 27 class CompositorClient; |
| 28 class UIResourceProvider; |
| 28 | 29 |
| 29 // An interface to the browser-side compositor. | 30 // An interface to the browser-side compositor. |
| 30 class CONTENT_EXPORT Compositor { | 31 class CONTENT_EXPORT Compositor { |
| 31 public: | 32 public: |
| 32 virtual ~Compositor() {} | 33 virtual ~Compositor() {} |
| 33 | 34 |
| 34 // Performs the global initialization needed before any compositor | 35 // Performs the global initialization needed before any compositor |
| 35 // instance can be used. This should be called only once. | 36 // instance can be used. This should be called only once. |
| 36 static void Initialize(); | 37 static void Initialize(); |
| 37 | 38 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 65 virtual void SetHasTransparentBackground(bool flag) = 0; | 66 virtual void SetHasTransparentBackground(bool flag) = 0; |
| 66 | 67 |
| 67 // Attempts to composite and read back the result into the provided buffer. | 68 // 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 must be at least window width * height * 4 (RGBA) bytes large. |
| 69 // The buffer is not modified if false is returned. | 70 // The buffer is not modified if false is returned. |
| 70 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) = 0; | 71 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) = 0; |
| 71 | 72 |
| 72 // Composite immediately. Used in single-threaded mode. | 73 // Composite immediately. Used in single-threaded mode. |
| 73 virtual void Composite() = 0; | 74 virtual void Composite() = 0; |
| 74 | 75 |
| 75 // Generates a UIResource and returns a UIResourceId. |is_transient| | 76 // Returns the UI resource provider associated with the compositor. Any |
| 76 // indicates whether or not to release the resource once the bitmap | 77 // caller of this method cannot out-live the compositor. |
| 77 // has been uploaded. May return 0. | 78 virtual UIResourceProvider* GetUIResourceProvider() = 0; |
| 78 virtual cc::UIResourceId GenerateUIResource(const SkBitmap& bitmap, | |
| 79 bool is_transient) = 0; | |
| 80 | |
| 81 // Generates an ETC1 compressed UIResource. See above for |is_transient|. | |
| 82 // May return 0. | |
| 83 virtual cc::UIResourceId GenerateCompressedUIResource(const gfx::Size& size, | |
| 84 void* pixels, | |
| 85 bool is_transient) = 0; | |
| 86 | |
| 87 // Deletes a UIResource. | |
| 88 virtual void DeleteUIResource(cc::UIResourceId resource_id) = 0; | |
| 89 | 79 |
| 90 protected: | 80 protected: |
| 91 Compositor() {} | 81 Compositor() {} |
| 92 }; | 82 }; |
| 93 | 83 |
| 94 } // namespace content | 84 } // namespace content |
| 95 | 85 |
| 96 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 86 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ |
| OLD | NEW |