Make SkBlendMode_AsCoeff() public

Change-Id: Ie704f0f83b1034ff8ee1a5d3cd194e555cae20a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252600
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index e9f78e0..d660a6f 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -17,6 +17,9 @@
   * Remove old async read pixels APIs
     https://review.skia.org/251198
 
+  * Expose SkBlendModeCoeff and SkBlendMode_AsCoeff for Porter-Duff blend modes.
+    https://review.skia.org/252600
+
 * * *
 
 Milestone 79
diff --git a/include/core/SkBlendMode.h b/include/core/SkBlendMode.h
index 270978f..1dff8a7 100644
--- a/include/core/SkBlendMode.h
+++ b/include/core/SkBlendMode.h
@@ -45,6 +45,34 @@
     kLastMode          = kLuminosity, //!< last valid value
 };
 
+/**
+ * For Porter-Duff SkBlendModes (those <= kLastCoeffMode), these coefficients describe the blend
+ * equation used. Coefficient-based blend modes specify an equation:
+ * ('dstCoeff' * dst + 'srcCoeff' * src), where the coefficient values are constants, functions of
+ * the src or dst alpha, or functions of the src or dst color.
+ */
+enum class SkBlendModeCoeff {
+    kZero, /** 0 */
+    kOne,  /** 1 */
+    kSC,   /** src color */
+    kISC,  /** inverse src color (i.e. 1 - sc) */
+    kDC,   /** dst color */
+    kIDC,  /** inverse dst color (i.e. 1 - dc) */
+    kSA,   /** src alpha */
+    kISA,  /** inverse src alpha (i.e. 1 - sa) */
+    kDA,   /** dst alpha */
+    kIDA,  /** inverse dst alpha (i.e. 1 - da) */
+
+    kCoeffCount
+};
+
+/**
+ * Returns true if 'mode' is a coefficient-based blend mode (<= kLastCoeffMode). If true is
+ * returned, the mode's src and dst coefficient functions are set in 'src' and 'dst'.
+ */
+SK_API bool SkBlendMode_AsCoeff(SkBlendMode mode, SkBlendModeCoeff* src, SkBlendModeCoeff* dst);
+
+
 /** Returns name of blendMode as null-terminated C string.
 
     @param blendMode  one of:
diff --git a/src/core/SkBlendModePriv.h b/src/core/SkBlendModePriv.h
index c5e688a..b19e565 100644
--- a/src/core/SkBlendModePriv.h
+++ b/src/core/SkBlendModePriv.h
@@ -23,23 +23,6 @@
 bool SkBlendMode_ShouldPreScaleCoverage(SkBlendMode, bool rgb_coverage);
 void SkBlendMode_AppendStages(SkBlendMode, SkRasterPipeline*);
 
-enum class SkBlendModeCoeff {
-    kZero, /** 0 */
-    kOne,  /** 1 */
-    kSC,   /** src color */
-    kISC,  /** inverse src color (i.e. 1 - sc) */
-    kDC,   /** dst color */
-    kIDC,  /** inverse dst color (i.e. 1 - dc) */
-    kSA,   /** src alpha */
-    kISA,  /** inverse src alpha (i.e. 1 - sa) */
-    kDA,   /** dst alpha */
-    kIDA,  /** inverse dst alpha (i.e. 1 - da) */
-
-    kCoeffCount
-};
-
-bool SkBlendMode_AsCoeff(SkBlendMode mode, SkBlendModeCoeff* src, SkBlendModeCoeff* dst);
-
 SkPMColor4f SkBlendMode_Apply(SkBlendMode, const SkPMColor4f& src, const SkPMColor4f& dst);
 
 #if SK_SUPPORT_GPU
diff --git a/src/gpu/glsl/GrGLSLBlend.cpp b/src/gpu/glsl/GrGLSLBlend.cpp
index 2d1e93c..49810c3 100644
--- a/src/gpu/glsl/GrGLSLBlend.cpp
+++ b/src/gpu/glsl/GrGLSLBlend.cpp
@@ -5,7 +5,6 @@
  * found in the LICENSE file.
  */
 
-#include "src/core/SkBlendModePriv.h"
 #include "src/gpu/glsl/GrGLSLBlend.h"
 #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
 #include "src/gpu/glsl/GrGLSLProgramBuilder.h"