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

Side by Side Diff: tests/ColorSpaceTest.cpp

Issue 2035813003: add MakeS32 helper to SkImageInfo, fix named-gamma constructor bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox Created 4 years, 6 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/SkImageInfo.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 "SkColorSpace.h" 10 #include "SkColorSpace.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 return; 131 return;
132 } 132 }
133 sk_sp<SkColorSpace> monitorSpace = SkColorSpace::NewICC(monitorData->data(), 133 sk_sp<SkColorSpace> monitorSpace = SkColorSpace::NewICC(monitorData->data(),
134 monitorData->size()) ; 134 monitorData->size()) ;
135 sk_sp<SkData> newMonitorData = as_CSB(monitorSpace)->writeToICC(); 135 sk_sp<SkData> newMonitorData = as_CSB(monitorSpace)->writeToICC();
136 sk_sp<SkColorSpace> newMonitorSpace = SkColorSpace::NewICC(newMonitorData->d ata(), 136 sk_sp<SkColorSpace> newMonitorSpace = SkColorSpace::NewICC(newMonitorData->d ata(),
137 newMonitorData->s ize()); 137 newMonitorData->s ize());
138 REPORTER_ASSERT(r, monitorSpace->xyz() == newMonitorSpace->xyz()); 138 REPORTER_ASSERT(r, monitorSpace->xyz() == newMonitorSpace->xyz());
139 REPORTER_ASSERT(r, as_CSB(monitorSpace)->gammas() == as_CSB(newMonitorSpace) ->gammas()); 139 REPORTER_ASSERT(r, as_CSB(monitorSpace)->gammas() == as_CSB(newMonitorSpace) ->gammas());
140 } 140 }
141
142 DEF_TEST(ColorSpace_Named, r) {
143 const struct {
144 SkColorSpace::Named fNamed;
145 bool fExpectedToSucceed;
146 } recs[] {
147 { SkColorSpace::kUnknown_Named, false },
148 { SkColorSpace::kSRGB_Named, true },
149 { SkColorSpace::kAdobeRGB_Named, true },
150 };
151
152 for (auto rec : recs) {
153 auto cs = SkColorSpace::NewNamed(rec.fNamed);
154 REPORTER_ASSERT(r, !cs == !rec.fExpectedToSucceed);
155 if (cs) {
156 REPORTER_ASSERT(r, SkColorSpace::k2Dot2Curve_GammaNamed == cs->gamma Named());
157 }
158 }
159
160 SkImageInfo info = SkImageInfo::MakeS32(10, 10, kPremul_SkAlphaType);
161 REPORTER_ASSERT(r, kSRGB_SkColorProfileType == info.profileType());
162 REPORTER_ASSERT(r, SkColorSpace::k2Dot2Curve_GammaNamed == info.colorSpace() ->gammaNamed());
163 }
OLDNEW
« no previous file with comments | « src/core/SkImageInfo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698