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

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: minus ui-map-image and ui-impl-side setting, plus tiled mode 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
« no previous file with comments | « ui/gl/gl_image_foobar.h ('k') | ui/gl/gl_image_x11.cc » ('j') | 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 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 "base/debug/trace_event.h"
6
7 #include "ui/gl/gl_bindings.h"
8 #include "ui/gl/gl_image_foobar.h"
9
10 namespace gfx {
11
12 GLImageFoobar::GLImageFoobar(gfx::Size size) : size_(size), prime_fd(-1) {
13 }
14
15 GLImageFoobar::~GLImageFoobar() {
16 Destroy();
17 }
18
19 bool GLImageFoobar::Initialize(gfx::GpuMemoryBufferHandle buffer) {
20 prime_fd = dup(buffer.handle.fd);
21 return prime_fd >= 0;
22 }
23
24 void GLImageFoobar::Destroy() {
25 if (prime_fd >= 0)
26 close(prime_fd);
27 }
28
29 gfx::Size GLImageFoobar::GetSize() {
30 return size_;
31 }
32
33 #define MAGIC(x) ( (void*) ((((uintptr_t)x) << 48) + 0xf00ba4f00ba4) )
34
35 bool GLImageFoobar::BindTexImage(unsigned target) {
36 TRACE_EVENT0("zcopy", "BindTexImage");
37 glTexImage2D(
38 target,
39 0, // mip level
40 GL_BGRA_EXT,
41 size_.width(),
42 size_.height(),
43 0, // border
44 GL_BGRA_EXT,
45 GL_UNSIGNED_BYTE,
46 MAGIC(prime_fd)
47 );
48 return true;
49 }
50
51 void GLImageFoobar::ReleaseTexImage(unsigned target) {
52 }
53
54 void GLImageFoobar::WillUseTexImage() {
55 }
56
57 void GLImageFoobar::DidUseTexImage() {
58 }
59
60 } // namespace gfx
OLDNEW
« no previous file with comments | « 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