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/ColorSpaceTest.cpp

Issue 2098583002: SkMatrix44 clarifications and clean-ups (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/SkMatrix44.cpp ('k') | tests/Matrix44Test.cpp » ('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 #include "Resources.h" 8 #include "Resources.h"
9 #include "SkCodec.h" 9 #include "SkCodec.h"
10 #include "SkColorSpace.h" 10 #include "SkColorSpace.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const float blue[] = { 0.436035f, 0.222488f, 0.013916f }; 94 const float blue[] = { 0.436035f, 0.222488f, 0.013916f };
95 test_space(r, colorSpace, red, green, blue, SkColorSpace::k2Dot2Curve_GammaN amed); 95 test_space(r, colorSpace, red, green, blue, SkColorSpace::k2Dot2Curve_GammaN amed);
96 } 96 }
97 97
98 DEF_TEST(ColorSpaceSRGBCompare, r) { 98 DEF_TEST(ColorSpaceSRGBCompare, r) {
99 // Create an sRGB color space by name 99 // Create an sRGB color space by name
100 sk_sp<SkColorSpace> namedColorSpace = SkColorSpace::NewNamed(SkColorSpace::k SRGB_Named); 100 sk_sp<SkColorSpace> namedColorSpace = SkColorSpace::NewNamed(SkColorSpace::k SRGB_Named);
101 101
102 // Create an sRGB color space by value 102 // Create an sRGB color space by value
103 SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor); 103 SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor);
104 srgbToxyzD50.set3x3ColMajorf(g_sRGB_XYZ); 104 srgbToxyzD50.set3x3RowMajorf(g_sRGB_XYZ);
105 sk_sp<SkColorSpace> rgbColorSpace = SkColorSpace::NewRGB(SkColorSpace::kSRGB _GammaNamed, 105 sk_sp<SkColorSpace> rgbColorSpace = SkColorSpace::NewRGB(SkColorSpace::kSRGB _GammaNamed,
106 srgbToxyzD50); 106 srgbToxyzD50);
107 REPORTER_ASSERT(r, rgbColorSpace == namedColorSpace); 107 REPORTER_ASSERT(r, rgbColorSpace == namedColorSpace);
108 108
109 // Change a single value from the sRGB matrix 109 // Change a single value from the sRGB matrix
110 srgbToxyzD50.set(2, 2, 0.5f); 110 srgbToxyzD50.set(2, 2, 0.5f);
111 sk_sp<SkColorSpace> strangeColorSpace = SkColorSpace::NewRGB(SkColorSpace::k SRGB_GammaNamed, 111 sk_sp<SkColorSpace> strangeColorSpace = SkColorSpace::NewRGB(SkColorSpace::k SRGB_GammaNamed,
112 srgbToxyzD50); 112 srgbToxyzD50);
113 REPORTER_ASSERT(r, strangeColorSpace != namedColorSpace); 113 REPORTER_ASSERT(r, strangeColorSpace != namedColorSpace);
114 } 114 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 DEF_TEST(ColorSpace_Serialize, r) { 197 DEF_TEST(ColorSpace_Serialize, r) {
198 test_serialize(r, SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named).get(), t rue); 198 test_serialize(r, SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named).get(), t rue);
199 test_serialize(r, SkColorSpace::NewNamed(SkColorSpace::kAdobeRGB_Named).get( ), true); 199 test_serialize(r, SkColorSpace::NewNamed(SkColorSpace::kAdobeRGB_Named).get( ), true);
200 200
201 sk_sp<SkData> monitorData = SkData::MakeFromFileName( 201 sk_sp<SkData> monitorData = SkData::MakeFromFileName(
202 GetResourcePath("monitor_profiles/HP_ZR30w.icc").c_str()); 202 GetResourcePath("monitor_profiles/HP_ZR30w.icc").c_str());
203 test_serialize(r, SkColorSpace::NewICC(monitorData->data(), monitorData->siz e()).get(), false); 203 test_serialize(r, SkColorSpace::NewICC(monitorData->data(), monitorData->siz e()).get(), false);
204 } 204 }
205 205
OLDNEW
« no previous file with comments | « src/core/SkMatrix44.cpp ('k') | tests/Matrix44Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698