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

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

Issue 1998723002: Move code in ui/gl/* from gfx:: to gl:: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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 | « ui/gl/scoped_make_current.h ('k') | ui/gl/sync_control_vsync_provider.h » ('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/scoped_make_current.h" 5 #include "ui/gl/scoped_make_current.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gl/gl_context.h" 8 #include "ui/gl/gl_context.h"
9 #include "ui/gl/gl_surface.h" 9 #include "ui/gl/gl_surface.h"
10 10
11 namespace ui { 11 namespace ui {
12 12
13 ScopedMakeCurrent::ScopedMakeCurrent(gfx::GLContext* context, 13 ScopedMakeCurrent::ScopedMakeCurrent(gl::GLContext* context,
14 gfx::GLSurface* surface) 14 gl::GLSurface* surface)
15 : previous_context_(gfx::GLContext::GetCurrent()), 15 : previous_context_(gl::GLContext::GetCurrent()),
16 previous_surface_(gfx::GLSurface::GetCurrent()), 16 previous_surface_(gl::GLSurface::GetCurrent()),
17 context_(context), 17 context_(context),
18 surface_(surface), 18 surface_(surface),
19 succeeded_(false) { 19 succeeded_(false) {
20 DCHECK(context); 20 DCHECK(context);
21 DCHECK(surface); 21 DCHECK(surface);
22 succeeded_ = context->MakeCurrent(surface); 22 succeeded_ = context->MakeCurrent(surface);
23 } 23 }
24 24
25 ScopedMakeCurrent::~ScopedMakeCurrent() { 25 ScopedMakeCurrent::~ScopedMakeCurrent() {
26 if (previous_context_.get()) { 26 if (previous_context_.get()) {
27 DCHECK(previous_surface_.get()); 27 DCHECK(previous_surface_.get());
28 previous_context_->MakeCurrent(previous_surface_.get()); 28 previous_context_->MakeCurrent(previous_surface_.get());
29 } else { 29 } else {
30 context_->ReleaseCurrent(surface_.get()); 30 context_->ReleaseCurrent(surface_.get());
31 } 31 }
32 } 32 }
33 33
34 bool ScopedMakeCurrent::Succeeded() const { 34 bool ScopedMakeCurrent::Succeeded() const {
35 return succeeded_; 35 return succeeded_;
36 } 36 }
37 37
38 } // namespace ui 38 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gl/scoped_make_current.h ('k') | ui/gl/sync_control_vsync_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698