Add ICU message format support
[chromium-blink-merge.git] / cc / output / geometry_binding.cc
blob9a87c7f149e44c6723cd2d2da44fae2e6cdffbea
1 // Copyright 2011 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.
5 #include "cc/output/geometry_binding.h"
7 #include "gpu/command_buffer/client/gles2_interface.h"
8 #include "ui/gfx/geometry/rect_f.h"
10 namespace cc {
12 void SetupGLContext(gpu::gles2::GLES2Interface* gl,
13 GLuint quad_elements_vbo,
14 GLuint quad_vertices_vbo) {
15 gl->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, quad_elements_vbo);
17 gl->BindBuffer(GL_ARRAY_BUFFER, quad_vertices_vbo);
18 // OpenGL defines the last parameter to VertexAttribPointer as type
19 // "const GLvoid*" even though it is actually an offset into the buffer
20 // object's data store and not a pointer to the client's address space.
21 const void* offsets[3] = {
23 reinterpret_cast<const void*>(3 * sizeof(float)),
24 reinterpret_cast<const void*>(5 * sizeof(float)),
27 gl->VertexAttribPointer(GeometryBinding::PositionAttribLocation(), 3,
28 GL_FLOAT, false, 6 * sizeof(float), offsets[0]);
29 gl->VertexAttribPointer(GeometryBinding::TexCoordAttribLocation(), 2,
30 GL_FLOAT, false, 6 * sizeof(float), offsets[1]);
31 gl->VertexAttribPointer(GeometryBinding::TriangleIndexAttribLocation(), 1,
32 GL_FLOAT, false, 6 * sizeof(float), offsets[2]);
33 gl->EnableVertexAttribArray(GeometryBinding::PositionAttribLocation());
34 gl->EnableVertexAttribArray(GeometryBinding::TexCoordAttribLocation());
35 gl->EnableVertexAttribArray(GeometryBinding::TriangleIndexAttribLocation());
38 GeometryBindingQuad::GeometryBindingQuad() {
39 v0 = {{0, 0, 0}, {0, 0}, 0};
40 v1 = {{0, 0, 0}, {0, 0}, 0};
41 v2 = {{0, 0, 0}, {0, 0}, 0};
42 v3 = {{0, 0, 0}, {0, 0}, 0};
45 GeometryBindingQuad::GeometryBindingQuad(const GeometryBindingVertex& vert0,
46 const GeometryBindingVertex& vert1,
47 const GeometryBindingVertex& vert2,
48 const GeometryBindingVertex& vert3) {
49 v0 = vert0;
50 v1 = vert1;
51 v2 = vert2;
52 v3 = vert3;
55 GeometryBindingQuadIndex::GeometryBindingQuadIndex() {
56 memset(data, 0x0, sizeof(data));
59 GeometryBindingQuadIndex::GeometryBindingQuadIndex(uint16 index0,
60 uint16 index1,
61 uint16 index2,
62 uint16 index3,
63 uint16 index4,
64 uint16 index5) {
65 data[0] = index0;
66 data[1] = index1;
67 data[2] = index2;
68 data[3] = index3;
69 data[4] = index4;
70 data[5] = index5;
73 } // namespace cc