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

Side by Side Diff: experimental/c_salt/opengl_view.h

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months 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 | « experimental/c_salt/opengl_context_ptrs.h ('k') | experimental/c_salt/opengl_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2010 The Ginsu Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can
3 // be found in the LICENSE file.
4
5 #ifndef C_SALT_OPENGL_VIEW_H_
6 #define C_SALT_OPENGL_VIEW_H_
7
8 #include "boost/noncopyable.hpp"
9 #include "c_salt/opengl_context_ptrs.h"
10
11 namespace c_salt {
12
13 class Instance;
14 class OpenGLContext;
15
16 // Provide the drawing support for an OpenGLContext. OpenGLContext calls the
17 // InitializeOpenGL() and RenderOpenGL() methods at the appropriate times.
18 class OpenGLView : public boost::noncopyable {
19 public:
20 OpenGLView();
21 virtual ~OpenGLView();
22
23 // This method is called by the c_salt rendering pipeline exactly once when
24 // |context| first made the current context. You do not call this method
25 // directly. Subclasses can specialize this to perform OpenGL set-up code.
26 // This can include compiling and loading shaders, etc. Before this call is
27 // made, the |context| is guaranteed to be the current context and is ready
28 // to process OpenGL drawing commands.
29 virtual void InitializeOpenGL(const OpenGLContext* context) = 0;
30
31 // This method is called exactly once by the associated context when it is
32 // about to be deallocated. You do not call this method directly. Subclasses
33 // can specialize this method to do graphics shut-down procedures.
34 virtual void ReleaseOpenGL(const OpenGLContext* context) = 0;
35
36 // Subclasses specialize this code to draw OpenGL. The associated context
37 // calls this method; you do not call it directly. |context| is guaranteed
38 // to be current before this call is made.
39 virtual void RenderOpenGL(const OpenGLContext* context) = 0;
40
41 // Called by the c_salt rendering pipeline whenever the size of the view
42 // changes. Subclasses can specialize this method to recompute viewport-
43 // dependent things like the perspective projection transform. Then this
44 // method is called, width() and height() will return the new viewport size
45 // values. You do not need to call this method directly, it is called by
46 // the c_salt rendering pipeline.
47 virtual void ResizeViewport() = 0;
48
49 // Call this to indicate that the view needs to be refreshed. This in turn
50 // tells the associated context to issue a repaint request. If |flag| is
51 // |false|, then this view will be skipped during rendering.
52 void SetNeedsRedraw(bool flag);
53
54 // Attach |this| to |instance|. If no OpenGLContext has been associated
55 // with this view, then one is created in |instance|, and that context is
56 // used for rendering. This call inserts |this| into the rendering chain
57 // for |instance|. |instance| must be fully initialized and ready to make
58 // browser calls. Typically, you would call this method from within an
59 // Instance's InstanceDidLoad() method.
60 void AddToInstance(const Instance& instance);
61
62 // Clamp the size to 1x1 pixels. Call ResizeViewport() once the new size
63 // information has ben set.
64 void SetSize(int32_t width, int32_t height);
65
66 // Accessor and mutator for the OpenGL context. Setting the context clears
67 // and releases the old one, then attaches this view to the new one. The
68 // first time a newly attached context is made current, the InitializeOpenGL()
69 // method will be called once.
70 SharedOpenGLContext GetOpenGLContext() const;
71 void SetOpenGLContext(SharedOpenGLContext context);
72
73 int32_t width() const {
74 return width_;
75 }
76 int32_t height() const {
77 return height_;
78 }
79
80 private:
81 int32_t width_;
82 int32_t height_;
83 bool needs_redraw_;
84 SharedOpenGLContext context_;
85 };
86
87 } // namespace c_salt
88
89 #endif // C_SALT_OPENGL_VIEW_H_
OLDNEW
« no previous file with comments | « experimental/c_salt/opengl_context_ptrs.h ('k') | experimental/c_salt/opengl_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698