diff options
author | 2015-06-12 08:21:26 -0700 | |
---|---|---|
committer | 2015-06-12 08:21:26 -0700 | |
commit | ee0175f1b0c9099096d90945a985378dbe8e7fd9 (patch) | |
tree | bdab4f33f4895196d05781944f18ea5d637e5b32 | |
parent | 7e8521610446df6222703e8bc2a2fb45ec77823a (diff) |
Move blend enums into GrBlend.h
Moves blend enums from GrXferProcessor.h to GrBlend.h, makes GrBlend.h
public.
BUG=skia:
Review URL: https://codereview.chromium.org/1180713008
-rw-r--r-- | gyp/gpu.gypi | 2 | ||||
-rw-r--r-- | include/gpu/GrBlend.h (renamed from src/gpu/GrBlend.h) | 65 | ||||
-rw-r--r-- | include/gpu/GrXferProcessor.h | 61 |
3 files changed, 65 insertions, 63 deletions
diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi index 0396f196af..07a93a28af 100644 --- a/gyp/gpu.gypi +++ b/gyp/gpu.gypi @@ -12,6 +12,7 @@ { 'variables': { 'skgpu_sources': [ + '<(skia_include_path)/gpu/GrBlend.h', '<(skia_include_path)/gpu/GrCaps.h', '<(skia_include_path)/gpu/GrClip.h', '<(skia_include_path)/gpu/GrColor.h', @@ -82,7 +83,6 @@ '<(skia_src_path)/gpu/GrBatchTarget.h', '<(skia_src_path)/gpu/GrBatchTest.cpp', '<(skia_src_path)/gpu/GrBatchTest.h', - '<(skia_src_path)/gpu/GrBlend.h', '<(skia_src_path)/gpu/GrBlurUtils.cpp', '<(skia_src_path)/gpu/GrBlurUtils.h', '<(skia_src_path)/gpu/GrBufferAllocPool.cpp', diff --git a/src/gpu/GrBlend.h b/include/gpu/GrBlend.h index 7021902765..c8b931da73 100644 --- a/src/gpu/GrBlend.h +++ b/include/gpu/GrBlend.h @@ -7,12 +7,73 @@ */ #include "GrTypes.h" -#include "SkTLogic.h" -#include "GrXferProcessor.h" +#include "../../src/utils/SkTLogic.h" #ifndef GrBlend_DEFINED #define GrBlend_DEFINED +/** + * Equations for alpha-blending. + */ +enum GrBlendEquation { + // Basic blend equations. + kAdd_GrBlendEquation, //<! Cs*S + Cd*D + kSubtract_GrBlendEquation, //<! Cs*S - Cd*D + kReverseSubtract_GrBlendEquation, //<! Cd*D - Cs*S + + // Advanced blend equations. These are described in the SVG and PDF specs. + kScreen_GrBlendEquation, + kOverlay_GrBlendEquation, + kDarken_GrBlendEquation, + kLighten_GrBlendEquation, + kColorDodge_GrBlendEquation, + kColorBurn_GrBlendEquation, + kHardLight_GrBlendEquation, + kSoftLight_GrBlendEquation, + kDifference_GrBlendEquation, + kExclusion_GrBlendEquation, + kMultiply_GrBlendEquation, + kHSLHue_GrBlendEquation, + kHSLSaturation_GrBlendEquation, + kHSLColor_GrBlendEquation, + kHSLLuminosity_GrBlendEquation, + + kFirstAdvancedGrBlendEquation = kScreen_GrBlendEquation, + kLast_GrBlendEquation = kHSLLuminosity_GrBlendEquation +}; + +static const int kGrBlendEquationCnt = kLast_GrBlendEquation + 1; + + +/** + * Coeffecients for alpha-blending. + */ +enum GrBlendCoeff { + kZero_GrBlendCoeff, //<! 0 + kOne_GrBlendCoeff, //<! 1 + kSC_GrBlendCoeff, //<! src color + kISC_GrBlendCoeff, //<! one minus src color + kDC_GrBlendCoeff, //<! dst color + kIDC_GrBlendCoeff, //<! one minus dst color + kSA_GrBlendCoeff, //<! src alpha + kISA_GrBlendCoeff, //<! one minus src alpha + kDA_GrBlendCoeff, //<! dst alpha + kIDA_GrBlendCoeff, //<! one minus dst alpha + kConstC_GrBlendCoeff, //<! constant color + kIConstC_GrBlendCoeff, //<! one minus constant color + kConstA_GrBlendCoeff, //<! constant color alpha + kIConstA_GrBlendCoeff, //<! one minus constant color alpha + kS2C_GrBlendCoeff, + kIS2C_GrBlendCoeff, + kS2A_GrBlendCoeff, + kIS2A_GrBlendCoeff, + + kLast_GrBlendCoeff = kIS2A_GrBlendCoeff +}; + +static const int kGrBlendCoeffCnt = kLast_GrBlendCoeff + 1; + + template<GrBlendCoeff Coeff> struct GrTBlendCoeffRefsSrc : SkTBool<kSC_GrBlendCoeff == Coeff || kISC_GrBlendCoeff == Coeff || diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h index 8f2c69d995..332d9d2e23 100644 --- a/include/gpu/GrXferProcessor.h +++ b/include/gpu/GrXferProcessor.h @@ -8,6 +8,7 @@ #ifndef GrXferProcessor_DEFINED #define GrXferProcessor_DEFINED +#include "GrBlend.h" #include "GrColor.h" #include "GrProcessor.h" #include "GrTexture.h" @@ -20,66 +21,6 @@ class GrGLXferProcessor; class GrProcOptInfo; /** - * Equations for alpha-blending. - */ -enum GrBlendEquation { - // Basic blend equations. - kAdd_GrBlendEquation, //<! Cs*S + Cd*D - kSubtract_GrBlendEquation, //<! Cs*S - Cd*D - kReverseSubtract_GrBlendEquation, //<! Cd*D - Cs*S - - // Advanced blend equations. These are described in the SVG and PDF specs. - kScreen_GrBlendEquation, - kOverlay_GrBlendEquation, - kDarken_GrBlendEquation, - kLighten_GrBlendEquation, - kColorDodge_GrBlendEquation, - kColorBurn_GrBlendEquation, - kHardLight_GrBlendEquation, - kSoftLight_GrBlendEquation, - kDifference_GrBlendEquation, - kExclusion_GrBlendEquation, - kMultiply_GrBlendEquation, - kHSLHue_GrBlendEquation, - kHSLSaturation_GrBlendEquation, - kHSLColor_GrBlendEquation, - kHSLLuminosity_GrBlendEquation, - - kFirstAdvancedGrBlendEquation = kScreen_GrBlendEquation, - kLast_GrBlendEquation = kHSLLuminosity_GrBlendEquation -}; - -static const int kGrBlendEquationCnt = kLast_GrBlendEquation + 1; - -/** - * Coeffecients for alpha-blending. - */ -enum GrBlendCoeff { - kZero_GrBlendCoeff, //<! 0 - kOne_GrBlendCoeff, //<! 1 - kSC_GrBlendCoeff, //<! src color - kISC_GrBlendCoeff, //<! one minus src color - kDC_GrBlendCoeff, //<! dst color - kIDC_GrBlendCoeff, //<! one minus dst color - kSA_GrBlendCoeff, //<! src alpha - kISA_GrBlendCoeff, //<! one minus src alpha - kDA_GrBlendCoeff, //<! dst alpha - kIDA_GrBlendCoeff, //<! one minus dst alpha - kConstC_GrBlendCoeff, //<! constant color - kIConstC_GrBlendCoeff, //<! one minus constant color - kConstA_GrBlendCoeff, //<! constant color alpha - kIConstA_GrBlendCoeff, //<! one minus constant color alpha - kS2C_GrBlendCoeff, - kIS2C_GrBlendCoeff, - kS2A_GrBlendCoeff, - kIS2A_GrBlendCoeff, - - kLast_GrBlendCoeff = kIS2A_GrBlendCoeff -}; - -static const int kGrBlendCoeffCnt = kLast_GrBlendCoeff + 1; - -/** * Barriers for blending. When a shader reads the dst directly, an Xfer barrier is sometimes * required after a pixel has been written, before it can be safely read again. */ |