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

Side by Side Diff: ui/ozone/demo/gl_renderer.cc

Issue 805003002: [Ozone-Demo] Add support for NativeDisplayDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ozone-demo2
Patch Set: . Created 5 years, 10 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 | « no previous file | ui/ozone/demo/ozone_demo.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ozone/demo/gl_renderer.h" 5 #include "ui/ozone/demo/gl_renderer.h"
6 6
7 #include "ui/gl/gl_bindings.h" 7 #include "ui/gl/gl_bindings.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
(...skipping 26 matching lines...) Expand all
37 LOG(ERROR) << "Failed to make GL context current"; 37 LOG(ERROR) << "Failed to make GL context current";
38 return false; 38 return false;
39 } 39 }
40 40
41 return true; 41 return true;
42 } 42 }
43 43
44 void GlRenderer::RenderFrame() { 44 void GlRenderer::RenderFrame() {
45 float fraction = NextFraction(); 45 float fraction = NextFraction();
46 46
47 context_->MakeCurrent(surface_.get());
48
47 glViewport(0, 0, size_.width(), size_.height()); 49 glViewport(0, 0, size_.width(), size_.height());
48 glClearColor(1 - fraction, fraction, 0.0, 1.0); 50 glClearColor(1 - fraction, fraction, 0.0, 1.0);
49 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 51 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
50 52
51 if (!surface_->SwapBuffers()) 53 if (!surface_->SwapBuffers())
52 LOG(FATAL) << "Failed to swap buffers"; 54 LOG(FATAL) << "Failed to swap buffers";
53 } 55 }
54 56
55 } // namespace ui 57 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/demo/ozone_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698