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

Side by Side Diff: sky/shell/gpu_driver.cc

Issue 890803004: SkyShell should be able to draw a green square with GL (Closed) Base URL: git@github.com:domokit/mojo.git@master
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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "sky/shell/gpu_driver.h"
6
7 #include "ui/gl/gl_bindings.h"
8 #include "ui/gl/gl_context.h"
9 #include "ui/gl/gl_share_group.h"
10 #include "ui/gl/gl_surface.h"
11
12 namespace sky {
13 namespace shell {
14
15 GPUDriver::GPUDriver() : weak_factory_(this) {
16 }
17
18 GPUDriver::~GPUDriver() {
19 }
20
21 base::WeakPtr<GPUDriver> GPUDriver::GetWeakPtr() {
22 return weak_factory_.GetWeakPtr();
23 }
24
25 void GPUDriver::Init(gfx::AcceleratedWidget widget) {
26 share_group_ = make_scoped_refptr(new gfx::GLShareGroup());
27
28 surface_ = gfx::GLSurface::CreateViewGLSurface(widget);
29 CHECK(surface_) << "GLSurface required.";
30
31 context_ = gfx::GLContext::CreateGLContext(share_group_.get(), surface_.get(),
32 gfx::PreferIntegratedGpu);
33 CHECK(context_) << "GLContext required.";
34
35 CHECK(context_->MakeCurrent(surface_.get()));
36
37 glClearColor(0.0, 1.0, 0.0, 0.0);
38 glClear(GL_COLOR_BUFFER_BIT);
39
40 surface_->SwapBuffers();
41 }
42
43 } // namespace shell
44 } // namespace sky
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698