1 /* 2 * Copyright 2016 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkBlendModePriv_DEFINED 9 #define SkBlendModePriv_DEFINED 10 11 #include "SkBlendMode.h" 12 #include "SkPM4f.h" 13 14 class SkRasterPipeline; 15 16 bool SkBlendMode_SupportsCoverageAsAlpha(SkBlendMode); 17 18 static inline bool SkBlendMode_CaresAboutRBOrder(SkBlendMode mode) { 19 return (mode > SkBlendMode::kLastSeparableMode); 20 } 21 22 bool SkBlendMode_ShouldPreScaleCoverage(SkBlendMode, bool rgb_coverage); 23 void SkBlendMode_AppendStages(SkBlendMode, SkRasterPipeline*); 24 25 enum class SkBlendModeCoeff { 26 kZero, /** 0 */ 27 kOne, /** 1 */ 28 kSC, /** src color */ 29 kISC, /** inverse src color (i.e. 1 - sc) */ 30 kDC, /** dst color */ 31 kIDC, /** inverse dst color (i.e. 1 - dc) */ 32 kSA, /** src alpha */ 33 kISA, /** inverse src alpha (i.e. 1 - sa) */ 34 kDA, /** dst alpha */ 35 kIDA, /** inverse dst alpha (i.e. 1 - da) */ 36 37 kCoeffCount 38 }; 39 40 bool SkBlendMode_AsCoeff(SkBlendMode mode, SkBlendModeCoeff* src, SkBlendModeCoeff* dst); 41 42 SkPM4f SkBlendMode_Apply(SkBlendMode, const SkPM4f& src, const SkPM4f& dst); 43 44 #if SK_SUPPORT_GPU 45 #include "GrXferProcessor.h" 46 const GrXPFactory* SkBlendMode_AsXPFactory(SkBlendMode); 47 #endif 48 49 #endif 50