| Index: content/common/gpu/client/gl_helper.cc
|
| diff --git a/content/common/gpu/client/gl_helper.cc b/content/common/gpu/client/gl_helper.cc
|
| index 627826988eb0ef90653eaaab0997d8cee6278e77..f5c6ce3ec96001b5c27102e9122cd20f1d730594 100644
|
| --- a/content/common/gpu/client/gl_helper.cc
|
| +++ b/content/common/gpu/client/gl_helper.cc
|
| @@ -259,6 +259,9 @@ class GLHelper::CopyTextureToImpl {
|
| const gfx::Size& dst_size,
|
| unsigned char* out,
|
| const base::Callback<void(bool)>& callback);
|
| +
|
| + WebKit::WebGLId CopyTexture(WebGLId src_texture, const gfx::Size& size);
|
| +
|
| private:
|
| // A single request to CopyTextureTo.
|
| // Thread-safety notes: the main thread creates instances of this class. The
|
| @@ -511,6 +514,14 @@ void GLHelper::CopyTextureToImpl::CopyTextureTo(
|
| base::MessageLoopProxy::current()));
|
| }
|
|
|
| +WebKit::WebGLId GLHelper::CopyTextureToImpl::CopyTexture(
|
| + WebGLId src_texture,
|
| + const gfx::Size& size) {
|
| + if (!context_for_thread_)
|
| + return 0;
|
| + return ScaleTexture(src_texture, size, gfx::Rect(size), size);
|
| +}
|
| +
|
| void GLHelper::CopyTextureToImpl::ReadBackFramebuffer(
|
| scoped_refptr<Request> request,
|
| WebGraphicsContext3D* context,
|
| @@ -650,12 +661,7 @@ void GLHelper::CopyTextureTo(WebGLId src_texture,
|
| const gfx::Size& dst_size,
|
| unsigned char* out,
|
| const base::Callback<void(bool)>& callback) {
|
| - // Lazily initialize |copy_texture_to_impl_|
|
| - if (!copy_texture_to_impl_.get())
|
| - copy_texture_to_impl_.reset(new CopyTextureToImpl(context_,
|
| - context_for_thread_,
|
| - this));
|
| -
|
| + InitCopyTextToImpl();
|
| copy_texture_to_impl_->CopyTextureTo(src_texture,
|
| src_size,
|
| src_subrect,
|
| @@ -664,6 +670,12 @@ void GLHelper::CopyTextureTo(WebGLId src_texture,
|
| callback);
|
| }
|
|
|
| +WebKit::WebGLId GLHelper::CopyTexture(WebKit::WebGLId texture,
|
| + const gfx::Size& size) {
|
| + InitCopyTextToImpl();
|
| + return copy_texture_to_impl_->CopyTexture(texture, size);
|
| +}
|
| +
|
| WebGLId GLHelper::CompileShaderFromSource(
|
| const WebKit::WGC3Dchar* source,
|
| WebKit::WGC3Denum type) {
|
| @@ -679,4 +691,13 @@ WebGLId GLHelper::CompileShaderFromSource(
|
| return shader.Detach();
|
| }
|
|
|
| +void GLHelper::InitCopyTextToImpl() {
|
| + // Lazily initialize |copy_texture_to_impl_|
|
| + if (!copy_texture_to_impl_.get())
|
| + copy_texture_to_impl_.reset(new CopyTextureToImpl(context_,
|
| + context_for_thread_,
|
| + this));
|
| +
|
| +}
|
| +
|
| } // namespace content
|
|
|