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

Side by Side 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, 9 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
« ui/gfx/gpu_memory_buffer.h ('K') | « ui/gl/gl_image_surface_texture.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/gl/gl_image_surface_texture.h"
6
7 #include "base/debug/trace_event.h"
8 #include "base/process/process_handle.h"
9 #include "ui/gl/gl_bindings.h"
10
11 namespace gfx {
12
13 GLImageSurfaceTexture::GLImageSurfaceTexture(gfx::Size size) : size_(size) {}
14
15 GLImageSurfaceTexture::~GLImageSurfaceTexture() {
16 if (texture_id_)
17 glDeleteTextures(1, &texture_id_);
18 Destroy();
19 }
20
21 bool GLImageSurfaceTexture::Initialize(gfx::GpuMemoryBufferHandle buffer) {
22 gfx::SurfaceTexture* surface_texture =
23 reinterpret_cast<gfx::SurfaceTexture*>(buffer.surface_texture_handle);
24 surface_texture_ = surface_texture;
25 texture_id_ = buffer.texture_id;
26 surface_texture->Release();
27 return true;
28 }
29
30 void GLImageSurfaceTexture::Destroy() {}
31
32 gfx::Size GLImageSurfaceTexture::GetSize() { return size_; }
33
34 bool GLImageSurfaceTexture::BindTexImage(unsigned target) {
35 TRACE_EVENT0("gpu", "GLImageSurfaceTexture::BindTexImage");
36 return true;
37 }
38
39 void GLImageSurfaceTexture::ReleaseTexImage(unsigned target) {}
40
41 void GLImageSurfaceTexture::WillUseTexImage() {
42 surface_texture_->UpdateTexImage();
43 }
44
45 void GLImageSurfaceTexture::DidUseTexImage() {}
46
47 void GLImageSurfaceTexture::SetReleaseAfterUse() {}
48 } // namespace gfx
OLDNEW
« 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