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

Side by Side Diff: src/effects/gradients/SkGradientShader.cpp

Issue 2389983002: Refactored SkColorSpace and added in a Lab PCS GM (Closed)
Patch Set: migrated call from SkColorSpace_Base::makeLinearGamma() to SkColorSpace_XYZ::makeLinearGamma() Created 4 years, 2 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/SkColorSpace_XYZ.cpp ('k') | src/gpu/GrColorSpaceXform.cpp » ('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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "Sk4fLinearGradient.h" 8 #include "Sk4fLinearGradient.h"
9 #include "SkColorSpace_Base.h" 9 #include "SkColorSpace_XYZ.h"
10 #include "SkGradientShaderPriv.h" 10 #include "SkGradientShaderPriv.h"
11 #include "SkHalf.h" 11 #include "SkHalf.h"
12 #include "SkLinearGradient.h" 12 #include "SkLinearGradient.h"
13 #include "SkRadialGradient.h" 13 #include "SkRadialGradient.h"
14 #include "SkTwoPointConicalGradient.h" 14 #include "SkTwoPointConicalGradient.h"
15 #include "SkSweepGradient.h" 15 #include "SkSweepGradient.h"
16 16
17 enum GradientSerializationFlags { 17 enum GradientSerializationFlags {
18 // Bits 29:31 used for various boolean flags 18 // Bits 29:31 used for various boolean flags
19 kHasPosition_GSF = 0x80000000, 19 kHasPosition_GSF = 0x80000000,
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 if (fColorCount == 1 || (fColorCount >= 2 && random->nextBool())) { 1740 if (fColorCount == 1 || (fColorCount >= 2 && random->nextBool())) {
1741 fStops = nullptr; 1741 fStops = nullptr;
1742 } else { 1742 } else {
1743 fStops = fStopStorage; 1743 fStops = fStopStorage;
1744 } 1744 }
1745 1745
1746 // if using SkColor4f, attach a random (possibly null) color space (with lin ear gamma) 1746 // if using SkColor4f, attach a random (possibly null) color space (with lin ear gamma)
1747 if (fUseColors4f) { 1747 if (fUseColors4f) {
1748 fColorSpace = GrTest::TestColorSpace(random); 1748 fColorSpace = GrTest::TestColorSpace(random);
1749 if (fColorSpace) { 1749 if (fColorSpace) {
1750 fColorSpace = as_CSB(fColorSpace)->makeLinearGamma(); 1750 SkASSERT(SkColorSpace_Base::Type::kXYZ == as_CSB(fColorSpace)->type( ));
1751 fColorSpace = static_cast<SkColorSpace_XYZ*>(fColorSpace.get())->mak eLinearGamma();
1751 } 1752 }
1752 } 1753 }
1753 1754
1754 SkScalar stop = 0.f; 1755 SkScalar stop = 0.f;
1755 for (int i = 0; i < fColorCount; ++i) { 1756 for (int i = 0; i < fColorCount; ++i) {
1756 if (fUseColors4f) { 1757 if (fUseColors4f) {
1757 fColors4f[i].fR = random->nextUScalar1(); 1758 fColors4f[i].fR = random->nextUScalar1();
1758 fColors4f[i].fG = random->nextUScalar1(); 1759 fColors4f[i].fG = random->nextUScalar1();
1759 fColors4f[i].fB = random->nextUScalar1(); 1760 fColors4f[i].fB = random->nextUScalar1();
1760 fColors4f[i].fA = random->nextUScalar1(); 1761 fColors4f[i].fA = random->nextUScalar1();
1761 } else { 1762 } else {
1762 fColors[i] = random->nextU(); 1763 fColors[i] = random->nextU();
1763 } 1764 }
1764 if (fStops) { 1765 if (fStops) {
1765 fStops[i] = stop; 1766 fStops[i] = stop;
1766 stop = i < fColorCount - 1 ? stop + random->nextUScalar1() * (1.f - stop) : 1.f; 1767 stop = i < fColorCount - 1 ? stop + random->nextUScalar1() * (1.f - stop) : 1.f;
1767 } 1768 }
1768 } 1769 }
1769 fTileMode = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader:: kTileModeCount)); 1770 fTileMode = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader:: kTileModeCount));
1770 } 1771 }
1771 1772
1772 #endif 1773 #endif
OLDNEW
« no previous file with comments | « src/core/SkColorSpace_XYZ.cpp ('k') | src/gpu/GrColorSpaceXform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698