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

Side by Side Diff: src/core/SkColorSpacePriv.h

Issue 2171623002: Revert of Refactor parsing and storage of SkGammas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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.cpp ('k') | src/core/SkColorSpaceXform.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 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 #define SkColorSpacePrintf(...) 8 #define SkColorSpacePrintf(...)
9 9
10 inline bool color_space_almost_equal(float a, float b) { 10 inline bool color_space_almost_equal(float a, float b) {
11 return SkTAbs(a - b) < 0.01f; 11 return SkTAbs(a - b) < 0.01f;
12 } 12 }
13
14 inline void set_gamma_value(SkGammaCurve* gamma, float value) {
15 if (color_space_almost_equal(2.2f, value)) {
16 gamma->fNamed = SkColorSpace::k2Dot2Curve_GammaNamed;
17 } else if (color_space_almost_equal(1.0f, value)) {
18 gamma->fNamed = SkColorSpace::kLinear_GammaNamed;
19 } else if (color_space_almost_equal(0.0f, value)) {
20 SkColorSpacePrintf("Treating invalid zero gamma as linear.");
21 gamma->fNamed = SkColorSpace::kLinear_GammaNamed;
22 } else {
23 gamma->fValue = value;
24 }
25 }
OLDNEW
« no previous file with comments | « src/core/SkColorSpace.cpp ('k') | src/core/SkColorSpaceXform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698