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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // view. | 23 // view. |
24 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { | 24 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { |
25 public: | 25 public: |
26 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); | 26 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); |
27 | 27 |
28 static bool InitializeOneOff(); | 28 static bool InitializeOneOff(); |
29 | 29 |
30 // Implement a subset of GLSurface. | 30 // Implement a subset of GLSurface. |
31 bool Initialize() override; | 31 bool Initialize() override; |
32 void Destroy() override; | 32 void Destroy() override; |
33 bool Resize(const gfx::Size& new_size) override; | 33 bool Resize(const gfx::Size& new_size, float scale_factor) override; |
34 bool IsOffscreen() override; | 34 bool IsOffscreen() override; |
35 gfx::SwapResult SwapBuffers() override; | 35 gfx::SwapResult SwapBuffers() override; |
36 bool SupportsPostSubBuffer() override; | 36 bool SupportsPostSubBuffer() override; |
37 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 37 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
38 | 38 |
39 protected: | 39 protected: |
40 ~NativeViewGLSurfaceOSMesa() override; | 40 ~NativeViewGLSurfaceOSMesa() override; |
41 | 41 |
42 private: | 42 private: |
43 Display* xdisplay_; | 43 Display* xdisplay_; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 if (window_graphics_context_) { | 131 if (window_graphics_context_) { |
132 XFreeGC(xdisplay_, window_graphics_context_); | 132 XFreeGC(xdisplay_, window_graphics_context_); |
133 window_graphics_context_ = NULL; | 133 window_graphics_context_ = NULL; |
134 } | 134 } |
135 | 135 |
136 XSync(xdisplay_, False); | 136 XSync(xdisplay_, False); |
137 } | 137 } |
138 | 138 |
139 bool NativeViewGLSurfaceOSMesa::Resize(const gfx::Size& new_size) { | 139 bool NativeViewGLSurfaceOSMesa::Resize(const gfx::Size& new_size, |
140 if (!GLSurfaceOSMesa::Resize(new_size)) | 140 float scale_factor) { |
| 141 if (!GLSurfaceOSMesa::Resize(new_size, scale_factor)) |
141 return false; | 142 return false; |
142 | 143 |
143 XWindowAttributes attributes; | 144 XWindowAttributes attributes; |
144 if (!XGetWindowAttributes(xdisplay_, window_, &attributes)) { | 145 if (!XGetWindowAttributes(xdisplay_, window_, &attributes)) { |
145 LOG(ERROR) << "XGetWindowAttributes failed for window " << window_ << "."; | 146 LOG(ERROR) << "XGetWindowAttributes failed for window " << window_ << "."; |
146 return false; | 147 return false; |
147 } | 148 } |
148 | 149 |
149 // Destroy the previous pixmap and graphics context. | 150 // Destroy the previous pixmap and graphics context. |
150 if (pixmap_graphics_context_) { | 151 if (pixmap_graphics_context_) { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 NOTREACHED(); | 342 NOTREACHED(); |
342 return NULL; | 343 return NULL; |
343 } | 344 } |
344 } | 345 } |
345 | 346 |
346 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 347 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
347 return gfx::GetXDisplay(); | 348 return gfx::GetXDisplay(); |
348 } | 349 } |
349 | 350 |
350 } // namespace gfx | 351 } // namespace gfx |
OLD | NEW |