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

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

Issue 10392152: RefCounted types should not have public destructors, Linux fixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 extern "C" { 5 extern "C" {
6 #include <X11/Xlib.h> 6 #include <X11/Xlib.h>
7 } 7 }
8 8
9 #include "ui/gl/gl_surface_glx.h" 9 #include "ui/gl/gl_surface_glx.h"
10 10
(...skipping 20 matching lines...) Expand all
31 ::XFree(x); 31 ::XFree(x);
32 } 32 }
33 }; 33 };
34 34
35 Display* g_display; 35 Display* g_display;
36 const char* g_glx_extensions = NULL; 36 const char* g_glx_extensions = NULL;
37 bool g_glx_create_context_robustness_supported = false; 37 bool g_glx_create_context_robustness_supported = false;
38 38
39 } // namespace anonymous 39 } // namespace anonymous
40 40
41 GLSurfaceGLX::GLSurfaceGLX() { 41 GLSurfaceGLX::GLSurfaceGLX() {}
42 }
43
44 GLSurfaceGLX::~GLSurfaceGLX() {
45 }
46 42
47 bool GLSurfaceGLX::InitializeOneOff() { 43 bool GLSurfaceGLX::InitializeOneOff() {
48 static bool initialized = false; 44 static bool initialized = false;
49 if (initialized) 45 if (initialized)
50 return true; 46 return true;
51 47
52 g_display = base::MessagePumpForUI::GetDefaultXDisplay(); 48 g_display = base::MessagePumpForUI::GetDefaultXDisplay();
53 if (!g_display) { 49 if (!g_display) {
54 LOG(ERROR) << "XOpenDisplay failed."; 50 LOG(ERROR) << "XOpenDisplay failed.";
55 return false; 51 return false;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 92
97 // static 93 // static
98 bool GLSurfaceGLX::IsCreateContextRobustnessSupported() { 94 bool GLSurfaceGLX::IsCreateContextRobustnessSupported() {
99 return g_glx_create_context_robustness_supported; 95 return g_glx_create_context_robustness_supported;
100 } 96 }
101 97
102 void* GLSurfaceGLX::GetDisplay() { 98 void* GLSurfaceGLX::GetDisplay() {
103 return g_display; 99 return g_display;
104 } 100 }
105 101
102 GLSurfaceGLX::~GLSurfaceGLX() {}
103
106 NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window) 104 NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window)
107 : window_(window), 105 : window_(window),
108 config_(NULL) { 106 config_(NULL) {
109 } 107 }
110 108
111 NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX()
112 : window_(0),
113 config_(NULL) {
114 }
115
116 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() {
117 Destroy();
118 }
119
120 bool NativeViewGLSurfaceGLX::Initialize() { 109 bool NativeViewGLSurfaceGLX::Initialize() {
121 XWindowAttributes attributes; 110 XWindowAttributes attributes;
122 if (!XGetWindowAttributes(g_display, window_, &attributes)) { 111 if (!XGetWindowAttributes(g_display, window_, &attributes)) {
123 LOG(ERROR) << "XGetWindowAttributes failed for window " << window_ << "."; 112 LOG(ERROR) << "XGetWindowAttributes failed for window " << window_ << ".";
124 return false; 113 return false;
125 } 114 }
126 size_ = gfx::Size(attributes.width, attributes.height); 115 size_ = gfx::Size(attributes.width, attributes.height);
127 return true; 116 return true;
128 } 117 }
129 118
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return config_; 216 return config_;
228 } 217 }
229 218
230 bool NativeViewGLSurfaceGLX::PostSubBuffer( 219 bool NativeViewGLSurfaceGLX::PostSubBuffer(
231 int x, int y, int width, int height) { 220 int x, int y, int width, int height) {
232 DCHECK(g_GLX_MESA_copy_sub_buffer); 221 DCHECK(g_GLX_MESA_copy_sub_buffer);
233 glXCopySubBufferMESA(g_display, window_, x, y, width, height); 222 glXCopySubBufferMESA(g_display, window_, x, y, width, height);
234 return true; 223 return true;
235 } 224 }
236 225
226 NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX()
227 : window_(0),
228 config_(NULL) {
229 }
230
231 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() {
232 Destroy();
233 }
234
237 PbufferGLSurfaceGLX::PbufferGLSurfaceGLX(const gfx::Size& size) 235 PbufferGLSurfaceGLX::PbufferGLSurfaceGLX(const gfx::Size& size)
238 : size_(size), 236 : size_(size),
239 config_(NULL), 237 config_(NULL),
240 pbuffer_(0) { 238 pbuffer_(0) {
241 } 239 }
242 240
243 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() {
244 Destroy();
245 }
246
247 bool PbufferGLSurfaceGLX::Initialize() { 241 bool PbufferGLSurfaceGLX::Initialize() {
248 DCHECK(!pbuffer_); 242 DCHECK(!pbuffer_);
249 243
250 static const int config_attributes[] = { 244 static const int config_attributes[] = {
251 GLX_BUFFER_SIZE, 32, 245 GLX_BUFFER_SIZE, 32,
252 GLX_ALPHA_SIZE, 8, 246 GLX_ALPHA_SIZE, 8,
253 GLX_BLUE_SIZE, 8, 247 GLX_BLUE_SIZE, 8,
254 GLX_GREEN_SIZE, 8, 248 GLX_GREEN_SIZE, 8,
255 GLX_RED_SIZE, 8, 249 GLX_RED_SIZE, 8,
256 GLX_RENDER_TYPE, GLX_RGBA_BIT, 250 GLX_RENDER_TYPE, GLX_RGBA_BIT,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 310 }
317 311
318 void* PbufferGLSurfaceGLX::GetHandle() { 312 void* PbufferGLSurfaceGLX::GetHandle() {
319 return reinterpret_cast<void*>(pbuffer_); 313 return reinterpret_cast<void*>(pbuffer_);
320 } 314 }
321 315
322 void* PbufferGLSurfaceGLX::GetConfig() { 316 void* PbufferGLSurfaceGLX::GetConfig() {
323 return config_; 317 return config_;
324 } 318 }
325 319
320 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() {
321 Destroy();
322 }
323
326 } // namespace gfx 324 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698