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/gfx/gl/gl_surface.cc

Issue 6839008: Split EGLContext in GLContextEGL and GLSurfaceEGL. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/gl/gl_surface.h ('k') | ui/gfx/gl/gl_surface_egl.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include "ui/gfx/gl/gl_surface.h"
6
7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "ui/gfx/gl/gl_context.h"
10 #include "ui/gfx/gl/gl_bindings.h"
11 #include "ui/gfx/gl/gl_implementation.h"
12 #include "ui/gfx/gl/gl_switches.h"
13 6
14 namespace gfx { 7 namespace gfx {
15 8
16 unsigned int GLContext::GetBackingFrameBufferObject() { 9 unsigned int GLSurface::GetBackingFrameBufferObject() {
17 return 0; 10 return 0;
18 } 11 }
19 12
20 std::string GLContext::GetExtensions() {
21 DCHECK(IsCurrent());
22 const char* ext = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
23 return std::string(ext ? ext : "");
24 }
25
26 bool GLContext::HasExtension(const char* name) {
27 std::string extensions = GetExtensions();
28 extensions += " ";
29
30 std::string delimited_name(name);
31 delimited_name += " ";
32
33 return extensions.find(delimited_name) != std::string::npos;
34 }
35
36 bool GLContext::InitializeCommon() {
37 if (!MakeCurrent()) {
38 LOG(ERROR) << "MakeCurrent failed.";
39 return false;
40 }
41
42 if (!IsOffscreen()) {
43 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync))
44 SetSwapInterval(0);
45 else
46 SetSwapInterval(1);
47 }
48
49 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
50 if (glGetError() != GL_NO_ERROR) {
51 LOG(ERROR) << "glClear failed.";
52 return false;
53 }
54
55 return true;
56 }
57
58 } // namespace gfx 13 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/gl/gl_surface.h ('k') | ui/gfx/gl/gl_surface_egl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698