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

Side by Side Diff: ui/gl/gl_image_surface_texture.cc

Issue 331723003: gpu: Remove Create/DeleteImage IPC by adding an X11_PIXMAP_BUFFER GpuMemoryBuffer type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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
« no previous file with comments | « ui/gl/gl_image_surface_texture.h ('k') | ui/gl/gl_image_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #include "ui/gl/gl_image_surface_texture.h" 5 #include "ui/gl/gl_image_surface_texture.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "ui/gl/android/surface_texture.h" 8 #include "ui/gl/android/surface_texture.h"
9 #include "ui/gl/android/surface_texture_tracker.h" 9 #include "ui/gl/android/surface_texture_tracker.h"
10 10
11 namespace gfx { 11 namespace gfx {
12 12
13 GLImageSurfaceTexture::GLImageSurfaceTexture(gfx::Size size) 13 GLImageSurfaceTexture::GLImageSurfaceTexture(const gfx::Size& size)
14 : size_(size), texture_id_(0) {} 14 : size_(size), texture_id_(0) {
15 }
15 16
16 GLImageSurfaceTexture::~GLImageSurfaceTexture() { Destroy(); } 17 GLImageSurfaceTexture::~GLImageSurfaceTexture() { Destroy(); }
17 18
18 bool GLImageSurfaceTexture::Initialize(gfx::GpuMemoryBufferHandle buffer) { 19 bool GLImageSurfaceTexture::Initialize(
20 const gfx::GpuMemoryBufferHandle& handle) {
19 DCHECK(!surface_texture_); 21 DCHECK(!surface_texture_);
20 surface_texture_ = 22 surface_texture_ =
21 SurfaceTextureTracker::GetInstance()->AcquireSurfaceTexture( 23 SurfaceTextureTracker::GetInstance()->AcquireSurfaceTexture(
22 buffer.surface_texture_id.primary_id, 24 handle.surface_texture_id.primary_id,
23 buffer.surface_texture_id.secondary_id); 25 handle.surface_texture_id.secondary_id);
24 return !!surface_texture_; 26 return !!surface_texture_;
25 } 27 }
26 28
27 void GLImageSurfaceTexture::Destroy() { 29 void GLImageSurfaceTexture::Destroy() {
28 surface_texture_ = NULL; 30 surface_texture_ = NULL;
29 texture_id_ = 0; 31 texture_id_ = 0;
30 } 32 }
31 33
32 gfx::Size GLImageSurfaceTexture::GetSize() { return size_; } 34 gfx::Size GLImageSurfaceTexture::GetSize() { return size_; }
33 35
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // GL_TEXTURE_EXTERNAL_OES target. 68 // GL_TEXTURE_EXTERNAL_OES target.
67 surface_texture_->AttachToGLContext(); 69 surface_texture_->AttachToGLContext();
68 texture_id_ = texture_id; 70 texture_id_ = texture_id;
69 } 71 }
70 72
71 surface_texture_->UpdateTexImage(); 73 surface_texture_->UpdateTexImage();
72 return true; 74 return true;
73 } 75 }
74 76
75 } // namespace gfx 77 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_image_surface_texture.h ('k') | ui/gl/gl_image_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698