OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "Sk4fLinearGradient.h" | 8 #include "Sk4fLinearGradient.h" |
9 #include "SkLinearGradient.h" | 9 #include "SkLinearGradient.h" |
10 #include "SkRefCnt.h" | 10 #include "SkRefCnt.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 size_t SkLinearGradient::onContextSize(const ContextRec& rec) const { | 77 size_t SkLinearGradient::onContextSize(const ContextRec& rec) const { |
78 return use_4f_context(rec, fGradFlags) | 78 return use_4f_context(rec, fGradFlags) |
79 ? sizeof(LinearGradient4fContext) | 79 ? sizeof(LinearGradient4fContext) |
80 : sizeof(LinearGradientContext); | 80 : sizeof(LinearGradientContext); |
81 } | 81 } |
82 | 82 |
83 SkShader::Context* SkLinearGradient::onCreateContext(const ContextRec& rec, void
* storage) const { | 83 SkShader::Context* SkLinearGradient::onCreateContext(const ContextRec& rec, void
* storage) const { |
84 return use_4f_context(rec, fGradFlags) | 84 return use_4f_context(rec, fGradFlags) |
85 ? static_cast<SkShader::Context*>(new (storage) LinearGradient4fContext(
*this, rec)) | 85 ? CheckedCreateContext<LinearGradient4fContext>(storage, *this, rec) |
86 : static_cast<SkShader::Context*>(new (storage) LinearGradientContext(*t
his, rec)); | 86 : CheckedCreateContext< LinearGradientContext>(storage, *this, rec); |
87 } | 87 } |
88 | 88 |
89 // This swizzles SkColor into the same component order as SkPMColor, but does no
t actually | 89 // This swizzles SkColor into the same component order as SkPMColor, but does no
t actually |
90 // "pre" multiply the color components. | 90 // "pre" multiply the color components. |
91 // | 91 // |
92 // This allows us to map directly to Sk4f, and eventually scale down to bytes to
output a | 92 // This allows us to map directly to Sk4f, and eventually scale down to bytes to
output a |
93 // SkPMColor from the floats, without having to swizzle each time. | 93 // SkPMColor from the floats, without having to swizzle each time. |
94 // | 94 // |
95 static uint32_t SkSwizzle_Color_to_PMColor(SkColor c) { | 95 static uint32_t SkSwizzle_Color_to_PMColor(SkColor c) { |
96 return SkPackARGB32NoCheck(SkColorGetA(c), SkColorGetR(c), SkColorGetG(c), S
kColorGetB(c)); | 96 return SkPackARGB32NoCheck(SkColorGetA(c), SkColorGetR(c), SkColorGetG(c), S
kColorGetB(c)); |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe
r); | 760 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe
r); |
761 } | 761 } |
762 } else { | 762 } else { |
763 if (fApplyAlphaAfterInterp) { | 763 if (fApplyAlphaAfterInterp) { |
764 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); | 764 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); |
765 } else { | 765 } else { |
766 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); | 766 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); |
767 } | 767 } |
768 } | 768 } |
769 } | 769 } |
OLD | NEW |