OLD | NEW |
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 #include "ui/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); | 25 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); |
26 | 26 |
27 static bool InitializeOneOff(); | 27 static bool InitializeOneOff(); |
28 | 28 |
29 // Implement a subset of GLSurface. | 29 // Implement a subset of GLSurface. |
30 virtual bool Initialize() OVERRIDE; | 30 virtual bool Initialize() OVERRIDE; |
31 virtual void Destroy() OVERRIDE; | 31 virtual void Destroy() OVERRIDE; |
32 virtual bool Resize(const gfx::Size& new_size) OVERRIDE; | 32 virtual bool Resize(const gfx::Size& new_size) OVERRIDE; |
33 virtual bool IsOffscreen() OVERRIDE; | 33 virtual bool IsOffscreen() OVERRIDE; |
34 virtual bool SwapBuffers() OVERRIDE; | 34 virtual bool SwapBuffers() OVERRIDE; |
35 virtual std::string GetExtensions() OVERRIDE; | 35 virtual bool SupportsPostSubBuffer() OVERRIDE; |
36 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 36 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
37 | 37 |
38 protected: | 38 protected: |
39 virtual ~NativeViewGLSurfaceOSMesa(); | 39 virtual ~NativeViewGLSurfaceOSMesa(); |
40 | 40 |
41 private: | 41 private: |
42 Display* xdisplay_; | 42 Display* xdisplay_; |
43 GC window_graphics_context_; | 43 GC window_graphics_context_; |
44 gfx::AcceleratedWidget window_; | 44 gfx::AcceleratedWidget window_; |
45 GC pixmap_graphics_context_; | 45 GC pixmap_graphics_context_; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 0, | 211 0, |
212 0, | 212 0, |
213 size.width(), | 213 size.width(), |
214 size.height(), | 214 size.height(), |
215 0, | 215 0, |
216 0); | 216 0); |
217 | 217 |
218 return true; | 218 return true; |
219 } | 219 } |
220 | 220 |
221 std::string NativeViewGLSurfaceOSMesa::GetExtensions() { | 221 bool NativeViewGLSurfaceOSMesa::SupportsPostSubBuffer() { |
222 std::string extensions = gfx::GLSurfaceOSMesa::GetExtensions(); | 222 return true; |
223 extensions += extensions.empty() ? "" : " "; | |
224 extensions += "GL_CHROMIUM_post_sub_buffer"; | |
225 return extensions; | |
226 } | 223 } |
227 | 224 |
228 bool NativeViewGLSurfaceOSMesa::PostSubBuffer( | 225 bool NativeViewGLSurfaceOSMesa::PostSubBuffer( |
229 int x, int y, int width, int height) { | 226 int x, int y, int width, int height) { |
230 gfx::Size size = GetSize(); | 227 gfx::Size size = GetSize(); |
231 | 228 |
232 // Move (0,0) from lower-left to upper-left | 229 // Move (0,0) from lower-left to upper-left |
233 y = size.height() - y - height; | 230 y = size.height() - y - height; |
234 | 231 |
235 XWindowAttributes attributes; | 232 XWindowAttributes attributes; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } | 332 } |
336 case kGLImplementationMockGL: | 333 case kGLImplementationMockGL: |
337 return new GLSurfaceStub; | 334 return new GLSurfaceStub; |
338 default: | 335 default: |
339 NOTREACHED(); | 336 NOTREACHED(); |
340 return NULL; | 337 return NULL; |
341 } | 338 } |
342 } | 339 } |
343 | 340 |
344 } // namespace gfx | 341 } // namespace gfx |
OLD | NEW |