forked from nwjs/nw.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw_context.h
More file actions
49 lines (35 loc) · 1.18 KB
/
draw_context.h
File metadata and controls
49 lines (35 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_SHELL_ANDROID_DRAW_CONTEXT_H_
#define CONTENT_SHELL_ANDROID_DRAW_CONTEXT_H_
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "ui/gfx/native_widget_types.h"
#include <GLES2/gl2.h>
namespace content {
class GraphicsContext;
// Helper class for drawing content textures to the UI window surface.
class DrawContext {
public:
DrawContext(ANativeWindow* window);
~DrawContext();
// Draws the given texture to the UI and returns a
// SyncPoint identifier.
uint32 Draw(int texture);
void Reshape(int width, int height);
private:
// The shader program.
int program_;
int vertex_shader_;
int fragment_shader_;
// Shader uniform locations.
int texture_uniform_;
// The vertex attribute array used to draw a simple quad.
unsigned int vertex_buffer_;
// The graphics context used for drawing.
scoped_ptr<content::GraphicsContext> context_;
DISALLOW_COPY_AND_ASSIGN(DrawContext);
};
} // namespace content
#endif // CONTENT_SHELL_ANDROID_DRAW_CONTEXT_H_