OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkColorFilterShader.h" | 8 #include "SkColorFilterShader.h" |
9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 const SkColorFilterShader& filterShader = static_cast<const SkColorFilterSha
der&>(fShader); | 91 const SkColorFilterShader& filterShader = static_cast<const SkColorFilterSha
der&>(fShader); |
92 | 92 |
93 fShaderContext->shadeSpan4f(x, y, result, count); | 93 fShaderContext->shadeSpan4f(x, y, result, count); |
94 filterShader.fFilter->filterSpan4f(result, count, result); | 94 filterShader.fFilter->filterSpan4f(result, count, result); |
95 } | 95 } |
96 | 96 |
97 #if SK_SUPPORT_GPU | 97 #if SK_SUPPORT_GPU |
98 ///////////////////////////////////////////////////////////////////// | 98 ///////////////////////////////////////////////////////////////////// |
99 | 99 |
100 const GrFragmentProcessor* SkColorFilterShader::asFragmentProcessor( | 100 const GrFragmentProcessor* SkColorFilterShader::asFragmentProcessor( |
101 GrContext* contex
t, | 101 GrContext* context, |
102 const SkMatrix& v
iewM, | 102 const SkMatrix& viewM, |
103 const SkMatrix* l
ocalMatrix, | 103 const SkMatrix* localMatrix
, |
104 SkFilterQuality f
q) const { | 104 SkFilterQuality fq, |
| 105 SkSourceGammaTreatment gamm
aTreatment) const { |
105 | 106 |
106 SkAutoTUnref<const GrFragmentProcessor> fp1(fShader->asFragmentProcessor(con
text, viewM, | 107 SkAutoTUnref<const GrFragmentProcessor> fp1(fShader->asFragmentProcessor(con
text, viewM, |
107 loc
alMatrix, fq)); | 108 loc
alMatrix, fq, |
| 109 gam
maTreatment)); |
108 if (!fp1.get()) { | 110 if (!fp1.get()) { |
109 return nullptr; | 111 return nullptr; |
110 } | 112 } |
111 | 113 |
112 SkAutoTUnref<const GrFragmentProcessor> fp2(fFilter->asFragmentProcessor(con
text)); | 114 SkAutoTUnref<const GrFragmentProcessor> fp2(fFilter->asFragmentProcessor(con
text)); |
113 if (!fp2.get()) { | 115 if (!fp2.get()) { |
114 return fp1.release(); | 116 return fp1.release(); |
115 } | 117 } |
116 | 118 |
117 const GrFragmentProcessor* fpSeries[] = { fp1.get(), fp2.get() }; | 119 const GrFragmentProcessor* fpSeries[] = { fp1.get(), fp2.get() }; |
(...skipping 19 matching lines...) Expand all Loading... |
137 | 139 |
138 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 140 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
139 | 141 |
140 sk_sp<SkShader> SkShader::makeWithColorFilter(sk_sp<SkColorFilter> filter) const
{ | 142 sk_sp<SkShader> SkShader::makeWithColorFilter(sk_sp<SkColorFilter> filter) const
{ |
141 SkShader* base = const_cast<SkShader*>(this); | 143 SkShader* base = const_cast<SkShader*>(this); |
142 if (!filter) { | 144 if (!filter) { |
143 return sk_ref_sp(base); | 145 return sk_ref_sp(base); |
144 } | 146 } |
145 return sk_make_sp<SkColorFilterShader>(sk_ref_sp(base), filter); | 147 return sk_make_sp<SkColorFilterShader>(sk_ref_sp(base), filter); |
146 } | 148 } |
OLD | NEW |