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

Side by Side Diff: ui/gfx/color_space.h

Issue 2640393002: HDR preparations (Closed)
Patch Set: scRGB -> scRGBLinear Created 3 years, 11 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 | « no previous file | ui/gfx/color_space.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_COLOR_SPACE_H_ 5 #ifndef UI_GFX_COLOR_SPACE_H_
6 #define UI_GFX_COLOR_SPACE_H_ 6 #define UI_GFX_COLOR_SPACE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 RangeID full_range); 143 RangeID full_range);
144 ColorSpace(const ColorSpace& other); 144 ColorSpace(const ColorSpace& other);
145 ColorSpace(int primaries, int transfer, int matrix, RangeID full_range); 145 ColorSpace(int primaries, int transfer, int matrix, RangeID full_range);
146 ~ColorSpace(); 146 ~ColorSpace();
147 147
148 static PrimaryID PrimaryIDFromInt(int primary_id); 148 static PrimaryID PrimaryIDFromInt(int primary_id);
149 static TransferID TransferIDFromInt(int transfer_id); 149 static TransferID TransferIDFromInt(int transfer_id);
150 static MatrixID MatrixIDFromInt(int matrix_id); 150 static MatrixID MatrixIDFromInt(int matrix_id);
151 151
152 static ColorSpace CreateSRGB(); 152 static ColorSpace CreateSRGB();
153 // scRGB is like RGB, but linear and values outside of 0-1 are allowed.
154 // scRGB is normally used with fp16 textures.
155 static ColorSpace CreateSCRGBLinear();
153 static ColorSpace CreateXYZD50(); 156 static ColorSpace CreateXYZD50();
154 157
155 // TODO: Remove these, and replace with more generic constructors. 158 // TODO: Remove these, and replace with more generic constructors.
156 static ColorSpace CreateJpeg(); 159 static ColorSpace CreateJpeg();
157 static ColorSpace CreateREC601(); 160 static ColorSpace CreateREC601();
158 static ColorSpace CreateREC709(); 161 static ColorSpace CreateREC709();
159 162
160 bool operator==(const ColorSpace& other) const; 163 bool operator==(const ColorSpace& other) const;
161 bool operator!=(const ColorSpace& other) const; 164 bool operator!=(const ColorSpace& other) const;
162 bool operator<(const ColorSpace& other) const; 165 bool operator<(const ColorSpace& other) const;
163 166
167 bool IsHDR() const;
168
164 // Note that this may return nullptr. 169 // Note that this may return nullptr.
165 const sk_sp<SkColorSpace>& ToSkColorSpace() const { return sk_color_space_; } 170 const sk_sp<SkColorSpace>& ToSkColorSpace() const { return sk_color_space_; }
166 static ColorSpace FromSkColorSpace(const sk_sp<SkColorSpace>& sk_color_space); 171 static ColorSpace FromSkColorSpace(const sk_sp<SkColorSpace>& sk_color_space);
167 172
168 private: 173 private:
169 PrimaryID primaries_ = PrimaryID::UNSPECIFIED; 174 PrimaryID primaries_ = PrimaryID::UNSPECIFIED;
170 TransferID transfer_ = TransferID::UNSPECIFIED; 175 TransferID transfer_ = TransferID::UNSPECIFIED;
171 MatrixID matrix_ = MatrixID::UNSPECIFIED; 176 MatrixID matrix_ = MatrixID::UNSPECIFIED;
172 RangeID range_ = RangeID::LIMITED; 177 RangeID range_ = RangeID::LIMITED;
173 178
174 // Only used if primaries_ == PrimaryID::CUSTOM 179 // Only used if primaries_ == PrimaryID::CUSTOM
175 float custom_primary_matrix_[12]; 180 float custom_primary_matrix_[12];
176 181
177 // This is used to look up the ICCProfile from which this ColorSpace was 182 // This is used to look up the ICCProfile from which this ColorSpace was
178 // created, if possible. 183 // created, if possible.
179 uint64_t icc_profile_id_ = 0; 184 uint64_t icc_profile_id_ = 0;
180 185
181 sk_sp<SkColorSpace> sk_color_space_; 186 sk_sp<SkColorSpace> sk_color_space_;
182 187
183 friend class ICCProfile; 188 friend class ICCProfile;
184 friend class ColorSpaceToColorSpaceTransform; 189 friend class ColorSpaceToColorSpaceTransform;
185 friend class ColorSpaceWin; 190 friend class ColorSpaceWin;
186 friend struct IPC::ParamTraits<gfx::ColorSpace>; 191 friend struct IPC::ParamTraits<gfx::ColorSpace>;
187 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); 192 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace);
188 }; 193 };
189 194
190 } // namespace gfx 195 } // namespace gfx
191 196
192 #endif // UI_GFX_COLOR_SPACE_H_ 197 #endif // UI_GFX_COLOR_SPACE_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/color_space.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698