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

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: Need to know when we're in L32 compatibility mode !!!? 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
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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState.cpp ('k') | src/core/SkMipMap.h » ('j') | src/core/SkMipMap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698