OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff); | 31 GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff); |
32 GR_STATIC_ASSERT((int)kOne_GrBlendCoeff == (int)SkXfermode::kOne_Coeff); | 32 GR_STATIC_ASSERT((int)kOne_GrBlendCoeff == (int)SkXfermode::kOne_Coeff); |
33 GR_STATIC_ASSERT((int)kSC_GrBlendCoeff == (int)SkXfermode::kSC_Coeff); | 33 GR_STATIC_ASSERT((int)kSC_GrBlendCoeff == (int)SkXfermode::kSC_Coeff); |
34 GR_STATIC_ASSERT((int)kISC_GrBlendCoeff == (int)SkXfermode::kISC_Coeff); | 34 GR_STATIC_ASSERT((int)kISC_GrBlendCoeff == (int)SkXfermode::kISC_Coeff); |
35 GR_STATIC_ASSERT((int)kDC_GrBlendCoeff == (int)SkXfermode::kDC_Coeff); | 35 GR_STATIC_ASSERT((int)kDC_GrBlendCoeff == (int)SkXfermode::kDC_Coeff); |
36 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff); | 36 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff); |
37 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff); | 37 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff); |
38 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff); | 38 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff); |
39 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff); | 39 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff); |
40 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff); | 40 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff); |
| 41 GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10); |
41 | 42 |
42 #define sk_blend_to_grblend(X) ((GrBlendCoeff)(X)) | 43 #define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X)) |
43 | 44 |
44 /////////////////////////////////////////////////////////////////////////////// | 45 /////////////////////////////////////////////////////////////////////////////// |
45 | 46 |
46 #include "SkColorPriv.h" | 47 #include "SkColorPriv.h" |
47 | 48 |
48 GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType, SkAlphaType, SkColorProfile
Type); | 49 GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType, SkAlphaType, SkColorProfile
Type); |
49 | 50 |
50 static inline GrPixelConfig SkImageInfo2GrPixelConfig(const SkImageInfo& info) { | 51 static inline GrPixelConfig SkImageInfo2GrPixelConfig(const SkImageInfo& info) { |
51 return SkImageInfo2GrPixelConfig(info.colorType(), info.alphaType(), info.pr
ofileType()); | 52 return SkImageInfo2GrPixelConfig(info.colorType(), info.alphaType(), info.pr
ofileType()); |
52 } | 53 } |
53 | 54 |
54 bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfi
leType*); | 55 bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfi
leType*); |
55 | 56 |
56 static inline GrColor SkColor2GrColor(SkColor c) { | 57 static inline GrColor SkColor2GrColor(SkColor c) { |
57 SkPMColor pm = SkPreMultiplyColor(c); | 58 SkPMColor pm = SkPreMultiplyColor(c); |
58 unsigned r = SkGetPackedR32(pm); | 59 unsigned r = SkGetPackedR32(pm); |
59 unsigned g = SkGetPackedG32(pm); | 60 unsigned g = SkGetPackedG32(pm); |
60 unsigned b = SkGetPackedB32(pm); | 61 unsigned b = SkGetPackedB32(pm); |
61 unsigned a = SkGetPackedA32(pm); | 62 unsigned a = SkGetPackedA32(pm); |
62 return GrColorPackRGBA(r, g, b, a); | 63 return GrColorPackRGBA(r, g, b, a); |
63 } | 64 } |
64 | 65 |
65 static inline GrColor SkColor2GrColorJustAlpha(SkColor c) { | 66 static inline GrColor SkColor2GrColorJustAlpha(SkColor c) { |
66 U8CPU a = SkColorGetA(c); | 67 U8CPU a = SkColorGetA(c); |
67 return GrColorPackRGBA(a, a, a, a); | 68 return GrColorPackRGBA(a, a, a, a); |
68 } | 69 } |
69 | 70 |
| 71 static inline SkPMColor GrColorToSkPMColor(GrColor c) { |
| 72 GrColorIsPMAssert(c); |
| 73 return SkPackARGB32(GrColorUnpackA(c), GrColorUnpackR(c), GrColorUnpackG(c),
GrColorUnpackB(c)); |
| 74 } |
| 75 |
| 76 static inline GrColor SkPMColorToGrColor(SkPMColor c) { |
| 77 return GrColorPackRGBA(SkGetPackedR32(c), SkGetPackedG32(c), SkGetPackedB32(
c), |
| 78 SkGetPackedA32(c)); |
| 79 } |
| 80 |
70 //////////////////////////////////////////////////////////////////////////////// | 81 //////////////////////////////////////////////////////////////////////////////// |
71 | 82 |
72 /** | 83 /** |
73 * If the compressed data in the SkData is supported (as a texture format, this
returns | 84 * If the compressed data in the SkData is supported (as a texture format, this
returns |
74 * the pixel-config that should be used, and sets outStartOfDataToUpload to the
ptr into | 85 * the pixel-config that should be used, and sets outStartOfDataToUpload to the
ptr into |
75 * the data where the actual raw data starts (skipping any header bytes). | 86 * the data where the actual raw data starts (skipping any header bytes). |
76 * | 87 * |
77 * If the compressed data is not supported, this returns kUnknown_GrPixelConfig
, and | 88 * If the compressed data is not supported, this returns kUnknown_GrPixelConfig
, and |
78 * ignores outStartOfDataToUpload. | 89 * ignores outStartOfDataToUpload. |
79 */ | 90 */ |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 bool* doBicubic); | 135 bool* doBicubic); |
125 | 136 |
126 //////////////////////////////////////////////////////////////////////////////// | 137 //////////////////////////////////////////////////////////////////////////////// |
127 // Classes | 138 // Classes |
128 | 139 |
129 class SkGlyphCache; | 140 class SkGlyphCache; |
130 | 141 |
131 //////////////////////////////////////////////////////////////////////////////// | 142 //////////////////////////////////////////////////////////////////////////////// |
132 | 143 |
133 #endif | 144 #endif |
OLD | NEW |