OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gl/gl_version_info.h" | 5 #include "ui/gl/gl_version_info.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/string_tokenizer.h" | 8 #include "base/strings/string_tokenizer.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 unsigned* minor_version, | 60 unsigned* minor_version, |
61 bool* is_es, | 61 bool* is_es, |
62 bool* is_es3) { | 62 bool* is_es3) { |
63 // Make sure the outputs are always initialized. | 63 // Make sure the outputs are always initialized. |
64 *major_version = 0; | 64 *major_version = 0; |
65 *minor_version = 0; | 65 *minor_version = 0; |
66 *is_es = false; | 66 *is_es = false; |
67 *is_es3 = false; | 67 *is_es3 = false; |
68 if (!version_str) | 68 if (!version_str) |
69 return; | 69 return; |
70 std::string lstr(base::StringToLowerASCII(std::string(version_str))); | 70 std::string lstr(base::ToLowerASCII(version_str)); |
71 *is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es"); | 71 *is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es"); |
72 if (*is_es) | 72 if (*is_es) |
73 lstr = lstr.substr(10, 3); | 73 lstr = lstr.substr(10, 3); |
74 base::StringTokenizer tokenizer(lstr.begin(), lstr.end(), "."); | 74 base::StringTokenizer tokenizer(lstr.begin(), lstr.end(), "."); |
75 unsigned major, minor; | 75 unsigned major, minor; |
76 if (tokenizer.GetNext() && | 76 if (tokenizer.GetNext() && |
77 base::StringToUint(tokenizer.token_piece(), &major)) { | 77 base::StringToUint(tokenizer.token_piece(), &major)) { |
78 *major_version = major; | 78 *major_version = major; |
79 if (tokenizer.GetNext() && | 79 if (tokenizer.GetNext() && |
80 base::StringToUint(tokenizer.token_piece(), &minor)) { | 80 base::StringToUint(tokenizer.token_piece(), &minor)) { |
81 *minor_version = minor; | 81 *minor_version = minor; |
82 } | 82 } |
83 } | 83 } |
84 if (*is_es && *major_version == 3) | 84 if (*is_es && *major_version == 3) |
85 *is_es3 = true; | 85 *is_es3 = true; |
86 } | 86 } |
87 | 87 |
88 } // namespace gfx | 88 } // namespace gfx |
OLD | NEW |