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

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

Issue 2670773002: Towards deleting YUV to RGB computation redundancy (Closed)
Patch Set: Created 3 years, 10 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 // 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 bool IsHDR() const; 171 bool IsHDR() const;
172 172
173 // Note that this may return nullptr. 173 // Note that this may return nullptr.
174 sk_sp<SkColorSpace> ToSkColorSpace() const; 174 sk_sp<SkColorSpace> ToSkColorSpace() const;
175 static ColorSpace FromSkColorSpace(const sk_sp<SkColorSpace>& sk_color_space); 175 static ColorSpace FromSkColorSpace(const sk_sp<SkColorSpace>& sk_color_space);
176 176
177 void GetPrimaryMatrix(SkMatrix44* to_XYZD50) const; 177 void GetPrimaryMatrix(SkMatrix44* to_XYZD50) const;
178 bool GetTransferFunction(SkColorSpaceTransferFn* fn) const; 178 bool GetTransferFunction(SkColorSpaceTransferFn* fn) const;
179 bool GetInverseTransferFunction(SkColorSpaceTransferFn* fn) const; 179 bool GetInverseTransferFunction(SkColorSpaceTransferFn* fn) const;
180 180
181 // For most formats, this is the RGB to YUV matrix.
182 void GetTransferMatrix(SkMatrix44* matrix) const;
hubbe 2017/02/02 04:51:37 Maybe return a bool since this is not always possi
ccameron 2017/02/02 17:33:52 I was going back-and-forth on this, but in the end
hubbe 2017/02/02 18:35:25 Doing so would make the implementation a lot bigge
183 void GetRangeAdjustMatrix(SkMatrix44* matrix) const;
184
181 private: 185 private:
182 PrimaryID primaries_ = PrimaryID::UNSPECIFIED; 186 PrimaryID primaries_ = PrimaryID::UNSPECIFIED;
183 TransferID transfer_ = TransferID::UNSPECIFIED; 187 TransferID transfer_ = TransferID::UNSPECIFIED;
184 MatrixID matrix_ = MatrixID::UNSPECIFIED; 188 MatrixID matrix_ = MatrixID::UNSPECIFIED;
185 RangeID range_ = RangeID::LIMITED; 189 RangeID range_ = RangeID::LIMITED;
186 190
187 // Only used if primaries_ is PrimaryID::CUSTOM. 191 // Only used if primaries_ is PrimaryID::CUSTOM.
188 float custom_primary_matrix_[9] = {0, 0, 0, 0, 0, 0, 0, 0}; 192 float custom_primary_matrix_[9] = {0, 0, 0, 0, 0, 0, 0, 0};
189 193
190 // Only used if transfer_ is TransferID::CUSTOM. This array consists of the A 194 // Only used if transfer_ is TransferID::CUSTOM. This array consists of the A
191 // through G entries of the SkColorSpaceTransferFn structure in alphabetical 195 // through G entries of the SkColorSpaceTransferFn structure in alphabetical
192 // order. 196 // order.
193 float custom_transfer_params_[7] = {0, 0, 0, 0, 0, 0, 0}; 197 float custom_transfer_params_[7] = {0, 0, 0, 0, 0, 0, 0};
194 198
195 // This is used to look up the ICCProfile from which this ColorSpace was 199 // This is used to look up the ICCProfile from which this ColorSpace was
196 // created, if possible. 200 // created, if possible.
197 uint64_t icc_profile_id_ = 0; 201 uint64_t icc_profile_id_ = 0;
198 sk_sp<SkColorSpace> icc_profile_sk_color_space_; 202 sk_sp<SkColorSpace> icc_profile_sk_color_space_;
199 203
200 friend class ICCProfile; 204 friend class ICCProfile;
201 friend class ColorSpaceToColorSpaceTransform; 205 friend class ColorSpaceToColorSpaceTransform;
202 friend class ColorSpaceWin; 206 friend class ColorSpaceWin;
203 friend struct IPC::ParamTraits<gfx::ColorSpace>; 207 friend struct IPC::ParamTraits<gfx::ColorSpace>;
204 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); 208 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace);
205 }; 209 };
206 210
207 } // namespace gfx 211 } // namespace gfx
208 212
209 #endif // UI_GFX_COLOR_SPACE_H_ 213 #endif // UI_GFX_COLOR_SPACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698