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

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

Issue 2270103002: New helper for creating a color space from another, with linear gamma (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 3 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 | « include/core/SkColorSpace.h ('k') | no next file » | 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 2016 Google Inc. 2 * Copyright 2016 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 "SkColorSpace.h" 8 #include "SkColorSpace.h"
9 #include "SkColorSpace_Base.h" 9 #include "SkColorSpace_Base.h"
10 #include "SkColorSpacePriv.h" 10 #include "SkColorSpacePriv.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 kAdobeRGB_Named)); 148 kAdobeRGB_Named));
149 }); 149 });
150 return adobeRGB; 150 return adobeRGB;
151 } 151 }
152 default: 152 default:
153 break; 153 break;
154 } 154 }
155 return nullptr; 155 return nullptr;
156 } 156 }
157 157
158 sk_sp<SkColorSpace> SkColorSpace::makeLinearGamma() {
159 return SkColorSpace_Base::NewRGB(kLinear_GammaNamed, fToXYZD50);
msarett 2016/08/23 18:01:12 Eventually we'll want to add once-ptrs for the com
160 }
161
158 //////////////////////////////////////////////////////////////////////////////// /////////////////// 162 //////////////////////////////////////////////////////////////////////////////// ///////////////////
159 163
160 enum Version { 164 enum Version {
161 k0_Version, // Initial version, header + flags for matrix and profile 165 k0_Version, // Initial version, header + flags for matrix and profile
162 }; 166 };
163 167
164 struct ColorSpaceHeader { 168 struct ColorSpaceHeader {
165 /** 169 /**
166 * If kMatrix_Flag is set, we will write 12 floats after the header. 170 * If kMatrix_Flag is set, we will write 12 floats after the header.
167 * Should not be set at the same time as the kICC_Flag or kFloatGamma_Flag. 171 * Should not be set at the same time as the kICC_Flag or kFloatGamma_Flag.
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 gammas->fBlueType == SkGammas::Type::kTable_Type; 449 gammas->fBlueType == SkGammas::Type::kTable_Type;
446 } 450 }
447 451
448 bool SkColorSpace::gammasAreParams() const { 452 bool SkColorSpace::gammasAreParams() const {
449 const SkGammas* gammas = as_CSB(this)->gammas(); 453 const SkGammas* gammas = as_CSB(this)->gammas();
450 SkASSERT(gammas); 454 SkASSERT(gammas);
451 return gammas->fRedType == SkGammas::Type::kParam_Type && 455 return gammas->fRedType == SkGammas::Type::kParam_Type &&
452 gammas->fGreenType == SkGammas::Type::kParam_Type && 456 gammas->fGreenType == SkGammas::Type::kParam_Type &&
453 gammas->fBlueType == SkGammas::Type::kParam_Type; 457 gammas->fBlueType == SkGammas::Type::kParam_Type;
454 } 458 }
OLDNEW
« no previous file with comments | « include/core/SkColorSpace.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698