OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBitmapProcShader.h" | 8 #include "SkBitmapProcShader.h" |
9 #include "SkBitmapProcState.h" | 9 #include "SkBitmapProcState.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 | 484 |
485 return new (storage) LightingShaderContext(*this, rec, diffuseContext, norma lProvider, | 485 return new (storage) LightingShaderContext(*this, rec, diffuseContext, norma lProvider, |
486 heapAllocated); | 486 heapAllocated); |
487 } | 487 } |
488 | 488 |
489 /////////////////////////////////////////////////////////////////////////////// | 489 /////////////////////////////////////////////////////////////////////////////// |
490 | 490 |
491 sk_sp<SkShader> SkLightingShader::Make(sk_sp<SkShader> diffuseShader, | 491 sk_sp<SkShader> SkLightingShader::Make(sk_sp<SkShader> diffuseShader, |
492 sk_sp<SkNormalSource> normalSource, | 492 sk_sp<SkNormalSource> normalSource, |
493 sk_sp<SkLights> lights) { | 493 sk_sp<SkLights> lights) { |
494 if (!diffuseShader || !normalSource) { | 494 if (!diffuseShader) { |
495 // TODO: Use paint's color in absence of a diffuseShader | 495 // TODO: Use paint's color in absence of a diffuseShader |
496 // TODO: Use a default implementation of normalSource instead | |
497 return nullptr; | 496 return nullptr; |
498 } | 497 } |
robertphillips
2016/07/11 19:13:21
Hmmm, don't we just want the flat guy?
dvonbeck
2016/07/13 14:23:37
This was before i wrote the flat guy. Now that I u
robertphillips
2016/07/13 14:40:22
This doesn't look like the flat guy.
dvonbeck
2016/07/13 16:09:16
Patch 5 no longer has modifications to lighting sh
| |
499 | 498 if (!normalSource) { |
499 normalSource = SkNormalSource::MakeBevel(SkNormalSource::BevelType::kLin ear, 0, 0); | |
500 } | |
500 return sk_make_sp<SkLightingShaderImpl>(std::move(diffuseShader), std::move( normalSource), | 501 return sk_make_sp<SkLightingShaderImpl>(std::move(diffuseShader), std::move( normalSource), |
501 std::move(lights)); | 502 std::move(lights)); |
502 } | 503 } |
503 | 504 |
504 /////////////////////////////////////////////////////////////////////////////// | 505 /////////////////////////////////////////////////////////////////////////////// |
505 | 506 |
506 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) | 507 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) |
507 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) | 508 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) |
508 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 509 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
509 | 510 |
510 /////////////////////////////////////////////////////////////////////////////// | 511 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |