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

Side by Side Diff: content/common/gpu/client/gl_helper.h

Issue 11234008: Enable texture readback support for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forgot to remove local GLHelper from a method Created 8 years, 2 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 | Annotate | Revision Log
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_COMMON_GPU_CLIENT_GL_HELPER_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_
7 7
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 21 matching lines...) Expand all
32 // scales it to |dst_size|, and writes it into |out|. 32 // scales it to |dst_size|, and writes it into |out|.
33 // |src_size| is the size of |src_texture|. |callback| is invoked with the 33 // |src_size| is the size of |src_texture|. |callback| is invoked with the
34 // copy result when the copy operation has completed. 34 // copy result when the copy operation has completed.
35 void CopyTextureTo(WebKit::WebGLId src_texture, 35 void CopyTextureTo(WebKit::WebGLId src_texture,
36 const gfx::Size& src_size, 36 const gfx::Size& src_size,
37 const gfx::Rect& src_subrect, 37 const gfx::Rect& src_subrect,
38 const gfx::Size& dst_size, 38 const gfx::Size& dst_size,
39 unsigned char* out, 39 unsigned char* out,
40 const base::Callback<void(bool)>& callback); 40 const base::Callback<void(bool)>& callback);
41 41
42 // Copies the raw texture data out of |texture| into |out|. |size| is the
43 // size of the texture. The texture is assumed to have a format of GL_RGBA
44 // with a pixel type of GL_UNSIGNED_BYTE. This is a blocking call that calls
45 // glReadPixels on this current context.
46 void SyncCopyRawTextureTo(WebKit::WebGLId texture,
piman 2012/10/19 22:10:10 I'm not sure what you mean by Raw. This looks like
David Trainor- moved to gerrit 2012/10/19 22:33:54 So CopyTextureTo seems to also potentially swizzle
47 const gfx::Size& size,
48 unsigned char* out);
49
42 // Creates a copy of the specified texture. |size| is the size of the texture. 50 // Creates a copy of the specified texture. |size| is the size of the texture.
43 WebKit::WebGLId CopyTexture(WebKit::WebGLId texture, 51 WebKit::WebGLId CopyTexture(WebKit::WebGLId texture,
44 const gfx::Size& size); 52 const gfx::Size& size);
45 53
54 // Creates a scaled copy of the specified texture. |src_size| is the size of
55 // the texture and |dst_size| is the size of the resulting copy.
56 WebKit::WebGLId CopyTexture(WebKit::WebGLId texture,
piman 2012/10/19 22:10:10 No overloading please. CopyAndScaleTexture?
David Trainor- moved to gerrit 2012/10/19 23:11:27 Done.
57 const gfx::Size& src_size,
58 const gfx::Size& dst_size);
59
46 // Returns the shader compiled from the source. 60 // Returns the shader compiled from the source.
47 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, 61 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source,
48 WebKit::WGC3Denum type); 62 WebKit::WGC3Denum type);
49 63
50 private: 64 private:
51 class CopyTextureToImpl; 65 class CopyTextureToImpl;
52 66
53 // Creates |copy_texture_to_impl_| if NULL. 67 // Creates |copy_texture_to_impl_| if NULL.
54 void InitCopyTextToImpl(); 68 void InitCopyTextToImpl();
55 69
56 WebKit::WebGraphicsContext3D* context_; 70 WebKit::WebGraphicsContext3D* context_;
57 WebKit::WebGraphicsContext3D* context_for_thread_; 71 WebKit::WebGraphicsContext3D* context_for_thread_;
58 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; 72 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_;
59 73
60 // The number of all GLHelper instances. 74 // The number of all GLHelper instances.
61 static base::subtle::Atomic32 count_; 75 static base::subtle::Atomic32 count_;
62 76
63 DISALLOW_COPY_AND_ASSIGN(GLHelper); 77 DISALLOW_COPY_AND_ASSIGN(GLHelper);
64 }; 78 };
65 79
66 } // namespace content 80 } // namespace content
67 81
68 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ 82 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698