Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: src/core/SkLightingShader.cpp

Issue 2029373004: respect srgb gamma when building mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkBitmapProcState.cpp ('k') | src/core/SkMipMap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // computeTotalInverse was called in SkShader::createContext so we know it w ill succeed 670 // computeTotalInverse was called in SkShader::createContext so we know it w ill succeed
671 SkAssertResult(this->computeTotalInverse(rec, &diffTotalInv)); 671 SkAssertResult(this->computeTotalInverse(rec, &diffTotalInv));
672 672
673 SkMatrix normTotalInv; 673 SkMatrix normTotalInv;
674 if (!this->computeNormTotalInverse(rec, &normTotalInv)) { 674 if (!this->computeNormTotalInverse(rec, &normTotalInv)) {
675 return nullptr; 675 return nullptr;
676 } 676 }
677 677
678 void* diffuseStateStorage = (char*)storage + sizeof(LightingShaderContext); 678 void* diffuseStateStorage = (char*)storage + sizeof(LightingShaderContext);
679 SkBitmapProcState* diffuseState = new (diffuseStateStorage) SkBitmapProcStat e(fDiffuseMap, 679 SkBitmapProcState* diffuseState = new (diffuseStateStorage) SkBitmapProcStat e(fDiffuseMap,
680 SkShader::kClamp_TileMode, SkShade r::kClamp_TileMode); 680 SkShader::kClamp_TileMode, SkShade r::kClamp_TileMode,
681 SkMipMap::De duceTreatment(rec));
681 SkASSERT(diffuseState); 682 SkASSERT(diffuseState);
682 if (!diffuseState->setup(diffTotalInv, *rec.fPaint)) { 683 if (!diffuseState->setup(diffTotalInv, *rec.fPaint)) {
683 diffuseState->~SkBitmapProcState(); 684 diffuseState->~SkBitmapProcState();
684 return nullptr; 685 return nullptr;
685 } 686 }
686 687
687 void* normalStateStorage = (char*)storage + sizeof(LightingShaderContext) + sizeof(SkBitmapProcState); 688 void* normalStateStorage = (char*)storage + sizeof(LightingShaderContext) + sizeof(SkBitmapProcState);
688 SkBitmapProcState* normalState = new (normalStateStorage) SkBitmapProcState( fNormalMap, 689 SkBitmapProcState* normalState = new (normalStateStorage) SkBitmapProcState( fNormalMap,
689 SkShader::kClamp_TileMode, SkShader: :kClamp_TileMode); 690 SkShader::kClamp_TileMode, SkShader: :kClamp_TileMode,
691 SkMipMap::De duceTreatment(rec));
690 SkASSERT(normalState); 692 SkASSERT(normalState);
691 if (!normalState->setup(normTotalInv, *rec.fPaint)) { 693 if (!normalState->setup(normTotalInv, *rec.fPaint)) {
692 diffuseState->~SkBitmapProcState(); 694 diffuseState->~SkBitmapProcState();
693 normalState->~SkBitmapProcState(); 695 normalState->~SkBitmapProcState();
694 return nullptr; 696 return nullptr;
695 } 697 }
696 698
697 return new (storage) LightingShaderContext(*this, rec, diffuseState, normalS tate); 699 return new (storage) LightingShaderContext(*this, rec, diffuseState, normalS tate);
698 } 700 }
699 701
(...skipping 26 matching lines...) Expand all
726 invNormRotation, diffLocalM, normLoc alM); 728 invNormRotation, diffLocalM, normLoc alM);
727 } 729 }
728 730
729 /////////////////////////////////////////////////////////////////////////////// 731 ///////////////////////////////////////////////////////////////////////////////
730 732
731 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) 733 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader)
732 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) 734 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl)
733 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 735 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
734 736
735 /////////////////////////////////////////////////////////////////////////////// 737 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState.cpp ('k') | src/core/SkMipMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698