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

Unified Diff: content/common/gpu/client/gl_helper.cc

Issue 10910242: Makes copying layers clone external textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698