Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: src/gpu/SkGrPriv.h

Issue 2180503002: Add destination color space to AsFPArgs. Eliminates last XFORMTODO. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | src/gpu/text/GrAtlasTextContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool allowSRGBInputs,
52 SkColorSpace* dstColorSpace,
52 GrPaint* grPaint); 53 GrPaint* grPaint);
53 54
54 /** Same as above but ignores the SkShader (if any) on skPaint. */ 55 /** Same as above but ignores the SkShader (if any) on skPaint. */
55 bool SkPaintToGrPaintNoShader(GrContext* context, 56 bool SkPaintToGrPaintNoShader(GrContext* context,
56 const SkPaint& skPaint, 57 const SkPaint& skPaint,
57 bool allowSRGBInputs, 58 bool allowSRGBInputs,
59 SkColorSpace* dstColorSpace,
58 GrPaint* grPaint); 60 GrPaint* grPaint);
59 61
60 /** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProce ssor. The processor 62 /** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProce ssor. The processor
61 should expect an unpremul input color and produce a premultiplied output col or. There is 63 should expect an unpremul input color and produce a premultiplied output col or. There is
62 no primitive color. */ 64 no primitive color. */
63 bool SkPaintToGrPaintReplaceShader(GrContext*, 65 bool SkPaintToGrPaintReplaceShader(GrContext*,
64 const SkPaint& skPaint, 66 const SkPaint& skPaint,
65 sk_sp<GrFragmentProcessor> shaderFP, 67 sk_sp<GrFragmentProcessor> shaderFP,
66 bool allowSRGBInputs, 68 bool allowSRGBInputs,
69 SkColorSpace* dstColorSpace,
67 GrPaint* grPaint); 70 GrPaint* grPaint);
68 71
69 /** Blends the SkPaint's shader (or color if no shader) with the color which spe cified via a 72 /** Blends the SkPaint's shader (or color if no shader) with the color which spe cified via a
70 GrBatch's GrPrimitiveProcesssor. Currently there is a bool param to indicate whether the 73 GrBatch's GrPrimitiveProcesssor. Currently there is a bool param to indicate whether the
71 primitive color is the dst or src color to the blend in order to work around differences between 74 primitive color is the dst or src color to the blend in order to work around differences between
72 drawVertices and drawAtlas. */ 75 drawVertices and drawAtlas. */
73 bool SkPaintToGrPaintWithXfermode(GrContext* context, 76 bool SkPaintToGrPaintWithXfermode(GrContext* context,
74 const SkPaint& skPaint, 77 const SkPaint& skPaint,
75 const SkMatrix& viewM, 78 const SkMatrix& viewM,
76 SkXfermode::Mode primColorMode, 79 SkXfermode::Mode primColorMode,
77 bool primitiveIsSrc, 80 bool primitiveIsSrc,
78 bool allowSRGBInputs, 81 bool allowSRGBInputs,
82 SkColorSpace* dstColorSpace,
79 GrPaint* grPaint); 83 GrPaint* grPaint);
80 84
81 /** This is used when there is a primitive color, but the shader should be ignor ed. Currently, 85 /** This is used when there is a primitive color, but the shader should be ignor ed. Currently,
82 the expectation is that the primitive color will be premultiplied, though it really should be 86 the expectation is that the primitive color will be premultiplied, though it really should be
83 unpremultiplied so that interpolation is done in unpremul space. The paint's alpha will be 87 unpremultiplied so that interpolation is done in unpremul space. The paint's alpha will be
84 applied to the primitive color after interpolation. */ 88 applied to the primitive color after interpolation. */
85 inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, const SkPaint & skPaint, 89 inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, const SkPaint & skPaint,
86 bool allowSRGBInputs, GrPaint* gr Paint) { 90 bool allowSRGBInputs, SkColorSpac e* dstColorSpace,
91 GrPaint* grPaint) {
87 return SkPaintToGrPaintWithXfermode(context, skPaint, SkMatrix::I(), SkXferm ode::kDst_Mode, 92 return SkPaintToGrPaintWithXfermode(context, skPaint, SkMatrix::I(), SkXferm ode::kDst_Mode,
88 false, allowSRGBInputs, grPaint); 93 false, allowSRGBInputs, dstColorSpace, g rPaint);
89 } 94 }
90 95
91 /** This is used when there may or may not be a shader, and the caller wants to plugin a texture 96 /** This is used when there may or may not be a shader, and the caller wants to plugin a texture
92 lookup. If there is a shader, then its output will only be used if the text ure is alpha8. */ 97 lookup. If there is a shader, then its output will only be used if the text ure is alpha8. */
93 bool SkPaintToGrPaintWithTexture(GrContext* context, 98 bool SkPaintToGrPaintWithTexture(GrContext* context,
94 const SkPaint& paint, 99 const SkPaint& paint,
95 const SkMatrix& viewM, 100 const SkMatrix& viewM,
96 sk_sp<GrFragmentProcessor> fp, 101 sk_sp<GrFragmentProcessor> fp,
97 bool textureIsAlphaOnly, 102 bool textureIsAlphaOnly,
98 bool allowSRGBInputs, 103 bool allowSRGBInputs,
104 SkColorSpace* dstColorSpace,
99 GrPaint* grPaint); 105 GrPaint* grPaint);
100 106
101 ////////////////////////////////////////////////////////////////////////////// 107 //////////////////////////////////////////////////////////////////////////////
102 108
103 GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&); 109 GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&);
104 110
105 bool GrPixelConfigToColorType(GrPixelConfig, SkColorType*); 111 bool GrPixelConfigToColorType(GrPixelConfig, SkColorType*);
106 112
107 /** 113 /**
108 * If the compressed data in the SkData is supported (as a texture format, this returns 114 * If the compressed data in the SkData is supported (as a texture format, this returns
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff); 153 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff);
148 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff); 154 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff);
149 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff); 155 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff);
150 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff); 156 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff);
151 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff); 157 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff);
152 GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10); 158 GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10);
153 159
154 #define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X)) 160 #define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X))
155 161
156 #endif 162 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | src/gpu/text/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698