| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkGrPriv_DEFINED | 8 #ifndef SkGrPriv_DEFINED |
| 9 #define SkGrPriv_DEFINED | 9 #define SkGrPriv_DEFINED |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 /** Call this after installing a GrUniqueKey on texture. It will cause the textu
re's key to be | 42 /** Call this after installing a GrUniqueKey on texture. It will cause the textu
re's key to be |
| 43 removed should the bitmap's contents change or be destroyed. */ | 43 removed should the bitmap's contents change or be destroyed. */ |
| 44 void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pix
elRef); | 44 void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pix
elRef); |
| 45 | 45 |
| 46 /** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is requir
ed in order | 46 /** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is requir
ed in order |
| 47 to convert the SkShader (if any) on the SkPaint. The primitive itself has no
color. */ | 47 to convert the SkShader (if any) on the SkPaint. The primitive itself has no
color. */ |
| 48 bool SkPaintToGrPaint(GrContext*, | 48 bool SkPaintToGrPaint(GrContext*, |
| 49 const SkPaint& skPaint, | 49 const SkPaint& skPaint, |
| 50 const SkMatrix& viewM, | 50 const SkMatrix& viewM, |
| 51 bool allowSRGBInputs, |
| 51 GrPaint* grPaint); | 52 GrPaint* grPaint); |
| 52 | 53 |
| 53 /** Same as above but ignores the SkShader (if any) on skPaint. */ | 54 /** Same as above but ignores the SkShader (if any) on skPaint. */ |
| 54 bool SkPaintToGrPaintNoShader(GrContext* context, | 55 bool SkPaintToGrPaintNoShader(GrContext* context, |
| 55 const SkPaint& skPaint, | 56 const SkPaint& skPaint, |
| 57 bool allowSRGBInputs, |
| 56 GrPaint* grPaint); | 58 GrPaint* grPaint); |
| 57 | 59 |
| 58 /** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProce
ssor. The processor | 60 /** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProce
ssor. The processor |
| 59 should expect an unpremul input color and produce a premultiplied output col
or. There is | 61 should expect an unpremul input color and produce a premultiplied output col
or. There is |
| 60 no primitive color. */ | 62 no primitive color. */ |
| 61 bool SkPaintToGrPaintReplaceShader(GrContext*, | 63 bool SkPaintToGrPaintReplaceShader(GrContext*, |
| 62 const SkPaint& skPaint, | 64 const SkPaint& skPaint, |
| 63 const GrFragmentProcessor* shaderFP, | 65 const GrFragmentProcessor* shaderFP, |
| 66 bool allowSRGBInputs, |
| 64 GrPaint* grPaint); | 67 GrPaint* grPaint); |
| 65 | 68 |
| 66 /** Blends the SkPaint's shader (or color if no shader) with the color which spe
cified via a | 69 /** Blends the SkPaint's shader (or color if no shader) with the color which spe
cified via a |
| 67 GrBatch's GrPrimitiveProcesssor. Currently there is a bool param to indicate
whether the | 70 GrBatch's GrPrimitiveProcesssor. Currently there is a bool param to indicate
whether the |
| 68 primitive color is the dst or src color to the blend in order to work around
differences between | 71 primitive color is the dst or src color to the blend in order to work around
differences between |
| 69 drawVertices and drawAtlas. */ | 72 drawVertices and drawAtlas. */ |
| 70 bool SkPaintToGrPaintWithXfermode(GrContext* context, | 73 bool SkPaintToGrPaintWithXfermode(GrContext* context, |
| 71 const SkPaint& skPaint, | 74 const SkPaint& skPaint, |
| 72 const SkMatrix& viewM, | 75 const SkMatrix& viewM, |
| 73 SkXfermode::Mode primColorMode, | 76 SkXfermode::Mode primColorMode, |
| 74 bool primitiveIsSrc, | 77 bool primitiveIsSrc, |
| 78 bool allowSRGBInputs, |
| 75 GrPaint* grPaint); | 79 GrPaint* grPaint); |
| 76 | 80 |
| 77 /** This is used when there is a primitive color, but the shader should be ignor
ed. Currently, | 81 /** This is used when there is a primitive color, but the shader should be ignor
ed. Currently, |
| 78 the expectation is that the primitive color will be premultiplied, though it
really should be | 82 the expectation is that the primitive color will be premultiplied, though it
really should be |
| 79 unpremultiplied so that interpolation is done in unpremul space. The paint's
alpha will be | 83 unpremultiplied so that interpolation is done in unpremul space. The paint's
alpha will be |
| 80 applied to the primitive color after interpolation. */ | 84 applied to the primitive color after interpolation. */ |
| 81 inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, const SkPaint
& skPaint, | 85 inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, const SkPaint
& skPaint, |
| 82 GrPaint* grPaint) { | 86 bool allowSRGBInputs, GrPaint* gr
Paint) { |
| 83 return SkPaintToGrPaintWithXfermode(context, skPaint, SkMatrix::I(), SkXferm
ode::kDst_Mode, | 87 return SkPaintToGrPaintWithXfermode(context, skPaint, SkMatrix::I(), SkXferm
ode::kDst_Mode, |
| 84 false, grPaint); | 88 false, allowSRGBInputs, grPaint); |
| 85 } | 89 } |
| 86 | 90 |
| 87 /** This is used when there may or may not be a shader, and the caller wants to
plugin a texture | 91 /** This is used when there may or may not be a shader, and the caller wants to
plugin a texture |
| 88 lookup. If there is a shader, then its output will only be used if the text
ure is alpha8. */ | 92 lookup. If there is a shader, then its output will only be used if the text
ure is alpha8. */ |
| 89 bool SkPaintToGrPaintWithTexture(GrContext* context, | 93 bool SkPaintToGrPaintWithTexture(GrContext* context, |
| 90 const SkPaint& paint, | 94 const SkPaint& paint, |
| 91 const SkMatrix& viewM, | 95 const SkMatrix& viewM, |
| 92 const GrFragmentProcessor* fp, | 96 const GrFragmentProcessor* fp, |
| 93 bool textureIsAlphaOnly, | 97 bool textureIsAlphaOnly, |
| 98 bool allowSRGBInputs, |
| 94 GrPaint* grPaint); | 99 GrPaint* grPaint); |
| 95 | 100 |
| 96 ////////////////////////////////////////////////////////////////////////////// | 101 ////////////////////////////////////////////////////////////////////////////// |
| 97 | 102 |
| 98 GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&); | 103 GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&); |
| 99 | 104 |
| 100 bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfi
leType*); | 105 bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfi
leType*); |
| 101 | 106 |
| 102 /** | 107 /** |
| 103 * If the compressed data in the SkData is supported (as a texture format, this
returns | 108 * If the compressed data in the SkData is supported (as a texture format, this
returns |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff); | 141 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff); |
| 137 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff); | 142 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff); |
| 138 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff); | 143 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff); |
| 139 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff); | 144 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff); |
| 140 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff); | 145 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff); |
| 141 GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10); | 146 GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10); |
| 142 | 147 |
| 143 #define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X)) | 148 #define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X)) |
| 144 | 149 |
| 145 #endif | 150 #endif |
| OLD | NEW |