Chromium Code Reviews| 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 "SkBitmapProcState.h" | 8 #include "SkBitmapProcState.h" |
| 9 #include "SkColor.h" | 9 #include "SkColor.h" |
| 10 #include "SkEmptyShader.h" | 10 #include "SkEmptyShader.h" |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 666 // computeTotalInverse was called in SkShader::createContext so we know it w ill succeed | 666 // computeTotalInverse was called in SkShader::createContext so we know it w ill succeed |
| 667 SkAssertResult(this->computeTotalInverse(rec, &diffTotalInv)); | 667 SkAssertResult(this->computeTotalInverse(rec, &diffTotalInv)); |
| 668 | 668 |
| 669 SkMatrix normTotalInv; | 669 SkMatrix normTotalInv; |
| 670 if (!this->computeNormTotalInverse(rec, &normTotalInv)) { | 670 if (!this->computeNormTotalInverse(rec, &normTotalInv)) { |
| 671 return nullptr; | 671 return nullptr; |
| 672 } | 672 } |
| 673 | 673 |
| 674 void* diffuseStateStorage = (char*)storage + sizeof(LightingShaderContext); | 674 void* diffuseStateStorage = (char*)storage + sizeof(LightingShaderContext); |
| 675 SkBitmapProcState* diffuseState = new (diffuseStateStorage) SkBitmapProcStat e(fDiffuseMap, | 675 SkBitmapProcState* diffuseState = new (diffuseStateStorage) SkBitmapProcStat e(fDiffuseMap, |
| 676 SkShader::kClamp_TileMode, SkShade r::kClamp_TileMode); | 676 SkShader::kClamp_TileMode, SkShade r::kClamp_TileMode, |
|
msarett
2016/06/03 16:54:17
nit: style?
| |
| 677 SkMipMap:: DeduceMode(rec)); | |
| 677 SkASSERT(diffuseState); | 678 SkASSERT(diffuseState); |
| 678 if (!diffuseState->setup(diffTotalInv, *rec.fPaint)) { | 679 if (!diffuseState->setup(diffTotalInv, *rec.fPaint)) { |
| 679 diffuseState->~SkBitmapProcState(); | 680 diffuseState->~SkBitmapProcState(); |
| 680 return nullptr; | 681 return nullptr; |
| 681 } | 682 } |
| 682 | 683 |
| 683 void* normalStateStorage = (char*)storage + sizeof(LightingShaderContext) + sizeof(SkBitmapProcState); | 684 void* normalStateStorage = (char*)storage + sizeof(LightingShaderContext) + sizeof(SkBitmapProcState); |
| 684 SkBitmapProcState* normalState = new (normalStateStorage) SkBitmapProcState( fNormalMap, | 685 SkBitmapProcState* normalState = new (normalStateStorage) SkBitmapProcState( fNormalMap, |
| 685 SkShader::kClamp_TileMode, SkShader: :kClamp_TileMode); | 686 SkShader::kClamp_TileMode, SkShader: :kClamp_TileMode, |
| 687 SkMipMap ::DeduceMode(rec)); | |
| 686 SkASSERT(normalState); | 688 SkASSERT(normalState); |
| 687 if (!normalState->setup(normTotalInv, *rec.fPaint)) { | 689 if (!normalState->setup(normTotalInv, *rec.fPaint)) { |
| 688 diffuseState->~SkBitmapProcState(); | 690 diffuseState->~SkBitmapProcState(); |
| 689 normalState->~SkBitmapProcState(); | 691 normalState->~SkBitmapProcState(); |
| 690 return nullptr; | 692 return nullptr; |
| 691 } | 693 } |
| 692 | 694 |
| 693 return new (storage) LightingShaderContext(*this, rec, diffuseState, normalS tate); | 695 return new (storage) LightingShaderContext(*this, rec, diffuseState, normalS tate); |
| 694 } | 696 } |
| 695 | 697 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 722 invNormRotation, diffLocalM, normLoc alM); | 724 invNormRotation, diffLocalM, normLoc alM); |
| 723 } | 725 } |
| 724 | 726 |
| 725 /////////////////////////////////////////////////////////////////////////////// | 727 /////////////////////////////////////////////////////////////////////////////// |
| 726 | 728 |
| 727 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) | 729 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) |
| 728 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) | 730 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) |
| 729 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 731 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| 730 | 732 |
| 731 /////////////////////////////////////////////////////////////////////////////// | 733 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |