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

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

Issue 2712533002: color: Fix accidental partial color conversion (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
« no previous file with comments | « no previous file | no next file » | 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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_transform.h" 5 #include "ui/gfx/color_transform.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <list> 9 #include <list>
10 #include <memory> 10 #include <memory>
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 725
726 ColorTransformInternal::ColorTransformInternal(const ColorSpace& src, 726 ColorTransformInternal::ColorTransformInternal(const ColorSpace& src,
727 const ColorSpace& dst, 727 const ColorSpace& dst,
728 Intent intent) 728 Intent intent)
729 : src_(src), dst_(dst) { 729 : src_(src), dst_(dst) {
730 // If no source color space is specified, do no transformation. 730 // If no source color space is specified, do no transformation.
731 // TODO(ccameron): We may want dst assume sRGB at some point in the future. 731 // TODO(ccameron): We may want dst assume sRGB at some point in the future.
732 if (!src_.IsValid()) 732 if (!src_.IsValid())
733 return; 733 return;
734 734
735 ScopedQcmsProfile src_profile = GetQCMSProfileIfNecessary(src_); 735 // If the dst profile is not set, then do only YUV to RGB conversion, so
hubbe 2017/02/21 22:46:49 I'm afraid I don't get this. When does this happen
ccameron 2017/02/22 00:08:29 This happens whenever media::kVideoColorManagement
hubbe 2017/02/22 00:10:05 Can we add some more meat to the comment to descri
ccameron 2017/02/22 00:30:48 Done.
736 ScopedQcmsProfile dst_profile = GetQCMSProfileIfNecessary(dst_); 736 // ignore any ICC profiles.
737 ScopedQcmsProfile src_profile;
738 ScopedQcmsProfile dst_profile;
739 if (dst.IsValid()) {
740 src_profile = GetQCMSProfileIfNecessary(src_);
741 dst_profile = GetQCMSProfileIfNecessary(dst_);
742 }
737 bool has_src_profile = !!src_profile; 743 bool has_src_profile = !!src_profile;
738 bool has_dst_profile = !!dst_profile; 744 bool has_dst_profile = !!dst_profile;
739 745
740 if (src_profile) { 746 if (src_profile) {
741 steps_.push_back(base::MakeUnique<QCMSColorTransform>( 747 steps_.push_back(base::MakeUnique<QCMSColorTransform>(
742 std::move(src_profile), GetXYZD50Profile())); 748 std::move(src_profile), GetXYZD50Profile()));
743 } 749 }
744 750
745 AppendColorSpaceToColorSpaceTransform( 751 AppendColorSpaceToColorSpaceTransform(
746 has_src_profile ? ColorSpace::CreateXYZD50() : src_, 752 has_src_profile ? ColorSpace::CreateXYZD50() : src_,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 const ColorSpace& to, 818 const ColorSpace& to,
813 Intent intent) { 819 Intent intent) {
814 return std::unique_ptr<ColorTransform>( 820 return std::unique_ptr<ColorTransform>(
815 new ColorTransformInternal(from, to, intent)); 821 new ColorTransformInternal(from, to, intent));
816 } 822 }
817 823
818 ColorTransform::ColorTransform() {} 824 ColorTransform::ColorTransform() {}
819 ColorTransform::~ColorTransform() {} 825 ColorTransform::~ColorTransform() {}
820 826
821 } // namespace gfx 827 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698