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

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

Issue 2183953002: Add some actual data to gfx::ColorSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 4 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 #include "ui/gfx/color_space.h" 5 #include "ui/gfx/color_space.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "ui/gfx/icc_profile.h" 11 #include "ui/gfx/icc_profile.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 14
15 ColorSpace::ColorSpace() = default; 15 ColorSpace::ColorSpace()
16 : primaries_(PrimaryID::UNSPECIFIED),
17 transfer_(TransferID::UNSPECIFIED),
18 matrix_(MatrixID::UNSPECIFIED),
19 range_(RangeID::LIMITED) {}
20
21 ColorSpace::ColorSpace(PrimaryID primaries,
22 TransferID transfer,
23 MatrixID matrix,
24 RangeID range)
25 : primaries_(primaries),
26 transfer_(transfer),
27 matrix_(matrix),
28 range_(range) {
29 // TODO: Set profile_id_
30 }
16 31
17 // static 32 // static
18 ColorSpace ColorSpace::CreateSRGB() { 33 ColorSpace ColorSpace::CreateSRGB() {
19 ColorSpace color_space; 34 ColorSpace color_space;
20 color_space.valid_ = true; 35 color_space.primaries_ = PrimaryID::BT709;
Tom Sepez 2016/07/27 17:52:26 nit: Why not just a one-liner like return ColorS
hubbe 2016/07/27 18:08:44 Done.
21 color_space.icc_profile_id_ = ICCProfile::kSRGBId; 36 color_space.transfer_ = TransferID::IEC61966_2_1;
37 color_space.matrix_ = MatrixID::RGB;
38 color_space.range_ = RangeID::FULL;
22 return color_space; 39 return color_space;
23 } 40 }
24 41
25 // static 42 // static
26 ColorSpace ColorSpace::CreateJpeg() { 43 ColorSpace ColorSpace::CreateJpeg() {
27 ColorSpace color_space; 44 ColorSpace color_space;
28 color_space.valid_ = true; 45 color_space.primaries_ = PrimaryID::BT709;
29 color_space.icc_profile_id_ = ICCProfile::kJpegId; 46 color_space.transfer_ = TransferID::IEC61966_2_1;
47 color_space.matrix_ = MatrixID::BT709;
48 color_space.range_ = RangeID::FULL;
30 return color_space; 49 return color_space;
31 } 50 }
32 51
33 // static 52 // static
34 ColorSpace ColorSpace::CreateREC601() { 53 ColorSpace ColorSpace::CreateREC601() {
35 ColorSpace color_space; 54 ColorSpace color_space;
36 color_space.valid_ = true; 55 color_space.primaries_ = PrimaryID::SMPTE170M;
37 color_space.icc_profile_id_ = ICCProfile::kRec601Id; 56 color_space.transfer_ = TransferID::SMPTE170M;
57 color_space.matrix_ = MatrixID::SMPTE170M;
58 color_space.range_ = RangeID::LIMITED;
38 return color_space; 59 return color_space;
39 } 60 }
40 61
41 // static 62 // static
42 ColorSpace ColorSpace::CreateREC709() { 63 ColorSpace ColorSpace::CreateREC709() {
43 ColorSpace color_space; 64 ColorSpace color_space;
44 color_space.valid_ = true; 65 color_space.primaries_ = PrimaryID::BT709;
45 color_space.icc_profile_id_ = ICCProfile::kRec709Id; 66 color_space.transfer_ = TransferID::BT709;
67 color_space.matrix_ = MatrixID::BT709;
68 color_space.range_ = RangeID::LIMITED;
46 return color_space; 69 return color_space;
47 } 70 }
48 71
49 bool ColorSpace::operator==(const ColorSpace& other) const { 72 bool ColorSpace::operator==(const ColorSpace& other) const {
50 // TODO(ccameron): The |icc_profile_id_| should eventually not factor in 73 return primaries_ == other.primaries_ && transfer_ == other.transfer_ &&
51 // to equality comparison at all, because it's just an optimization, but 74 matrix_ == other.matrix_ && range_ == other.range_;
52 // for now there is no other data in this structure.
53 return valid_ == other.valid_ && icc_profile_id_ == other.icc_profile_id_;
54 } 75 }
55 76
56 } // namespace gfx 77 } // namespace gfx
OLDNEW
« ui/gfx/color_space.h ('K') | « ui/gfx/color_space.h ('k') | ui/gfx/icc_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698