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

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

Issue 1420503011: GLES2CmdDecoder should resize GLSurface using GLSurface::Resize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | ui/ozone/demo/gl_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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
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
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
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
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | ui/ozone/demo/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698