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 <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { | 26 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { |
27 public: | 27 public: |
28 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); | 28 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); |
29 virtual ~NativeViewGLSurfaceOSMesa(); | 29 virtual ~NativeViewGLSurfaceOSMesa(); |
30 | 30 |
31 // Implement subset of GLSurface. | 31 // Implement subset of GLSurface. |
32 virtual bool Initialize() OVERRIDE; | 32 virtual bool Initialize() OVERRIDE; |
33 virtual void Destroy() OVERRIDE; | 33 virtual void Destroy() OVERRIDE; |
34 virtual bool IsOffscreen() OVERRIDE; | 34 virtual bool IsOffscreen() OVERRIDE; |
35 virtual bool SwapBuffers() OVERRIDE; | 35 virtual bool SwapBuffers() OVERRIDE; |
36 virtual std::string GetExtensions() OVERRIDE; | 36 virtual bool SupportsPostSubBuffer() OVERRIDE; |
37 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 37 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
38 | 38 |
39 private: | 39 private: |
40 gfx::AcceleratedWidget window_; | 40 gfx::AcceleratedWidget window_; |
41 HDC device_context_; | 41 HDC device_context_; |
42 | 42 |
43 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceOSMesa); | 43 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceOSMesa); |
44 }; | 44 }; |
45 | 45 |
46 class DWMVSyncProvider : public VSyncProvider { | 46 class DWMVSyncProvider : public VSyncProvider { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 0, 0, size.width(), size.height(), | 164 0, 0, size.width(), size.height(), |
165 0, 0, size.width(), size.height(), | 165 0, 0, size.width(), size.height(), |
166 GetHandle(), | 166 GetHandle(), |
167 reinterpret_cast<BITMAPINFO*>(&info), | 167 reinterpret_cast<BITMAPINFO*>(&info), |
168 DIB_RGB_COLORS, | 168 DIB_RGB_COLORS, |
169 SRCCOPY); | 169 SRCCOPY); |
170 | 170 |
171 return true; | 171 return true; |
172 } | 172 } |
173 | 173 |
174 std::string NativeViewGLSurfaceOSMesa::GetExtensions() { | 174 bool NativeViewGLSurfaceOSMesa::SupportsPostSubBuffer() { |
175 std::string extensions = gfx::GLSurfaceOSMesa::GetExtensions(); | 175 return true; |
176 extensions += extensions.empty() ? "" : " "; | |
177 extensions += "GL_CHROMIUM_post_sub_buffer"; | |
178 return extensions; | |
179 } | 176 } |
180 | 177 |
181 bool NativeViewGLSurfaceOSMesa::PostSubBuffer( | 178 bool NativeViewGLSurfaceOSMesa::PostSubBuffer( |
182 int x, int y, int width, int height) { | 179 int x, int y, int width, int height) { |
183 DCHECK(device_context_); | 180 DCHECK(device_context_); |
184 | 181 |
185 gfx::Size size = GetSize(); | 182 gfx::Size size = GetSize(); |
186 | 183 |
187 // Note: negating the height below causes GDI to treat the bitmap data as row | 184 // Note: negating the height below causes GDI to treat the bitmap data as row |
188 // 0 being at the top. | 185 // 0 being at the top. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 279 } |
283 case kGLImplementationMockGL: | 280 case kGLImplementationMockGL: |
284 return new GLSurfaceStub; | 281 return new GLSurfaceStub; |
285 default: | 282 default: |
286 NOTREACHED(); | 283 NOTREACHED(); |
287 return NULL; | 284 return NULL; |
288 } | 285 } |
289 } | 286 } |
290 | 287 |
291 } // namespace gfx | 288 } // namespace gfx |
OLD | NEW |