OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkWGL.h" | 9 #include "SkWGL.h" |
10 | 10 |
11 #include "SkTDArray.h" | 11 #include "SkTDArray.h" |
12 #include "SkTSearch.h" | 12 #include "SkTSearch.h" |
13 #include "SkTSort.h" | 13 #include "SkTSort.h" |
14 | 14 |
15 bool SkWGLExtensions::hasExtension(HDC dc, const char* ext) const { | 15 bool SkWGLExtensions::hasExtension(HDC dc, const char* ext) const { |
16 if (NULL == this->fGetExtensionsString) { | 16 if (NULL == this->fGetExtensionsString) { |
17 return false; | 17 return false; |
18 } | 18 } |
19 if (!strcmp("WGL_ARB_extensions_string", ext)) { | 19 if (!strcmp("WGL_ARB_extensions_string", ext)) { |
20 return true; | 20 return true; |
21 } | 21 } |
22 const char* extensionString = this->getExtensionsString(dc); | 22 const char* extensionString = this->getExtensionsString(dc); |
23 int extLength = strlen(ext); | 23 size_t extLength = strlen(ext); |
24 | 24 |
25 while (true) { | 25 while (true) { |
26 int n = strcspn(extensionString, " "); | 26 size_t n = strcspn(extensionString, " "); |
27 if (n == extLength && 0 == strncmp(ext, extensionString, n)) { | 27 if (n == extLength && 0 == strncmp(ext, extensionString, n)) { |
28 return true; | 28 return true; |
29 } | 29 } |
30 if (0 == extensionString[n]) { | 30 if (0 == extensionString[n]) { |
31 return false; | 31 return false; |
32 } | 32 } |
33 extensionString += n+1; | 33 extensionString += n+1; |
34 } | 34 } |
35 | 35 |
36 return false; | 36 return false; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 333 } |
334 | 334 |
335 if (NULL == glrc) { | 335 if (NULL == glrc) { |
336 glrc = wglCreateContext(dc); | 336 glrc = wglCreateContext(dc); |
337 } | 337 } |
338 SkASSERT(glrc); | 338 SkASSERT(glrc); |
339 | 339 |
340 wglMakeCurrent(prevDC, prevGLRC); | 340 wglMakeCurrent(prevDC, prevGLRC); |
341 return glrc; | 341 return glrc; |
342 } | 342 } |
OLD | NEW |