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 GrPaint* grPaint); | 51 GrPaint* grPaint, |
| 52 GrRenderTarget*); |
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, |
56 GrPaint* grPaint); | 57 GrPaint* grPaint, |
| 58 GrRenderTarget*); |
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, |
64 GrPaint* grPaint); | 66 GrPaint* grPaint, |
| 67 GrRenderTarget*); |
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, |
75 GrPaint* grPaint); | 78 GrPaint* grPaint, |
| 79 GrRenderTarget*); |
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 GrPaint* grPaint, |
| 87 GrRenderTarget*rt) { |
83 return SkPaintToGrPaintWithXfermode(context, skPaint, SkMatrix::I(), SkXferm
ode::kDst_Mode, | 88 return SkPaintToGrPaintWithXfermode(context, skPaint, SkMatrix::I(), SkXferm
ode::kDst_Mode, |
84 false, grPaint); | 89 false, grPaint, rt); |
85 } | 90 } |
86 | 91 |
87 ////////////////////////////////////////////////////////////////////////////// | 92 ////////////////////////////////////////////////////////////////////////////// |
88 | 93 |
89 GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&); | 94 GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&); |
90 | 95 |
91 bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfi
leType*); | 96 bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfi
leType*); |
92 | 97 |
93 /** | 98 /** |
94 * If the compressed data in the SkData is supported (as a texture format, this
returns | 99 * If the compressed data in the SkData is supported (as a texture format, this
returns |
(...skipping 25 matching lines...) Expand all Loading... |
120 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff); | 125 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff); |
121 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff); | 126 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff); |
122 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff); | 127 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff); |
123 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff); | 128 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff); |
124 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff); | 129 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff); |
125 GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10); | 130 GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10); |
126 | 131 |
127 #define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X)) | 132 #define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X)) |
128 | 133 |
129 #endif | 134 #endif |
OLD | NEW |