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 |
11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
| 12 #include "GrBlend.h" |
12 #include "GrTextureAccess.h" | 13 #include "GrTextureAccess.h" |
13 #include "SkImageInfo.h" | 14 #include "SkImageInfo.h" |
14 #include "SkXfermode.h" | 15 #include "SkXfermode.h" |
15 | 16 |
16 class GrCaps; | 17 class GrCaps; |
17 class GrContext; | 18 class GrContext; |
18 class GrFragmentProcessor; | 19 class GrFragmentProcessor; |
19 class GrPaint; | 20 class GrPaint; |
| 21 class GrTexture; |
20 class GrUniqueKey; | 22 class GrUniqueKey; |
21 class SkPaint; | 23 class SkPaint; |
22 class SkMatrix; | 24 class SkMatrix; |
23 struct SkIRect; | 25 struct SkIRect; |
24 | 26 |
25 struct SkGrStretch { | 27 struct SkGrStretch { |
26 enum Type { | 28 enum Type { |
27 kNone_Type, | 29 kNone_Type, |
28 kBilerp_Type, | 30 kBilerp_Type, |
29 kNearest_Type | 31 kNearest_Type |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 /** This is used when there is a primitive color, but the shader should be ignor
ed. Currently, | 89 /** This is used when there is a primitive color, but the shader should be ignor
ed. Currently, |
88 the expectation is that the primitive color will be premultiplied, though it
really should be | 90 the expectation is that the primitive color will be premultiplied, though it
really should be |
89 unpremultiplied so that interpolation is done in unpremul space. The paint's
alpha will be | 91 unpremultiplied so that interpolation is done in unpremul space. The paint's
alpha will be |
90 applied to the primitive color after interpolation. */ | 92 applied to the primitive color after interpolation. */ |
91 inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, const SkPaint
& skPaint, | 93 inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, const SkPaint
& skPaint, |
92 GrPaint* grPaint) { | 94 GrPaint* grPaint) { |
93 return SkPaintToGrPaintWithXfermode(context, skPaint, SkMatrix::I(), SkXferm
ode::kDst_Mode, | 95 return SkPaintToGrPaintWithXfermode(context, skPaint, SkMatrix::I(), SkXferm
ode::kDst_Mode, |
94 false, grPaint); | 96 false, grPaint); |
95 } | 97 } |
96 | 98 |
| 99 ////////////////////////////////////////////////////////////////////////////// |
| 100 |
97 bool GrTextureUsageSupported(const GrCaps&, int width, int height, SkImageUsageT
ype); | 101 bool GrTextureUsageSupported(const GrCaps&, int width, int height, SkImageUsageT
ype); |
98 | 102 |
| 103 GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&); |
| 104 |
| 105 bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfi
leType*); |
| 106 |
| 107 /** |
| 108 * If the compressed data in the SkData is supported (as a texture format, this
returns |
| 109 * the pixel-config that should be used, and sets outStartOfDataToUpload to the
ptr into |
| 110 * the data where the actual raw data starts (skipping any header bytes). |
| 111 * |
| 112 * If the compressed data is not supported, this returns kUnknown_GrPixelConfig,
and |
| 113 * ignores outStartOfDataToUpload. |
| 114 */ |
| 115 GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data, |
| 116 int expectedW, int expectedH, |
| 117 const void** outStartOfDataToUp
load); |
| 118 |
| 119 bool GrIsImageInCache(const GrContext* ctx, uint32_t imageID, const SkIRect& sub
set, |
| 120 GrTexture* nativeTexture, const GrTextureParams*); |
| 121 |
| 122 GrTexture* GrCreateTextureForPixels(GrContext*, const GrUniqueKey& optionalKey,
GrSurfaceDesc, |
| 123 SkPixelRef* pixelRefForInvalidationNotificat
ionOrNull, |
| 124 const void* pixels, size_t rowBytesOrZero); |
| 125 |
| 126 |
| 127 ////////////////////////////////////////////////////////////////////////////// |
| 128 |
| 129 GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff); |
| 130 GR_STATIC_ASSERT((int)kOne_GrBlendCoeff == (int)SkXfermode::kOne_Coeff); |
| 131 GR_STATIC_ASSERT((int)kSC_GrBlendCoeff == (int)SkXfermode::kSC_Coeff); |
| 132 GR_STATIC_ASSERT((int)kISC_GrBlendCoeff == (int)SkXfermode::kISC_Coeff); |
| 133 GR_STATIC_ASSERT((int)kDC_GrBlendCoeff == (int)SkXfermode::kDC_Coeff); |
| 134 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff); |
| 135 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff); |
| 136 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff); |
| 137 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff); |
| 138 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff); |
| 139 GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10); |
| 140 |
| 141 #define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X)) |
| 142 |
99 #endif | 143 #endif |
OLD | NEW |