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

Unified Diff: src/codec/SkPngCodec.cpp

Issue 1928123002: Introduce SkGammas type to represent ICC gamma curves (Closed) Base URL: https://skia.googlesource.com/skia.git@delcolorspace
Patch Set: Rename and fix test Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkColorSpace.h » ('j') | src/core/SkColorSpace.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkPngCodec.cpp
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 1ad7f8006ee85a0a8016e129dd15104993fe8108..6f3b7a8688f785fa007aea7692cc9f3ccb43b702 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -210,7 +210,7 @@ sk_sp<SkColorSpace> read_color_space(png_structp png_ptr, png_infop info_ptr) {
png_fixed_point XYZ[9];
SkFloat3x3 toXYZD50;
png_fixed_point gamma;
- SkFloat3 gammas;
+ SkGammas gammas;
if (png_get_cHRM_XYZ_fixed(png_ptr, info_ptr, &XYZ[0], &XYZ[1], &XYZ[2], &XYZ[3], &XYZ[4],
&XYZ[5], &XYZ[6], &XYZ[7], &XYZ[8])) {
@@ -225,16 +225,16 @@ sk_sp<SkColorSpace> read_color_space(png_structp png_ptr, png_infop info_ptr) {
}
if (PNG_INFO_gAMA == png_get_gAMA_fixed(png_ptr, info_ptr, &gamma)) {
- gammas.fVec[0] = gammas.fVec[1] = gammas.fVec[2] =
+ gammas.fRed.fValue = gammas.fGreen.fValue = gammas.fBlue.fValue =
png_inverted_fixed_point_to_float(gamma);
} else {
// If the image does not specify gamma, let's choose linear. Should we default
// to sRGB? Most images are intended to be sRGB (gamma = 2.2f).
- gammas.fVec[0] = gammas.fVec[1] = gammas.fVec[2] = 1.0f;
+ gammas.fRed.fValue = gammas.fGreen.fValue = gammas.fBlue.fValue = 1.0f;
}
- return SkColorSpace::NewRGB(toXYZD50, gammas);
+ return SkColorSpace::NewRGB(toXYZD50, std::move(gammas));
}
// Last, check for gamma.
@@ -247,9 +247,10 @@ sk_sp<SkColorSpace> read_color_space(png_structp png_ptr, png_infop info_ptr) {
toXYZD50.fMat[0] = toXYZD50.fMat[4] = toXYZD50.fMat[8] = 1.0f;
// Set the gammas.
- gammas.fVec[0] = gammas.fVec[1] = gammas.fVec[2] = png_inverted_fixed_point_to_float(gamma);
+ gammas.fRed.fValue = gammas.fGreen.fValue = gammas.fBlue.fValue =
+ png_inverted_fixed_point_to_float(gamma);
- return SkColorSpace::NewRGB(toXYZD50, gammas);
+ return SkColorSpace::NewRGB(toXYZD50, std::move(gammas));
}
#endif // LIBPNG >= 1.6
« no previous file with comments | « no previous file | src/core/SkColorSpace.h » ('j') | src/core/SkColorSpace.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698