Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 60 |
| 61 static inline GrColor SkColor2GrColor(SkColor c) { | 61 static inline GrColor SkColor2GrColor(SkColor c) { |
| 62 SkPMColor pm = SkPreMultiplyColor(c); | 62 SkPMColor pm = SkPreMultiplyColor(c); |
| 63 unsigned r = SkGetPackedR32(pm); | 63 unsigned r = SkGetPackedR32(pm); |
| 64 unsigned g = SkGetPackedG32(pm); | 64 unsigned g = SkGetPackedG32(pm); |
| 65 unsigned b = SkGetPackedB32(pm); | 65 unsigned b = SkGetPackedB32(pm); |
| 66 unsigned a = SkGetPackedA32(pm); | 66 unsigned a = SkGetPackedA32(pm); |
| 67 return GrColorPackRGBA(r, g, b, a); | 67 return GrColorPackRGBA(r, g, b, a); |
| 68 } | 68 } |
| 69 | 69 |
| 70 static inline GrColor SkColor2GrColorJustAlpha(SkColor c) { | |
| 71 U8CPU a = SkColorGetA(c); | |
| 72 return GrColorPackRGBA(a, a, a, a); | |
| 73 } | |
|
dandov
2014/06/06 21:50:44
function to get the alpha value of a SkColor in al
| |
| 74 | |
| 70 //////////////////////////////////////////////////////////////////////////////// | 75 //////////////////////////////////////////////////////////////////////////////// |
| 71 | 76 |
| 72 bool GrIsBitmapInCache(const GrContext*, const SkBitmap&, const GrTextureParams* ); | 77 bool GrIsBitmapInCache(const GrContext*, const SkBitmap&, const GrTextureParams* ); |
| 73 | 78 |
| 74 GrTexture* GrLockAndRefCachedBitmapTexture(GrContext*, const SkBitmap&, const Gr TextureParams*); | 79 GrTexture* GrLockAndRefCachedBitmapTexture(GrContext*, const SkBitmap&, const Gr TextureParams*); |
| 75 | 80 |
| 76 void GrUnlockAndUnrefCachedBitmapTexture(GrTexture*); | 81 void GrUnlockAndUnrefCachedBitmapTexture(GrTexture*); |
| 77 | 82 |
| 78 //////////////////////////////////////////////////////////////////////////////// | 83 //////////////////////////////////////////////////////////////////////////////// |
| 79 | 84 |
| 80 // Converts a SkPaint to a GrPaint, ignoring the SkPaint's shader. | 85 // Converts a SkPaint to a GrPaint, ignoring the SkPaint's shader. |
| 81 // justAlpha indicates that the SkPaint's alpha should be used rather than the c olor. | 86 // Sets the color of GrPaint to the value of the parameter grColor |
| 82 // Callers may subsequently modify the GrPaint. Setting constantColor indicates | 87 // Callers may subsequently modify the GrPaint. Setting constantColor indicates |
| 83 // that the final paint will draw the same color at every pixel. This allows | 88 // that the final paint will draw the same color at every pixel. This allows |
| 84 // an optimization where the the color filter can be applied to the SkPaint's | 89 // an optimization where the the color filter can be applied to the SkPaint's |
| 85 // color once while converting to GrPaint and then ignored. | 90 // color once while converting to GrPaint and then ignored. |
| 86 void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, bool ju stAlpha, | 91 void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrColor grColor, |
|
dandov
2014/06/06 21:50:44
Change method's signature, now it receives the GrC
| |
| 87 bool constantColor, GrPaint* grPaint); | 92 bool constantColor, GrPaint* grPaint); |
| 88 | 93 |
| 89 // This function is similar to skPaint2GrPaintNoShader but also converts | 94 // This function is similar to skPaint2GrPaintNoShader but also converts |
| 90 // skPaint's shader to a GrTexture/GrEffectStage if possible. | 95 // skPaint's shader to a GrTexture/GrEffectStage if possible. |
| 91 // constantColor has the same meaning as in skPaint2GrPaintNoShader. | 96 // constantColor has the same meaning as in skPaint2GrPaintNoShader. |
| 92 void SkPaint2GrPaintShader(GrContext* context, const SkPaint& skPaint, | 97 void SkPaint2GrPaintShader(GrContext* context, const SkPaint& skPaint, |
| 93 bool constantColor, GrPaint* grPaint); | 98 bool constantColor, GrPaint* grPaint); |
| 94 | 99 |
| 95 //////////////////////////////////////////////////////////////////////////////// | 100 //////////////////////////////////////////////////////////////////////////////// |
| 96 // Classes | 101 // Classes |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 115 | 120 |
| 116 private: | 121 private: |
| 117 SkGlyphCache* fStrike; | 122 SkGlyphCache* fStrike; |
| 118 GrKey* fKey; | 123 GrKey* fKey; |
| 119 // DECLARE_INSTANCE_COUNTER(SkGrFontScaler); | 124 // DECLARE_INSTANCE_COUNTER(SkGrFontScaler); |
| 120 }; | 125 }; |
| 121 | 126 |
| 122 //////////////////////////////////////////////////////////////////////////////// | 127 //////////////////////////////////////////////////////////////////////////////// |
| 123 | 128 |
| 124 #endif | 129 #endif |
| OLD | NEW |