Add NewRGB() with float gamma to SkColorSpace public API

Necessary because PNGs like to specify their gamma this way.

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3402

Change-Id: I399984d611db907b115b345df1afc88d39326fbb
Reviewed-on: https://skia-review.googlesource.com/3402
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h
index 26dd221..fc68fd4 100644
--- a/include/core/SkColorSpace.h
+++ b/include/core/SkColorSpace.h
@@ -89,12 +89,14 @@
     /**
      *  Create an SkColorSpace from a transfer function and a color gamut.
      *
-     *  Transfer function can be specified as a render target or as the coefficients to an equation.
+     *  Transfer function can be specified as a render target, as the coefficients to an equation,
+     *  or as three exponents (R, G, B).
      *  Gamut is specified using the matrix transformation to XYZ D50.
      */
     static sk_sp<SkColorSpace> NewRGB(RenderTargetGamma gamma, const SkMatrix44& toXYZD50);
     static sk_sp<SkColorSpace> NewRGB(const SkColorSpaceTransferFn& coeffs,
                                       const SkMatrix44& toXYZD50);
+    static sk_sp<SkColorSpace> NewRGB(const float exponents[3], const SkMatrix44& toXYZD50);
 
     /**
      *  Create a common, named SkColorSpace.
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 83032e6..9f8722f 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -8,7 +8,7 @@
 #include "SkBitmap.h"
 #include "SkCodecPriv.h"
 #include "SkColorPriv.h"
-#include "SkColorSpace_Base.h"
+#include "SkColorSpace.h"
 #include "SkColorTable.h"
 #include "SkMath.h"
 #include "SkOpts.h"
@@ -387,7 +387,7 @@
             gammas[1] = value;
             gammas[2] = value;
 
-            return SkColorSpace_Base::NewRGB(gammas, toXYZD50);
+            return SkColorSpace::NewRGB(gammas, toXYZD50);
         }
 
         // Default to sRGB gamma if the image has color space information,
@@ -408,7 +408,7 @@
         SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
         toXYZD50.set3x3RowMajorf(gSRGB_toXYZD50);
 
-        return SkColorSpace_Base::NewRGB(gammas, toXYZD50);
+        return SkColorSpace::NewRGB(gammas, toXYZD50);
     }
 
 #endif // LIBPNG >= 1.6
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp
index 4052856..bdef5b3 100644
--- a/src/core/SkColorSpace.cpp
+++ b/src/core/SkColorSpace.cpp
@@ -138,7 +138,7 @@
            color_space_almost_equal(toXYZD50.getFloat(3, 3), 1.0f);
 }
 
-sk_sp<SkColorSpace> SkColorSpace_Base::NewRGB(const float values[3], const SkMatrix44& toXYZD50) {
+sk_sp<SkColorSpace> SkColorSpace::NewRGB(const float values[3], const SkMatrix44& toXYZD50) {
     if (0.0f > values[0] || 0.0f > values[1] || 0.0f > values[2]) {
         return nullptr;
     }
@@ -560,7 +560,7 @@
 
             SkMatrix44 toXYZ(SkMatrix44::kUninitialized_Constructor);
             toXYZ.set3x4RowMajorf((const float*) data);
-            return SkColorSpace_Base::NewRGB(gammas, toXYZ);
+            return SkColorSpace::NewRGB(gammas, toXYZ);
         }
         case ColorSpaceHeader::kTransferFn_Flag: {
             if (length < 19 * sizeof(float)) {
diff --git a/src/core/SkColorSpace_Base.h b/src/core/SkColorSpace_Base.h
index 04f9b0b..36cc477 100644
--- a/src/core/SkColorSpace_Base.h
+++ b/src/core/SkColorSpace_Base.h
@@ -169,9 +169,6 @@
 
 class SkColorSpace_Base : public SkColorSpace {
 public:
-
-    static sk_sp<SkColorSpace> NewRGB(const float gammas[3], const SkMatrix44& toXYZD50);
-
     SkGammaNamed gammaNamed() const { return fGammaNamed; }
     const SkGammas* gammas() const { return fGammas.get(); }
 
diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp
index e9cc14f..aa0a33b 100644
--- a/tests/ColorSpaceTest.cpp
+++ b/tests/ColorSpaceTest.cpp
@@ -228,7 +228,7 @@
 
     const float gammas[] = { 1.1f, 1.2f, 1.7f, };
     SkMatrix44 toXYZ(SkMatrix44::kIdentity_Constructor);
-    test_serialize(r, SkColorSpace_Base::NewRGB(gammas, toXYZ).get(), false);
+    test_serialize(r, SkColorSpace::NewRGB(gammas, toXYZ).get(), false);
 
     SkColorSpaceTransferFn fn;
     fn.fA = 1.0f;
@@ -256,9 +256,9 @@
     const float gammas1[] = { 1.1f, 1.2f, 1.3f, };
     const float gammas2[] = { 1.1f, 1.2f, 1.7f, };
     SkMatrix44 toXYZ(SkMatrix44::kIdentity_Constructor);
-    sk_sp<SkColorSpace> rgb1 = SkColorSpace_Base::NewRGB(gammas1, toXYZ);
-    sk_sp<SkColorSpace> rgb2 = SkColorSpace_Base::NewRGB(gammas2, toXYZ);
-    sk_sp<SkColorSpace> rgb3 = SkColorSpace_Base::NewRGB(gammas1, toXYZ);
+    sk_sp<SkColorSpace> rgb1 = SkColorSpace::NewRGB(gammas1, toXYZ);
+    sk_sp<SkColorSpace> rgb2 = SkColorSpace::NewRGB(gammas2, toXYZ);
+    sk_sp<SkColorSpace> rgb3 = SkColorSpace::NewRGB(gammas1, toXYZ);
 
     SkColorSpaceTransferFn fn;
     fn.fA = 1.0f;
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 224e8c7..241ddb1 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -923,7 +923,7 @@
     auto adobeColorSpace = SkColorSpace::NewNamed(SkColorSpace::kAdobeRGB_Named);
     SkMatrix44 srgbMatrix = as_CSB(srgbColorSpace)->toXYZD50();
     const float oddGamma[] = { 2.4f, 2.4f, 2.4f };
-    auto oddColorSpace = SkColorSpace_Base::NewRGB(oddGamma, srgbMatrix);
+    auto oddColorSpace = SkColorSpace::NewRGB(oddGamma, srgbMatrix);
     auto linearColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGBLinear_Named);
 
     const struct {