Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: content/public/browser/android/compositor.h

Issue 143803004: android: Migrate old content readback to use async readback (and delegated renderer) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: consistent device scaling Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "content/common/content_export.h" 11 #include "content/common/content_export.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 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 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 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. 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. 68 // The buffer must be at least window width * height * 4 (RGBA) bytes large.
69 // The buffer is not modified if false is returned. 69 // The buffer is not modified if false is returned.
70 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) = 0; 70 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) = 0;
71 71
72 // Composite immediately. Used in single-threaded mode. 72 // Composite immediately. Used in single-threaded mode.
73 virtual void Composite() = 0; 73 virtual void Composite() = 0;
74 74
75 // Generates a UIResource and returns a UIResourceId. May return 0. 75 // Generates a UIResource and returns a UIResourceId. |is_transient|
76 virtual cc::UIResourceId GenerateUIResource( 76 // indicates whether or not to release the resource once the bitmap
77 const cc::UIResourceBitmap& bitmap) = 0; 77 // has been uploaded. May return 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;
78 86
79 // Deletes a UIResource. 87 // Deletes a UIResource.
80 virtual void DeleteUIResource(cc::UIResourceId resource_id) = 0; 88 virtual void DeleteUIResource(cc::UIResourceId resource_id) = 0;
81 89
82 // Generates an OpenGL texture and returns a texture handle. May return 0
83 // if the current context is lost.
84 virtual blink::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) = 0;
85
86 // Generates an OpenGL compressed texture and returns a texture handle. May
87 // return 0 if the current context is lost.
88 virtual blink::WebGLId GenerateCompressedTexture(gfx::Size& size,
89 int data_size,
90 void* data) = 0;
91
92 // Deletes an OpenGL texture.
93 virtual void DeleteTexture(blink::WebGLId texture_id) = 0;
94
95 // Grabs a copy of |texture_id| and saves it into |bitmap|. No scaling is
96 // done. It is assumed that the texture size matches that of the bitmap.
97 virtual bool CopyTextureToBitmap(blink::WebGLId texture_id,
98 gfx::JavaBitmap& bitmap) = 0;
99
100 // Grabs a copy of |texture_id| and saves it into |bitmap|. No scaling is
101 // done. |src_rect| allows the caller to specify which rect of |texture_id|
102 // to copy to |bitmap|. It needs to match the size of |bitmap|. Returns
103 // true if the |texture_id| was copied into |bitmap|, false if not.
104 virtual bool CopyTextureToBitmap(blink::WebGLId texture_id,
105 const gfx::Rect& src_rect,
106 gfx::JavaBitmap& bitmap) = 0;
107 protected: 90 protected:
108 Compositor() {} 91 Compositor() {}
109 }; 92 };
110 93
111 } // namespace content 94 } // namespace content
112 95
113 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ 96 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | content/public/browser/android/content_view_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698