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

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

Issue 2738713003: color: Ensure that VideoResourceUpdater give consistent colors (Closed)
Patch Set: Rebase Created 3 years, 9 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 | « gpu/ipc/client/gpu_memory_buffer_impl_io_surface.cc ('k') | 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 #include <ostream>
9 10
10 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "build/build_config.h" 13 #include "build/build_config.h"
13 #include "third_party/skia/include/core/SkColorSpace.h" 14 #include "third_party/skia/include/core/SkColorSpace.h"
14 #include "ui/gfx/gfx_export.h" 15 #include "ui/gfx/gfx_export.h"
15 16
16 namespace IPC { 17 namespace IPC {
17 template <class P> 18 template <class P>
18 struct ParamTraits; 19 struct ParamTraits;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 static ColorSpace CreateSCRGBLinear(); 138 static ColorSpace CreateSCRGBLinear();
138 139
139 // TODO: Remove these, and replace with more generic constructors. 140 // TODO: Remove these, and replace with more generic constructors.
140 static ColorSpace CreateJpeg(); 141 static ColorSpace CreateJpeg();
141 static ColorSpace CreateREC601(); 142 static ColorSpace CreateREC601();
142 static ColorSpace CreateREC709(); 143 static ColorSpace CreateREC709();
143 144
144 bool operator==(const ColorSpace& other) const; 145 bool operator==(const ColorSpace& other) const;
145 bool operator!=(const ColorSpace& other) const; 146 bool operator!=(const ColorSpace& other) const;
146 bool operator<(const ColorSpace& other) const; 147 bool operator<(const ColorSpace& other) const;
148 std::string ToString() const;
147 149
148 bool IsHDR() const; 150 bool IsHDR() const;
149 151
152 // Return this color space with any range adjust or YUV to RGB conversion
153 // stripped off.
154 gfx::ColorSpace GetAsFullRangeRGB() const;
155
150 // This will return nullptr for non-RGB spaces, spaces with non-FULL 156 // This will return nullptr for non-RGB spaces, spaces with non-FULL
151 // range, and unspecified spaces. 157 // range, and unspecified spaces.
152 sk_sp<SkColorSpace> ToSkColorSpace() const; 158 sk_sp<SkColorSpace> ToSkColorSpace() const;
153 159
154 // Return an SkColorSpace that represents this color space, with output-space 160 // Return an SkColorSpace that represents this color space, with output-space
155 // blending (which is only linear for color spaces with a linear tranasfer 161 // blending (which is only linear for color spaces with a linear tranasfer
156 // function). 162 // function).
157 sk_sp<SkColorSpace> ToNonlinearBlendedSkColorSpace() const; 163 sk_sp<SkColorSpace> ToNonlinearBlendedSkColorSpace() const;
158 164
159 // Populate |icc_profile| with an ICC profile that represents this color 165 // Populate |icc_profile| with an ICC profile that represents this color
160 // space. Returns false if this space is not representable. This ICC profile 166 // space. Returns false if this space is not representable.
161 // will be constructed ignoring the range adjust and transfer matrices (this
162 // is to match the IOSurface interface which takes the ICC profile and range
163 // and transfer matrices separately).
164 bool GetICCProfile(ICCProfile* icc_profile) const; 167 bool GetICCProfile(ICCProfile* icc_profile) const;
165 168
166 void GetPrimaryMatrix(SkMatrix44* to_XYZD50) const; 169 void GetPrimaryMatrix(SkMatrix44* to_XYZD50) const;
167 bool GetTransferFunction(SkColorSpaceTransferFn* fn) const; 170 bool GetTransferFunction(SkColorSpaceTransferFn* fn) const;
168 bool GetInverseTransferFunction(SkColorSpaceTransferFn* fn) const; 171 bool GetInverseTransferFunction(SkColorSpaceTransferFn* fn) const;
169 172
170 // For most formats, this is the RGB to YUV matrix. 173 // For most formats, this is the RGB to YUV matrix.
171 void GetTransferMatrix(SkMatrix44* matrix) const; 174 void GetTransferMatrix(SkMatrix44* matrix) const;
172 void GetRangeAdjustMatrix(SkMatrix44* matrix) const; 175 void GetRangeAdjustMatrix(SkMatrix44* matrix) const;
173 176
(...skipping 21 matching lines...) Expand all
195 sk_sp<SkColorSpace> icc_profile_sk_color_space_; 198 sk_sp<SkColorSpace> icc_profile_sk_color_space_;
196 199
197 friend class ICCProfile; 200 friend class ICCProfile;
198 friend class ColorTransform; 201 friend class ColorTransform;
199 friend class ColorTransformInternal; 202 friend class ColorTransformInternal;
200 friend class ColorSpaceWin; 203 friend class ColorSpaceWin;
201 friend struct IPC::ParamTraits<gfx::ColorSpace>; 204 friend struct IPC::ParamTraits<gfx::ColorSpace>;
202 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace); 205 FRIEND_TEST_ALL_PREFIXES(SimpleColorSpace, GetColorSpace);
203 }; 206 };
204 207
208 // Stream operator so ColorSpace can be used in assertion statements.
209 GFX_EXPORT std::ostream& operator<<(std::ostream& out,
210 const ColorSpace& color_space);
211
205 } // namespace gfx 212 } // namespace gfx
206 213
207 #endif // UI_GFX_COLOR_SPACE_H_ 214 #endif // UI_GFX_COLOR_SPACE_H_
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_io_surface.cc ('k') | ui/gfx/color_space.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698