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

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

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_view.h ('k') | experimental/c_salt/opengl_view_ptrs.h » ('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 #include "c_salt/opengl_view.h"
6
7 #include <algorithm>
8
9 #include "c_salt/instance.h"
10 #include "c_salt/opengl_context.h"
11
12 namespace c_salt {
13
14 OpenGLView::OpenGLView() : width_(1), height_(1), needs_redraw_(true) {
15 }
16
17 OpenGLView::~OpenGLView() {
18 }
19
20 SharedOpenGLContext OpenGLView::GetOpenGLContext() const {
21 return context_;
22 }
23
24 void OpenGLView::SetOpenGLContext(SharedOpenGLContext context) {
25 context_ = context; // Might cause ReleaseOpenGL() to be called.
26 SharedOpenGLView shared_view(this);
27 context_->set_opengl_view(shared_view);
28 }
29
30 void OpenGLView::SetNeedsRedraw(bool flag) {
31 needs_redraw_ = flag;
32 if (needs_redraw_) {
33 // Signal the associated context to issue a repaint request.
34 context_->RenderOpenGL();
35 }
36 }
37
38 void OpenGLView::AddToInstance(const Instance& instance) {
39 if (context_.get() && context_->is_valid()) {
40 // This view already belongs to a context, do nothing.
41 return;
42 }
43 SharedOpenGLContext shared_context(new OpenGLContext(instance));
44 shared_context->InitializeOpenGL();
45 SetOpenGLContext(shared_context);
46 }
47
48 void OpenGLView::SetSize(int32_t width, int32_t height) {
49 width_ = std::max(static_cast<int32_t>(1), width);
50 height_ = std::max(static_cast<int32_t>(1), height);
51 assert(context_.get());
52 if (context_.get() && context_->is_valid())
53 context_->MakeContextCurrent();
54 ResizeViewport();
55 }
56
57 } // namespace c_salt
OLDNEW
« no previous file with comments | « experimental/c_salt/opengl_view.h ('k') | experimental/c_salt/opengl_view_ptrs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698