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

Unified Diff: ui/gl/gl_image_surface_texture.cc

Issue 177953004: Enable SurfaceTexture based zero-copy texture uploading on Android platform Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« ui/gfx/gpu_memory_buffer.h ('K') | « ui/gl/gl_image_surface_texture.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_surface_texture.cc
diff --git a/ui/gl/gl_image_surface_texture.cc b/ui/gl/gl_image_surface_texture.cc
new file mode 100644
index 0000000000000000000000000000000000000000..84feb8c6b931c9a34e3da15e04fdbf8b43649c39
--- /dev/null
+++ b/ui/gl/gl_image_surface_texture.cc
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gl/gl_image_surface_texture.h"
+
+#include "base/debug/trace_event.h"
+#include "base/process/process_handle.h"
+#include "ui/gl/gl_bindings.h"
+
+namespace gfx {
+
+GLImageSurfaceTexture::GLImageSurfaceTexture(gfx::Size size) : size_(size) {}
+
+GLImageSurfaceTexture::~GLImageSurfaceTexture() {
+ if (texture_id_)
+ glDeleteTextures(1, &texture_id_);
+ Destroy();
+}
+
+bool GLImageSurfaceTexture::Initialize(gfx::GpuMemoryBufferHandle buffer) {
+ gfx::SurfaceTexture* surface_texture =
+ reinterpret_cast<gfx::SurfaceTexture*>(buffer.surface_texture_handle);
+ surface_texture_ = surface_texture;
+ texture_id_ = buffer.texture_id;
+ surface_texture->Release();
+ return true;
+}
+
+void GLImageSurfaceTexture::Destroy() {}
+
+gfx::Size GLImageSurfaceTexture::GetSize() { return size_; }
+
+bool GLImageSurfaceTexture::BindTexImage(unsigned target) {
+ TRACE_EVENT0("gpu", "GLImageSurfaceTexture::BindTexImage");
+ return true;
+}
+
+void GLImageSurfaceTexture::ReleaseTexImage(unsigned target) {}
+
+void GLImageSurfaceTexture::WillUseTexImage() {
+ surface_texture_->UpdateTexImage();
+}
+
+void GLImageSurfaceTexture::DidUseTexImage() {}
+
+void GLImageSurfaceTexture::SetReleaseAfterUse() {}
+} // namespace gfx
« ui/gfx/gpu_memory_buffer.h ('K') | « ui/gl/gl_image_surface_texture.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698