Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 *major_version = 0; | 65 *major_version = 0; |
| 66 *minor_version = 0; | 66 *minor_version = 0; |
| 67 *is_es = false; | 67 *is_es = false; |
| 68 *is_es2 = false; | 68 *is_es2 = false; |
| 69 *is_es3 = false; | 69 *is_es3 = false; |
| 70 if (!version_str) | 70 if (!version_str) |
| 71 return; | 71 return; |
| 72 std::string lstr(base::ToLowerASCII(version_str)); | 72 std::string lstr(base::ToLowerASCII(version_str)); |
| 73 *is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es"); | 73 *is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es"); |
| 74 if (*is_es) | 74 if (*is_es) |
| 75 lstr = lstr.substr(10, 3); | 75 lstr = lstr.substr(10, 3); |
|
xinghua.cao
2016/06/16 10:29:05
If OpenGL version string is without release number
Ken Russell (switch to Gerrit)
2016/06/16 20:12:22
Thanks for tracking this down.
Could you please c
| |
| 76 base::StringTokenizer tokenizer(lstr.begin(), lstr.end(), "."); | 76 base::StringTokenizer tokenizer(lstr.begin(), lstr.end(), ". "); |
| 77 unsigned major, minor; | 77 unsigned major, minor; |
| 78 if (tokenizer.GetNext() && | 78 if (tokenizer.GetNext() && |
| 79 base::StringToUint(tokenizer.token_piece(), &major)) { | 79 base::StringToUint(tokenizer.token_piece(), &major)) { |
| 80 *major_version = major; | 80 *major_version = major; |
| 81 if (tokenizer.GetNext() && | 81 if (tokenizer.GetNext() && |
| 82 base::StringToUint(tokenizer.token_piece(), &minor)) { | 82 base::StringToUint(tokenizer.token_piece(), &minor)) { |
| 83 *minor_version = minor; | 83 *minor_version = minor; |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 if (*is_es && *major_version == 2) | 86 if (*is_es && *major_version == 2) |
| 87 *is_es2 = true; | 87 *is_es2 = true; |
| 88 if (*is_es && *major_version == 3) | 88 if (*is_es && *major_version == 3) |
| 89 *is_es3 = true; | 89 *is_es3 = true; |
| 90 DCHECK(major_version != 0); | 90 DCHECK(major_version != 0); |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace gl | 93 } // namespace gl |
| OLD | NEW |