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

Side by Side Diff: ui/gfx/surface/accelerated_surface_wayland.cc

Issue 7467007: Adding Wayland support for ui/gfx (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Adding missing WaylandDisplay include Created 9 years, 4 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/gfx/surface/accelerated_surface_wayland.h ('k') | ui/gfx/surface/surface.gyp » ('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 (c) 2011 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/gfx/surface/accelerated_surface_wayland.h"
6
7 #include <wayland-egl.h>
8
9 #include "third_party/angle/include/EGL/egl.h"
10 #include "third_party/angle/include/EGL/eglext.h"
11 #include "ui/gfx/gl/gl_bindings.h"
12 #include "ui/gfx/gl/gl_surface_egl.h"
13 #include "ui/wayland/wayland_display.h"
14
15 AcceleratedSurface::AcceleratedSurface(const gfx::Size& size)
16 : size_(size),
17 image_(NULL),
18 pixmap_(NULL),
19 texture_(0) {
20 ui::WaylandDisplay* dpy = ui::WaylandDisplay::GetDisplay(
21 gfx::GLSurfaceEGL::GetNativeDisplay());
22 EGLDisplay edpy = gfx::GLSurfaceEGL::GetHardwareDisplay();
23
24 pixmap_ = wl_egl_pixmap_create(size_.width(),
25 size_.height(),
26 dpy->visual(),
27 0);
28
29 image_ = eglCreateImageKHR(
30 edpy, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (void*) pixmap_, NULL);
31
32 glGenTextures(1, &texture_);
33
34 GLint current_texture = 0;
35 glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture);
36
37 glBindTexture(GL_TEXTURE_2D, texture_);
38 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
39 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
40 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
41 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
42 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image_);
43
44 glBindTexture(GL_TEXTURE_2D, current_texture);
45 }
46
47 AcceleratedSurface::~AcceleratedSurface() {
48 glDeleteTextures(1, &texture_);
49 eglDestroyImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), image_);
50 wl_egl_pixmap_destroy(pixmap_);
51 }
OLDNEW
« no previous file with comments | « ui/gfx/surface/accelerated_surface_wayland.h ('k') | ui/gfx/surface/surface.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698