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

Side by Side Diff: app/gfx/gl/gl_context.h

Issue 5105006: Resize synchronization for Linux. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Moved IPC call up to GpuCommandBufferStub via callback to satisfy checkdeps. Created 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | app/gfx/gl/gl_context.cc » ('j') | chrome/browser/gpu_process_host.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef APP_GFX_GL_GL_CONTEXT_H_ 5 #ifndef APP_GFX_GL_GL_CONTEXT_H_
6 #define APP_GFX_GL_GL_CONTEXT_H_ 6 #define APP_GFX_GL_GL_CONTEXT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h"
12 #include "base/basictypes.h"
13 #include "base/scoped_ptr.h"
11 #include "build/build_config.h" 14 #include "build/build_config.h"
12 #include "gfx/native_widget_types.h" 15 #include "gfx/native_widget_types.h"
13 #include "gfx/size.h" 16 #include "gfx/size.h"
14 17
15 namespace gfx { 18 namespace gfx {
16 19
17 // Encapsulates an OpenGL context, hiding platform specific management. 20 // Encapsulates an OpenGL context, hiding platform specific management.
18 class GLContext { 21 class GLContext {
19 public: 22 public:
20 GLContext() {} 23 GLContext() {}
21 virtual ~GLContext() {} 24 virtual ~GLContext() {}
22 25
23 // Destroys the GL context. 26 // Destroys the GL context.
24 virtual void Destroy() = 0; 27 virtual void Destroy() = 0;
25 28
26 // Makes the GL context current on the current thread. 29 // Makes the GL context current on the current thread.
27 virtual bool MakeCurrent() = 0; 30 virtual bool MakeCurrent() = 0;
28 31
29 // Returns true if this context is current. 32 // Returns true if this context is current.
30 virtual bool IsCurrent() = 0; 33 virtual bool IsCurrent() = 0;
31 34
32 // Returns true if this context is offscreen. 35 // Returns true if this context is offscreen.
33 virtual bool IsOffscreen() = 0; 36 virtual bool IsOffscreen() = 0;
34 37
35 // Swaps front and back buffers. This has no effect for off-screen 38 // Swaps front and back buffers. This has no effect for off-screen
36 // contexts. 39 // contexts.
37 virtual bool SwapBuffers() = 0; 40 virtual bool SwapBuffers() = 0;
38 41
39 // Set the size of the back buffer. 42 // Set the size of the back buffer. Calls the callback.
nduca 2010/11/23 16:59:49 Is there a way to put this callback on the GL-spec
jonathan.backer 2010/11/23 21:00:19 Done.
40 // FIXME(backer): Currently a NOP. Once we have an implementation for each 43 virtual void SetSize(gfx::Size size);
41 // backend we can switch it to pure virtual. 44
42 virtual void SetSize(gfx::Size) {} 45 // Sometimes used to delegate resizing the back buffer.
46 virtual void RegisterSetSizeCallback(Callback1<gfx::Size>::Type* callback);
43 47
44 // Get the size of the back buffer. 48 // Get the size of the back buffer.
45 virtual gfx::Size GetSize() = 0; 49 virtual gfx::Size GetSize() = 0;
46 50
47 // Get the underlying platform specific GL context "handle". 51 // Get the underlying platform specific GL context "handle".
48 virtual void* GetHandle() = 0; 52 virtual void* GetHandle() = 0;
49 53
50 // Set swap interval. This context must be current. 54 // Set swap interval. This context must be current.
51 virtual void SetSwapInterval(int interval) = 0; 55 virtual void SetSwapInterval(int interval) = 0;
52 56
(...skipping 15 matching lines...) Expand all
68 // Create a GL context used for offscreen rendering. It is initially backed by 72 // Create a GL context used for offscreen rendering. It is initially backed by
69 // a 1x1 pbuffer. Use it to create an FBO to do useful rendering. 73 // a 1x1 pbuffer. Use it to create an FBO to do useful rendering.
70 // |share_context|, if non-NULL, is a context which the internally created 74 // |share_context|, if non-NULL, is a context which the internally created
71 // OpenGL context shares textures and other resources. 75 // OpenGL context shares textures and other resources.
72 static GLContext* CreateOffscreenGLContext(GLContext* shared_context); 76 static GLContext* CreateOffscreenGLContext(GLContext* shared_context);
73 77
74 protected: 78 protected:
75 bool InitializeCommon(); 79 bool InitializeCommon();
76 80
77 private: 81 private:
82 scoped_ptr<Callback1<gfx::Size>::Type> set_size_callback_;
83
78 DISALLOW_COPY_AND_ASSIGN(GLContext); 84 DISALLOW_COPY_AND_ASSIGN(GLContext);
79 }; 85 };
80 86
81 } // namespace gfx 87 } // namespace gfx
82 88
83 #endif // APP_GFX_GL_GL_CONTEXT_H_ 89 #endif // APP_GFX_GL_GL_CONTEXT_H_
OLDNEW
« no previous file with comments | « no previous file | app/gfx/gl/gl_context.cc » ('j') | chrome/browser/gpu_process_host.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698