| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 #include "GrBlend.h" | 9 #include "GrBlend.h" |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 static inline bool valid_color(uint32_t compFlags) { | 52 static inline bool valid_color(uint32_t compFlags) { |
| 53 return (kRGBA_GrColorComponentFlags & compFlags) == kRGBA_GrColorComponentF
lags; | 53 return (kRGBA_GrColorComponentFlags & compFlags) == kRGBA_GrColorComponentF
lags; |
| 54 } | 54 } |
| 55 | 55 |
| 56 static GrColor simplify_blend_term(GrBlendCoeff* srcCoeff, | 56 static GrColor simplify_blend_term(GrBlendCoeff* srcCoeff, |
| 57 GrColor srcColor, uint32_t srcCompFlags, | 57 GrColor srcColor, uint32_t srcCompFlags, |
| 58 GrColor dstColor, uint32_t dstCompFlags, | 58 GrColor dstColor, uint32_t dstCompFlags, |
| 59 GrColor constantColor) { | 59 GrColor constantColor) { |
| 60 | 60 |
| 61 GrAssert(!GrBlendCoeffRefsSrc(*srcCoeff)); | 61 SkASSERT(!GrBlendCoeffRefsSrc(*srcCoeff)); |
| 62 GrAssert(NULL != srcCoeff); | 62 SkASSERT(NULL != srcCoeff); |
| 63 | 63 |
| 64 // Check whether srcCoeff can be reduced to kOne or kZero based on known col
or inputs. | 64 // Check whether srcCoeff can be reduced to kOne or kZero based on known col
or inputs. |
| 65 // We could pick out the coeff r,g,b,a values here and use them to compute t
he blend term color, | 65 // We could pick out the coeff r,g,b,a values here and use them to compute t
he blend term color, |
| 66 // if possible, below but that is not implemented now. | 66 // if possible, below but that is not implemented now. |
| 67 switch (*srcCoeff) { | 67 switch (*srcCoeff) { |
| 68 case kIDC_GrBlendCoeff: | 68 case kIDC_GrBlendCoeff: |
| 69 dstColor = ~dstColor; // fallthrough | 69 dstColor = ~dstColor; // fallthrough |
| 70 case kDC_GrBlendCoeff: | 70 case kDC_GrBlendCoeff: |
| 71 if (valid_color(dstCompFlags)) { | 71 if (valid_color(dstCompFlags)) { |
| 72 if (0xffffffff == dstColor) { | 72 if (0xffffffff == dstColor) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 srcColor, srcCompFlags, | 145 srcColor, srcCompFlags, |
| 146 constantColor); | 146 constantColor); |
| 147 *dstCoeff = swap_coeff_src_dst(spoofedCoeff); | 147 *dstCoeff = swap_coeff_src_dst(spoofedCoeff); |
| 148 | 148 |
| 149 if (GrColor_ILLEGAL != srcTermColor && GrColor_ILLEGAL != dstTermColor) { | 149 if (GrColor_ILLEGAL != srcTermColor && GrColor_ILLEGAL != dstTermColor) { |
| 150 return add_colors(srcTermColor, dstTermColor); | 150 return add_colors(srcTermColor, dstTermColor); |
| 151 } else { | 151 } else { |
| 152 return GrColor_ILLEGAL; | 152 return GrColor_ILLEGAL; |
| 153 } | 153 } |
| 154 } | 154 } |
| OLD | NEW |