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>
This commit is contained in:
Michael Ludwig 2019-11-04 15:01:52 -05:00 committed by Skia Commit-Bot
parent 85c3d68f25
commit cc836871cb
4 changed files with 31 additions and 18 deletions

View File

@ -17,6 +17,9 @@ Milestone 80
* 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

View File

@ -45,6 +45,34 @@ enum class SkBlendMode {
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:

View File

@ -23,23 +23,6 @@ static inline bool SkBlendMode_CaresAboutRBOrder(SkBlendMode mode) {
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

View File

@ -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"