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

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

Issue 186123006: zero copy - NOT FOR REVIEW Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: re-upload 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
OLDNEW
(Empty)
1 // Copyright 2013 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_bindings.h"
6 #include "ui/gl/gl_image_foobar.h"
7
8 namespace gfx {
9
10 GLImageFoobar::GLImageFoobar(gfx::Size size) : size_(size), prime_fd(-1) {
11 }
12
13 GLImageFoobar::~GLImageFoobar() {
14 Destroy();
15 }
16
17 bool GLImageFoobar::Initialize(gfx::GpuMemoryBufferHandle buffer) {
18 prime_fd = dup(buffer.handle.fd);
19 return prime_fd >= 0;
20 }
21
22 void GLImageFoobar::Destroy() {
23 if (prime_fd >= 0)
24 close(prime_fd);
25 }
26
27 gfx::Size GLImageFoobar::GetSize() {
28 return size_;
29 }
30
31 #define MAGIC(x) ( (void*) ((((uintptr_t)x) << 48) + 0xf00ba4f00ba4) )
32
33 bool GLImageFoobar::BindTexImage(unsigned target) {
34 glTexImage2D(
35 target,
36 0, // mip level
37 GL_BGRA_EXT,
38 size_.width(),
39 size_.height(),
40 0, // border
41 GL_BGRA_EXT,
42 GL_UNSIGNED_BYTE,
43 MAGIC(prime_fd)
44 );
45 return true;
46 }
47
48 void GLImageFoobar::ReleaseTexImage(unsigned target) {
49 }
50
51 void GLImageFoobar::WillUseTexImage() {
52 }
53
54 void GLImageFoobar::DidUseTexImage() {
55 }
56
57 } // namespace gfx
OLDNEW
« ui/compositor/layer.h ('K') | « ui/gl/gl_image_foobar.h ('k') | ui/gl/gl_image_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698