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 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return true; | 116 return true; |
117 } | 117 } |
118 return false; | 118 return false; |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 int SkWGLExtensions::selectFormat(const int formats[], | 122 int SkWGLExtensions::selectFormat(const int formats[], |
123 int formatCount, | 123 int formatCount, |
124 HDC dc, | 124 HDC dc, |
125 int desiredSampleCount) const { | 125 int desiredSampleCount) const { |
| 126 if (formatCount <= 0) { |
| 127 return -1; |
| 128 } |
126 PixelFormat desiredFormat = { | 129 PixelFormat desiredFormat = { |
127 0, | 130 0, |
128 desiredSampleCount, | 131 desiredSampleCount, |
129 0, | 132 0, |
130 }; | 133 }; |
131 SkTDArray<PixelFormat> rankedFormats; | 134 SkTDArray<PixelFormat> rankedFormats; |
132 rankedFormats.setCount(formatCount); | 135 rankedFormats.setCount(formatCount); |
133 for (int i = 0; i < formatCount; ++i) { | 136 for (int i = 0; i < formatCount; ++i) { |
134 static const int kQueryAttr = SK_WGL_SAMPLES; | 137 static const int kQueryAttr = SK_WGL_SAMPLES; |
135 int numSamples; | 138 int numSamples; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 wglDeleteContext(fGLRC); | 451 wglDeleteContext(fGLRC); |
449 fExtensions.releasePbufferDC(fPbuffer, fDC); | 452 fExtensions.releasePbufferDC(fPbuffer, fDC); |
450 fExtensions.destroyPbuffer(fPbuffer); | 453 fExtensions.destroyPbuffer(fPbuffer); |
451 } | 454 } |
452 | 455 |
453 SkWGLPbufferContext::SkWGLPbufferContext(HPBUFFER pbuffer, HDC dc, HGLRC glrc) | 456 SkWGLPbufferContext::SkWGLPbufferContext(HPBUFFER pbuffer, HDC dc, HGLRC glrc) |
454 : fPbuffer(pbuffer) | 457 : fPbuffer(pbuffer) |
455 , fDC(dc) | 458 , fDC(dc) |
456 , fGLRC(glrc) { | 459 , fGLRC(glrc) { |
457 } | 460 } |
OLD | NEW |