Move SkColorSpace ICC parsing/writing code to its own file
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2101823003 Review-Url: https://codereview.chromium.org/2101823003
This commit is contained in:
parent
0a8f40cbe6
commit
085cad4abc
@ -76,6 +76,7 @@
|
||||
'<(skia_src_path)/core/SkColorShader.cpp',
|
||||
'<(skia_src_path)/core/SkColorShader.h',
|
||||
'<(skia_src_path)/core/SkColorSpace.cpp',
|
||||
'<(skia_src_path)/core/SkColorSpace_ICC.cpp',
|
||||
'<(skia_src_path)/core/SkColorSpaceXform.cpp',
|
||||
'<(skia_src_path)/core/SkColorTable.cpp',
|
||||
'<(skia_src_path)/core/SkComposeShader.cpp',
|
||||
|
File diff suppressed because it is too large
Load Diff
25
src/core/SkColorSpacePriv.h
Normal file
25
src/core/SkColorSpacePriv.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2016 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#define SkColorSpacePrintf(...)
|
||||
|
||||
inline bool color_space_almost_equal(float a, float b) {
|
||||
return SkTAbs(a - b) < 0.01f;
|
||||
}
|
||||
|
||||
inline void set_gamma_value(SkGammaCurve* gamma, float value) {
|
||||
if (color_space_almost_equal(2.2f, value)) {
|
||||
gamma->fNamed = SkColorSpace::k2Dot2Curve_GammaNamed;
|
||||
} else if (color_space_almost_equal(1.0f, value)) {
|
||||
gamma->fNamed = SkColorSpace::kLinear_GammaNamed;
|
||||
} else if (color_space_almost_equal(0.0f, value)) {
|
||||
SkColorSpacePrintf("Treating invalid zero gamma as linear.");
|
||||
gamma->fNamed = SkColorSpace::kLinear_GammaNamed;
|
||||
} else {
|
||||
gamma->fValue = value;
|
||||
}
|
||||
}
|
1054
src/core/SkColorSpace_ICC.cpp
Normal file
1054
src/core/SkColorSpace_ICC.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user