From 0d5bfb0221d1ce4fca44e1452c634082db562903 Mon Sep 17 00:00:00 2001 From: "backer@chromium.org" Date: Wed, 12 Oct 2011 22:38:10 +0000 Subject: Make class anonymous and don't assume default FBO is active on Resize. Small refactor to move a class into an anonymous namespace. Small change to preserve the active FBO when resizing the EGLImageTransportSurface. BUG=none TEST=open and close 3D CSS tabs on TOUCH_UI Review URL: http://codereview.chromium.org/8241006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105185 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/gfx/surface/accelerated_surface_linux.cc | 48 ----------------------------- ui/gfx/surface/accelerated_surface_linux.h | 35 --------------------- ui/gfx/surface/surface.gyp | 10 ------ 3 files changed, 93 deletions(-) delete mode 100644 ui/gfx/surface/accelerated_surface_linux.cc delete mode 100644 ui/gfx/surface/accelerated_surface_linux.h (limited to 'ui/gfx/surface') diff --git a/ui/gfx/surface/accelerated_surface_linux.cc b/ui/gfx/surface/accelerated_surface_linux.cc deleted file mode 100644 index da2dde4..0000000 --- a/ui/gfx/surface/accelerated_surface_linux.cc +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/gfx/surface/accelerated_surface_linux.h" - -#include - -#include "third_party/angle/include/EGL/egl.h" -#include "third_party/angle/include/EGL/eglext.h" -#include "ui/gfx/gl/gl_surface_egl.h" -#include "ui/gfx/gl/gl_bindings.h" - -AcceleratedSurface::AcceleratedSurface(const gfx::Size& size) - : size_(size) { - Display* dpy = gfx::GLSurfaceEGL::GetNativeDisplay(); - EGLDisplay edpy = gfx::GLSurfaceEGL::GetHardwareDisplay(); - - XID window = XDefaultRootWindow(dpy); - XWindowAttributes gwa; - XGetWindowAttributes(dpy, window, &gwa); - pixmap_ = XCreatePixmap( - dpy, window, size_.width(), size_.height(), gwa.depth); - - image_ = eglCreateImageKHR( - edpy, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, - reinterpret_cast(pixmap_), NULL); - - glGenTextures(1, &texture_); - - GLint current_texture = 0; - glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture); - - glBindTexture(GL_TEXTURE_2D, texture_); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image_); - - glBindTexture(GL_TEXTURE_2D, current_texture); -} - -AcceleratedSurface::~AcceleratedSurface() { - glDeleteTextures(1, &texture_); - eglDestroyImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), image_); - XFreePixmap(gfx::GLSurfaceEGL::GetNativeDisplay(), pixmap_); -} diff --git a/ui/gfx/surface/accelerated_surface_linux.h b/ui/gfx/surface/accelerated_surface_linux.h deleted file mode 100644 index e7882b8..0000000 --- a/ui/gfx/surface/accelerated_surface_linux.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_GFX_SURFACE_ACCELERATED_SURFACE_LINUX_H_ -#define UI_GFX_SURFACE_ACCELERATED_SURFACE_LINUX_H_ -#pragma once - -#include "base/memory/ref_counted.h" -#include "ui/gfx/size.h" -#include "ui/gfx/surface/surface_export.h" - -// The GL context associated with the surface must be current when -// an instance is created or destroyed. -class SURFACE_EXPORT AcceleratedSurface - : public base::RefCounted { - public: - AcceleratedSurface(const gfx::Size& size); - const gfx::Size& size() const { return size_; } - uint32 pixmap() const { return pixmap_; } - uint32 texture() const { return texture_; } - - private: - ~AcceleratedSurface(); - - gfx::Size size_; - void* image_; - uint32 pixmap_; - uint32 texture_; - - friend class base::RefCounted; - DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); -}; - -#endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_LINUX_H_ diff --git a/ui/gfx/surface/surface.gyp b/ui/gfx/surface/surface.gyp index 0a48f35..43190ba 100644 --- a/ui/gfx/surface/surface.gyp +++ b/ui/gfx/surface/surface.gyp @@ -27,8 +27,6 @@ '<(DEPTH)/ui/ui.gyp:ui', ], 'sources': [ - 'accelerated_surface_linux.cc', - 'accelerated_surface_linux.h', 'accelerated_surface_mac.cc', 'accelerated_surface_mac.h', 'accelerated_surface_wayland.cc', @@ -45,14 +43,6 @@ 'defines': [ 'SURFACE_IMPLEMENTATION', ], - 'conditions': [ - ['use_wayland == 1', { - 'sources/': [ - ['exclude', 'accelerated_surface_linux.cc'], - ['exclude', 'accelerated_surface_linux.h'], - ], - }], - ], }, ], } -- cgit v1.1