Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / gl / gl_enums.cc
blobd43681e6f3bb93698a892a0b9118bd0797ce0a98
1 // Copyright 2014 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 <sstream>
6 #include <GLES2/gl2.h>
8 #include "ui/gl/gl_enums.h"
10 namespace gfx {
12 std::string GLEnums::GetStringEnum(uint32 value) {
13 const EnumToString* entry = enum_to_string_table_;
14 const EnumToString* end = entry + enum_to_string_table_len_;
15 for (;entry < end; ++entry) {
16 if (value == entry->value) {
17 return entry->name;
20 std::stringstream ss;
21 ss.fill('0');
22 ss.width(value < 0x10000 ? 4 : 8);
23 ss << std::hex << value;
24 return "0x" + ss.str();
27 std::string GLEnums::GetStringError(uint32 value) {
28 if (value == GL_NONE)
29 return "GL_NONE";
30 return GetStringEnum(value);
33 std::string GLEnums::GetStringBool(uint32 value) {
34 return value ? "GL_TRUE" : "GL_FALSE";
37 #include "ui/gl/gl_enums_implementation_autogen.h"
39 } // namespace gfx