Index: src/utils/win/SkWGL_win.cpp |
diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp |
index 4b3b3e63aedd98fc118ae800d23b127cc71d9a3b..ac77c56288eb41716edd80725efd6e465a7e7c64 100644 |
--- a/src/utils/win/SkWGL_win.cpp |
+++ b/src/utils/win/SkWGL_win.cpp |
@@ -79,19 +79,14 @@ namespace { |
struct PixelFormat { |
int fFormat; |
- int fCoverageSamples; |
- int fColorSamples; |
+ int fSampleCnt; |
int fChoosePixelFormatRank; |
}; |
bool pf_less(const PixelFormat& a, const PixelFormat& b) { |
- if (a.fCoverageSamples < b.fCoverageSamples) { |
+ if (a.fSampleCnt < b.fSampleCnt) { |
return true; |
- } else if (b.fCoverageSamples < a.fCoverageSamples) { |
- return false; |
- } else if (a.fColorSamples < b.fColorSamples) { |
- return true; |
- } else if (b.fColorSamples < a.fColorSamples) { |
+ } else if (b.fSampleCnt < a.fSampleCnt) { |
return false; |
} else if (a.fChoosePixelFormatRank < b.fChoosePixelFormatRank) { |
return true; |
@@ -108,31 +103,20 @@ int SkWGLExtensions::selectFormat(const int formats[], |
0, |
desiredSampleCount, |
0, |
- 0, |
}; |
SkTDArray<PixelFormat> rankedFormats; |
rankedFormats.setCount(formatCount); |
- bool supportsCoverage = this->hasExtension(dc, |
- "WGL_NV_multisample_coverage"); |
for (int i = 0; i < formatCount; ++i) { |
- static const int queryAttrs[] = { |
- SK_WGL_COVERAGE_SAMPLES, |
- // Keep COLOR_SAMPLES at the end so it can be skipped |
- SK_WGL_COLOR_SAMPLES, |
- }; |
- int answers[2]; |
- int queryAttrCnt = supportsCoverage ? |
- SK_ARRAY_COUNT(queryAttrs) : |
- SK_ARRAY_COUNT(queryAttrs) - 1; |
+ static const int kQueryAttr = SK_WGL_SAMPLES; |
+ int numSamples; |
this->getPixelFormatAttribiv(dc, |
formats[i], |
0, |
- queryAttrCnt, |
- queryAttrs, |
- answers); |
+ 1, |
+ &kQueryAttr, |
+ &numSamples); |
rankedFormats[i].fFormat = formats[i]; |
- rankedFormats[i].fCoverageSamples = answers[0]; |
- rankedFormats[i].fColorSamples = answers[supportsCoverage ? 1 : 0]; |
+ rankedFormats[i].fSampleCnt = numSamples; |
rankedFormats[i].fChoosePixelFormatRank = i; |
} |
SkTQSort(rankedFormats.begin(), |
@@ -289,7 +273,7 @@ HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, bool preferCoreProfile) { |
if (msaaSampleCount > 0 && |
extensions.hasExtension(dc, "WGL_ARB_multisample")) { |
static const int kIAttrsCount = SK_ARRAY_COUNT(iAttrs); |
- int msaaIAttrs[kIAttrsCount + 6]; |
+ int msaaIAttrs[kIAttrsCount + 4]; |
memcpy(msaaIAttrs, iAttrs, sizeof(int) * kIAttrsCount); |
SkASSERT(0 == msaaIAttrs[kIAttrsCount - 2] && |
0 == msaaIAttrs[kIAttrsCount - 1]); |
@@ -297,18 +281,8 @@ HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, bool preferCoreProfile) { |
msaaIAttrs[kIAttrsCount - 1] = TRUE; |
msaaIAttrs[kIAttrsCount + 0] = SK_WGL_SAMPLES; |
msaaIAttrs[kIAttrsCount + 1] = msaaSampleCount; |
- if (extensions.hasExtension(dc, "WGL_NV_multisample_coverage")) { |
- msaaIAttrs[kIAttrsCount + 2] = SK_WGL_COLOR_SAMPLES; |
- // We want the fewest number of color samples possible. |
- // Passing 0 gives only the formats where all samples are color |
- // samples. |
- msaaIAttrs[kIAttrsCount + 3] = 1; |
- msaaIAttrs[kIAttrsCount + 4] = 0; |
- msaaIAttrs[kIAttrsCount + 5] = 0; |
- } else { |
- msaaIAttrs[kIAttrsCount + 2] = 0; |
- msaaIAttrs[kIAttrsCount + 3] = 0; |
- } |
+ msaaIAttrs[kIAttrsCount + 2] = 0; |
+ msaaIAttrs[kIAttrsCount + 3] = 0; |
unsigned int num; |
int formats[64]; |
extensions.choosePixelFormat(dc, msaaIAttrs, fAttrs, 64, formats, &num); |