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

Side by Side Diff: tests/ColorSpaceXformTest.cpp

Issue 2390263002: Add SkColorSpaceXform to the public API (Closed)
Patch Set: Remove unnecessary changes Created 4 years, 2 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
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 "SkCodecPriv.h" 10 #include "SkCodecPriv.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkColorSpace.h" 12 #include "SkColorSpace.h"
13 #include "SkColorSpace_Base.h" 13 #include "SkColorSpace_Base.h"
14 #include "SkColorSpaceXform.h" 14 #include "SkColorSpaceXform_Base.h"
15 #include "Test.h" 15 #include "Test.h"
16 16
17 class ColorSpaceXformTest { 17 class ColorSpaceXformTest {
18 public: 18 public:
19 static std::unique_ptr<SkColorSpaceXform> CreateIdentityXform(const sk_sp<Sk Gammas>& gammas) { 19 static std::unique_ptr<SkColorSpaceXform> CreateIdentityXform(const sk_sp<Sk Gammas>& gammas) {
20 // Logically we can pass any matrix here. For simplicty, pass I(), i.e. D50 XYZ gamut. 20 // Logically we can pass any matrix here. For simplicty, pass I(), i.e. D50 XYZ gamut.
21 sk_sp<SkColorSpace> space(new SkColorSpace_Base( 21 sk_sp<SkColorSpace> space(new SkColorSpace_Base(
22 nullptr, kNonStandard_SkGammaNamed, gammas, SkMatrix::I(), nullp tr)); 22 nullptr, kNonStandard_SkGammaNamed, gammas, SkMatrix::I(), nullp tr));
23 23
24 // Use special testing entry point, so we don't skip the xform, even tho ugh src == dst. 24 // Use special testing entry point, so we don't skip the xform, even tho ugh src == dst.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // this ICC profile has a CLUT in it 178 // this ICC profile has a CLUT in it
179 const SkString filename(GetResourcePath("icc_profiles/upperRight.icc")); 179 const SkString filename(GetResourcePath("icc_profiles/upperRight.icc"));
180 sk_sp<SkData> iccData = SkData::MakeFromFileName(filename.c_str()); 180 sk_sp<SkData> iccData = SkData::MakeFromFileName(filename.c_str());
181 REPORTER_ASSERT_MESSAGE(r, iccData, "upperRight.icc profile required for tes t"); 181 REPORTER_ASSERT_MESSAGE(r, iccData, "upperRight.icc profile required for tes t");
182 sk_sp<SkColorSpace> srcSpace = SkColorSpace::NewICC(iccData->bytes(), iccDat a->size()); 182 sk_sp<SkColorSpace> srcSpace = SkColorSpace::NewICC(iccData->bytes(), iccDat a->size());
183 sk_sp<SkColorSpace> dstSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Na med); 183 sk_sp<SkColorSpace> dstSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Na med);
184 auto xform = SkColorSpaceXform::New(srcSpace.get(), dstSpace.get()); 184 auto xform = SkColorSpaceXform::New(srcSpace.get(), dstSpace.get());
185 xform->apply(dst.get(), src.get(), len, SkColorSpaceXform::kRGBA_8888_ColorF ormat, 185 xform->apply(dst.get(), src.get(), len, SkColorSpaceXform::kRGBA_8888_ColorF ormat,
186 SkColorSpaceXform::kRGBA_8888_ColorFormat, kUnpremul_SkAlphaTyp e); 186 SkColorSpaceXform::kRGBA_8888_ColorFormat, kUnpremul_SkAlphaTyp e);
187 } 187 }
OLDNEW
« include/core/SkColorSpaceXform.h ('K') | « src/core/SkColorSpaceXform_Base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698