| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 "SkBitmapProcState.h" | 9 #include "SkBitmapProcState.h" |
| 10 #include "SkColor.h" | 10 #include "SkColor.h" |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 | 664 |
| 665 SkMatrix normTotalInv; | 665 SkMatrix normTotalInv; |
| 666 if (!this->computeNormTotalInverse(rec, &normTotalInv)) { | 666 if (!this->computeNormTotalInverse(rec, &normTotalInv)) { |
| 667 return nullptr; | 667 return nullptr; |
| 668 } | 668 } |
| 669 | 669 |
| 670 void* diffuseStateStorage = (char*)storage + sizeof(LightingShaderContext); | 670 void* diffuseStateStorage = (char*)storage + sizeof(LightingShaderContext); |
| 671 SkBitmapProcState* diffuseState = new (diffuseStateStorage) SkBitmapProcStat
e(fDiffuseMap, | 671 SkBitmapProcState* diffuseState = new (diffuseStateStorage) SkBitmapProcStat
e(fDiffuseMap, |
| 672 SkShader::kClamp_TileMode, SkShade
r::kClamp_TileMode); | 672 SkShader::kClamp_TileMode, SkShade
r::kClamp_TileMode); |
| 673 SkASSERT(diffuseState); | 673 SkASSERT(diffuseState); |
| 674 if (!diffuseState->chooseProcs(diffTotalInv, *rec.fPaint)) { | 674 if (!diffuseState->setup(diffTotalInv, *rec.fPaint)) { |
| 675 diffuseState->~SkBitmapProcState(); | 675 diffuseState->~SkBitmapProcState(); |
| 676 return nullptr; | 676 return nullptr; |
| 677 } | 677 } |
| 678 | 678 |
| 679 void* normalStateStorage = (char*)storage + sizeof(LightingShaderContext) +
sizeof(SkBitmapProcState); | 679 void* normalStateStorage = (char*)storage + sizeof(LightingShaderContext) +
sizeof(SkBitmapProcState); |
| 680 SkBitmapProcState* normalState = new (normalStateStorage) SkBitmapProcState(
fNormalMap, | 680 SkBitmapProcState* normalState = new (normalStateStorage) SkBitmapProcState(
fNormalMap, |
| 681 SkShader::kClamp_TileMode, SkShader:
:kClamp_TileMode); | 681 SkShader::kClamp_TileMode, SkShader:
:kClamp_TileMode); |
| 682 SkASSERT(normalState); | 682 SkASSERT(normalState); |
| 683 if (!normalState->chooseProcs(normTotalInv, *rec.fPaint)) { | 683 if (!normalState->setup(normTotalInv, *rec.fPaint)) { |
| 684 diffuseState->~SkBitmapProcState(); | 684 diffuseState->~SkBitmapProcState(); |
| 685 normalState->~SkBitmapProcState(); | 685 normalState->~SkBitmapProcState(); |
| 686 return nullptr; | 686 return nullptr; |
| 687 } | 687 } |
| 688 | 688 |
| 689 return new (storage) LightingShaderContext(*this, rec, diffuseState, normalS
tate); | 689 return new (storage) LightingShaderContext(*this, rec, diffuseState, normalS
tate); |
| 690 } | 690 } |
| 691 | 691 |
| 692 /////////////////////////////////////////////////////////////////////////////// | 692 /////////////////////////////////////////////////////////////////////////////// |
| 693 | 693 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 718 normLocalM); | 718 normLocalM); |
| 719 } | 719 } |
| 720 | 720 |
| 721 /////////////////////////////////////////////////////////////////////////////// | 721 /////////////////////////////////////////////////////////////////////////////// |
| 722 | 722 |
| 723 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) | 723 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) |
| 724 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) | 724 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) |
| 725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| 726 | 726 |
| 727 /////////////////////////////////////////////////////////////////////////////// | 727 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |