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

Side by Side Diff: mojo/skia/ganesh_framebuffer_surface.cc

Issue 1518793004: Improve GL bindings for Ganesh surfaces. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: address review comments Created 5 years 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 | « mojo/skia/ganesh_framebuffer_surface.h ('k') | mojo/skia/ganesh_surface.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 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 <GLES2/gl2.h>
6
7 #include "base/logging.h"
8 #include "mojo/skia/ganesh_framebuffer_surface.h"
9
10 namespace mojo {
11
12 GaneshFramebufferSurface::GaneshFramebufferSurface(GaneshContext* context) {
13 DCHECK(context);
14 GaneshContext::Scope scope(context);
15
16 GLint samples = 0;
17 glGetIntegerv(GL_SAMPLES, &samples);
18 GLint stencil_bits = 0;
19 glGetIntegerv(GL_STENCIL_BITS, &stencil_bits);
20 GLint framebuffer_binding = 0;
21 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &framebuffer_binding);
22 GLint viewport[4] = {0, 0, 0, 0};
23 glGetIntegerv(GL_VIEWPORT, viewport);
24 DCHECK(viewport[2] > 0);
25 DCHECK(viewport[3] > 0);
26
27 GrBackendRenderTargetDesc desc;
28 desc.fWidth = viewport[2];
29 desc.fHeight = viewport[3];
30 desc.fConfig = kSkia8888_GrPixelConfig;
31 desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
32 desc.fSampleCnt = samples;
33 desc.fStencilBits = stencil_bits;
34 desc.fRenderTargetHandle = framebuffer_binding;
35 GrRenderTarget* render_target =
36 context->gr()->textureProvider()->wrapBackendRenderTarget(desc);
37 DCHECK(render_target);
38
39 surface_ = skia::AdoptRef(SkSurface::NewRenderTargetDirect(render_target));
40 DCHECK(surface_);
41 }
42
43 GaneshFramebufferSurface::~GaneshFramebufferSurface() {}
44
45 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/skia/ganesh_framebuffer_surface.h ('k') | mojo/skia/ganesh_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698