OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkError.h" | 8 #include "SkError.h" |
9 #include "SkErrorInternals.h" | 9 #include "SkErrorInternals.h" |
10 #include "SkLightingShader.h" | 10 #include "SkLightingShader.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 SkMatrix fInvCTM; | 175 SkMatrix fInvCTM; |
176 }; | 176 }; |
177 | 177 |
178 sk_sp<GrFragmentProcessor> NormalMapSourceImpl::asFragmentProcessor( | 178 sk_sp<GrFragmentProcessor> NormalMapSourceImpl::asFragmentProcessor( |
179 GrContext *context, | 179 GrContext *context, |
180 const SkMatrix &viewM, | 180 const SkMatrix &viewM, |
181 const SkMatrix *localMatrix
, | 181 const SkMatrix *localMatrix
, |
182 SkFilterQuality filterQuali
ty, | 182 SkFilterQuality filterQuali
ty, |
183 SkSourceGammaTreatment gamm
aTreatment) const { | 183 SkSourceGammaTreatment gamm
aTreatment) const { |
184 | |
185 sk_sp<GrFragmentProcessor> mapFP = fMapShader->asFragmentProcessor(context,
viewM, | 184 sk_sp<GrFragmentProcessor> mapFP = fMapShader->asFragmentProcessor(context,
viewM, |
186 localMatrix, filterQuality, gammaTreatment); | 185 localMatrix, filterQuality, gammaTreatment); |
| 186 if (!mapFP) { |
| 187 return nullptr; |
| 188 } |
187 | 189 |
188 return sk_make_sp<NormalMapFP>(std::move(mapFP), fInvCTM); | 190 return sk_make_sp<NormalMapFP>(std::move(mapFP), fInvCTM); |
189 } | 191 } |
190 | 192 |
191 #endif // SK_SUPPORT_GPU | 193 #endif // SK_SUPPORT_GPU |
192 | 194 |
193 //////////////////////////////////////////////////////////////////////////// | 195 //////////////////////////////////////////////////////////////////////////// |
194 | 196 |
195 NormalMapSourceImpl::Provider::Provider(const NormalMapSourceImpl& source, | 197 NormalMapSourceImpl::Provider::Provider(const NormalMapSourceImpl& source, |
196 SkShader::Context* mapContext) | 198 SkShader::Context* mapContext) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 return sk_make_sp<NormalMapSourceImpl>(std::move(map), invCTM); | 316 return sk_make_sp<NormalMapSourceImpl>(std::move(map), invCTM); |
315 } | 317 } |
316 | 318 |
317 //////////////////////////////////////////////////////////////////////////// | 319 //////////////////////////////////////////////////////////////////////////// |
318 | 320 |
319 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkNormalSource) | 321 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkNormalSource) |
320 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(NormalMapSourceImpl) | 322 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(NormalMapSourceImpl) |
321 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 323 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
322 | 324 |
323 //////////////////////////////////////////////////////////////////////////// | 325 //////////////////////////////////////////////////////////////////////////// |
OLD | NEW |