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

Side by Side Diff: tests/ColorSpaceXformTest.cpp

Issue 2326043002: Delete some LUTs from SkColorSpaceXform (Closed)
Patch Set: Type f for float 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 | « src/core/SkColorSpaceXform.cpp ('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 "Resources.h" 8 #include "Resources.h"
9 #include "SkCodec.h" 9 #include "SkCodec.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 DEF_TEST(ColorSpaceXform_ExponentialGamma, r) { 108 DEF_TEST(ColorSpaceXform_ExponentialGamma, r) {
109 // Exponential gamma curves 109 // Exponential gamma curves
110 sk_sp<SkGammas> gammas = sk_sp<SkGammas>(new SkGammas()); 110 sk_sp<SkGammas> gammas = sk_sp<SkGammas>(new SkGammas());
111 gammas->fRedType = gammas->fGreenType = gammas->fBlueType = SkGammas::Type:: kValue_Type; 111 gammas->fRedType = gammas->fGreenType = gammas->fBlueType = SkGammas::Type:: kValue_Type;
112 gammas->fRedData.fValue = gammas->fGreenData.fValue = gammas->fBlueData.fVal ue = 1.4f; 112 gammas->fRedData.fValue = gammas->fGreenData.fValue = gammas->fBlueData.fVal ue = 1.4f;
113 test_identity_xform(r, gammas); 113 test_identity_xform(r, gammas);
114 } 114 }
115 115
116 DEF_TEST(ColorSpaceXform_NamedGamma, r) {
117 sk_sp<SkGammas> gammas = sk_sp<SkGammas>(new SkGammas());
118 gammas->fRedType = gammas->fGreenType = gammas->fBlueType = SkGammas::Type:: kNamed_Type;
119 gammas->fRedData.fNamed = kSRGB_SkGammaNamed;
120 gammas->fGreenData.fNamed = k2Dot2Curve_SkGammaNamed;
121 gammas->fBlueData.fNamed = kLinear_SkGammaNamed;
122 test_identity_xform(r, gammas);
123 }
124
116 DEF_TEST(ColorSpaceXform_NonMatchingGamma, r) { 125 DEF_TEST(ColorSpaceXform_NonMatchingGamma, r) {
117 constexpr size_t tableSize = 10; 126 constexpr size_t tableSize = 10;
118 void* memory = sk_malloc_throw(sizeof(SkGammas) + sizeof(float) * tableSize + 127 void* memory = sk_malloc_throw(sizeof(SkGammas) + sizeof(float) * tableSize +
119 sizeof(SkGammas::Params)); 128 sizeof(SkGammas::Params));
120 sk_sp<SkGammas> gammas = sk_sp<SkGammas>(new (memory) SkGammas()); 129 sk_sp<SkGammas> gammas = sk_sp<SkGammas>(new (memory) SkGammas());
121 130
122 float* table = SkTAddOffset<float>(memory, sizeof(SkGammas)); 131 float* table = SkTAddOffset<float>(memory, sizeof(SkGammas));
123 table[0] = 0.00f; 132 table[0] = 0.00f;
124 table[1] = 0.15f; 133 table[1] = 0.15f;
125 table[2] = 0.20f; 134 table[2] = 0.20f;
(...skipping 20 matching lines...) Expand all
146 155
147 gammas->fGreenType = SkGammas::Type::kTable_Type; 156 gammas->fGreenType = SkGammas::Type::kTable_Type;
148 gammas->fGreenData.fTable.fSize = tableSize; 157 gammas->fGreenData.fTable.fSize = tableSize;
149 gammas->fGreenData.fTable.fOffset = 0; 158 gammas->fGreenData.fTable.fOffset = 0;
150 159
151 gammas->fBlueType = SkGammas::Type::kParam_Type; 160 gammas->fBlueType = SkGammas::Type::kParam_Type;
152 gammas->fBlueData.fParamOffset = sizeof(float) * tableSize; 161 gammas->fBlueData.fParamOffset = sizeof(float) * tableSize;
153 162
154 test_identity_xform(r, gammas); 163 test_identity_xform(r, gammas);
155 } 164 }
OLDNEW
« no previous file with comments | « src/core/SkColorSpaceXform.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698