Added --deepColor option to SampleApp, triggers creation of a ten-bit/channel
buffer. (Only on Windows at the moment). Uses new effect to do the final
gamma adjustment

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1919993002

Review-Url: https://codereview.chromium.org/1919993002
diff --git a/src/utils/win/SkWGL.h b/src/utils/win/SkWGL.h
index 5322d91..ebd95e7 100644
--- a/src/utils/win/SkWGL.h
+++ b/src/utils/win/SkWGL.h
@@ -37,6 +37,9 @@
 #define SK_WGL_SUPPORT_OPENGL                       0x2010
 #define SK_WGL_DOUBLE_BUFFER                        0x2011
 #define SK_WGL_COLOR_BITS                           0x2014
+#define SK_WGL_RED_BITS                             0x2015
+#define SK_WGL_GREEN_BITS                           0x2017
+#define SK_WGL_BLUE_BITS                            0x2019
 #define SK_WGL_ALPHA_BITS                           0x201B
 #define SK_WGL_STENCIL_BITS                         0x2023
 #define SK_WGL_FULL_ACCELERATION                    0x2027
@@ -138,7 +141,7 @@
  * (including non-MSAA) will be created. If preferCoreProfile is true but a core profile cannot be
  * created then a compatible profile context will be created.
  */
-HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, SkWGLContextRequest context);
+HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, bool deepColor, SkWGLContextRequest context);
 
 /**
  * Helper class for creating a pbuffer context and deleting all the handles when finished. This
diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp
index 65ffaf1..dc1b4ca 100644
--- a/src/utils/win/SkWGL_win.cpp
+++ b/src/utils/win/SkWGL_win.cpp
@@ -288,38 +288,41 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 static void get_pixel_formats_to_try(HDC dc, const SkWGLExtensions& extensions,
-                                     bool doubleBuffered, int msaaSampleCount,
+                                     bool doubleBuffered, int msaaSampleCount, bool deepColor,
                                      int formatsToTry[2]) {
-    int iAttrs[] = {
-        SK_WGL_DRAW_TO_WINDOW, TRUE,
-        SK_WGL_DOUBLE_BUFFER, (doubleBuffered ? TRUE : FALSE),
-        SK_WGL_ACCELERATION, SK_WGL_FULL_ACCELERATION,
-        SK_WGL_SUPPORT_OPENGL, TRUE,
-        SK_WGL_COLOR_BITS, 24,
-        SK_WGL_ALPHA_BITS, 8,
-        SK_WGL_STENCIL_BITS, 8,
-        0, 0
+    auto appendAttr = [](SkTDArray<int>& attrs, int attr, int value) {
+        attrs.push(attr);
+        attrs.push(value);
     };
 
+    SkTDArray<int> iAttrs;
+    appendAttr(iAttrs, SK_WGL_DRAW_TO_WINDOW, TRUE);
+    appendAttr(iAttrs, SK_WGL_DOUBLE_BUFFER, (doubleBuffered ? TRUE : FALSE));
+    appendAttr(iAttrs, SK_WGL_ACCELERATION, SK_WGL_FULL_ACCELERATION);
+    appendAttr(iAttrs, SK_WGL_SUPPORT_OPENGL, TRUE);
+    if (deepColor) {
+        appendAttr(iAttrs, SK_WGL_RED_BITS, 10);
+        appendAttr(iAttrs, SK_WGL_GREEN_BITS, 10);
+        appendAttr(iAttrs, SK_WGL_BLUE_BITS, 10);
+        appendAttr(iAttrs, SK_WGL_ALPHA_BITS, 2);
+    } else {
+        appendAttr(iAttrs, SK_WGL_COLOR_BITS, 24);
+        appendAttr(iAttrs, SK_WGL_ALPHA_BITS, 8);
+    }
+    appendAttr(iAttrs, SK_WGL_STENCIL_BITS, 8);
+
     float fAttrs[] = {0, 0};
 
     // Get a MSAA format if requested and possible.
     if (msaaSampleCount > 0 &&
         extensions.hasExtension(dc, "WGL_ARB_multisample")) {
-        static const int kIAttrsCount = SK_ARRAY_COUNT(iAttrs);
-        int msaaIAttrs[kIAttrsCount + 4];
-        memcpy(msaaIAttrs, iAttrs, sizeof(int) * kIAttrsCount);
-        SkASSERT(0 == msaaIAttrs[kIAttrsCount - 2] &&
-                 0 == msaaIAttrs[kIAttrsCount - 1]);
-        msaaIAttrs[kIAttrsCount - 2] = SK_WGL_SAMPLE_BUFFERS;
-        msaaIAttrs[kIAttrsCount - 1] = TRUE;
-        msaaIAttrs[kIAttrsCount + 0] = SK_WGL_SAMPLES;
-        msaaIAttrs[kIAttrsCount + 1] = msaaSampleCount;
-        msaaIAttrs[kIAttrsCount + 2] = 0;
-        msaaIAttrs[kIAttrsCount + 3] = 0;
+        SkTDArray<int> msaaIAttrs = iAttrs;
+        appendAttr(msaaIAttrs, SK_WGL_SAMPLE_BUFFERS, TRUE);
+        appendAttr(msaaIAttrs, SK_WGL_SAMPLES, msaaSampleCount);
+        appendAttr(msaaIAttrs, 0, 0);
         unsigned int num;
         int formats[64];
-        extensions.choosePixelFormat(dc, msaaIAttrs, fAttrs, 64, formats, &num);
+        extensions.choosePixelFormat(dc, msaaIAttrs.begin(), fAttrs, 64, formats, &num);
         num = SkTMin(num, 64U);
         formatsToTry[0] = extensions.selectFormat(formats, num, dc, msaaSampleCount);
     }
@@ -327,7 +330,8 @@
     // Get a non-MSAA format
     int* format = -1 == formatsToTry[0] ? &formatsToTry[0] : &formatsToTry[1];
     unsigned int num;
-    extensions.choosePixelFormat(dc, iAttrs, fAttrs, 1, format, &num);
+    appendAttr(iAttrs, 0, 0);
+    extensions.choosePixelFormat(dc, iAttrs.begin(), fAttrs, 1, format, &num);
 }
 
 static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextRequest contextType) {
@@ -393,7 +397,8 @@
     return glrc;
 }
 
-HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, SkWGLContextRequest contextType) {
+HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, bool deepColor,
+                         SkWGLContextRequest contextType) {
     SkWGLExtensions extensions;
     if (!extensions.hasExtension(dc, "WGL_ARB_pixel_format")) {
         return nullptr;
@@ -402,7 +407,7 @@
     BOOL set = FALSE;
 
     int pixelFormatsToTry[] = { -1, -1 };
-    get_pixel_formats_to_try(dc, extensions, true, msaaSampleCount, pixelFormatsToTry);
+    get_pixel_formats_to_try(dc, extensions, true, msaaSampleCount, deepColor, pixelFormatsToTry);
     for (int f = 0;
          !set && -1 != pixelFormatsToTry[f] && f < SK_ARRAY_COUNT(pixelFormatsToTry);
          ++f) {
@@ -429,7 +434,7 @@
     for (int dblBuffer = 0; dblBuffer < 2; ++dblBuffer) {
         int pixelFormatsToTry[] = { -1, -1 };
         get_pixel_formats_to_try(parentDC, extensions, (0 != dblBuffer), msaaSampleCount,
-                                 pixelFormatsToTry);
+                                 false, pixelFormatsToTry);
         for (int f = 0; -1 != pixelFormatsToTry[f] && f < SK_ARRAY_COUNT(pixelFormatsToTry); ++f) {
             HPBUFFER pbuf = extensions.createPbuffer(parentDC, pixelFormatsToTry[f], 1, 1, nullptr);
             if (0 != pbuf) {