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

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

Issue 2742613002: color: Always use parametric color spaces for raster (Closed)
Patch Set: More comment cleanup 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
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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 reinterpret_cast<float*>(colors), num * 3); 781 reinterpret_cast<float*>(colors), num * 3);
782 } 782 }
783 783
784 private: 784 private:
785 ScopedQcmsProfile from_; 785 ScopedQcmsProfile from_;
786 ScopedQcmsProfile to_; 786 ScopedQcmsProfile to_;
787 }; 787 };
788 788
789 ScopedQcmsProfile ColorTransformInternal::GetQCMSProfileIfNecessary( 789 ScopedQcmsProfile ColorTransformInternal::GetQCMSProfileIfNecessary(
790 const ColorSpace& color_space) { 790 const ColorSpace& color_space) {
791 if (color_space.primaries_ != ColorSpace::PrimaryID::ICC_PROFILE_REQUIRED ||
792 color_space.transfer_ != ColorSpace::TransferID::ICC_PROFILE_REQUIRED) {
793 return nullptr;
794 }
795 // TODO(ccameron): Use SkColorSpaceXform here to avoid looking up the
796 // ICCProfile.
791 ICCProfile icc_profile; 797 ICCProfile icc_profile;
792 if (!ICCProfile::FromId(color_space.icc_profile_id_, true, &icc_profile)) 798 if (!ICCProfile::FromId(color_space.icc_profile_id_, &icc_profile)) {
793 return nullptr; 799 // We needed the original ICC profile to construct this transform, but it
hubbe 2017/03/13 17:59:09 This seems unacceptable to me. In general, I don't
ccameron 2017/03/13 20:34:18 It denotes that the color space cannot be represen
hubbe 2017/03/13 20:38:56 I think we should have some sort of approximation
ccameron 2017/03/14 10:19:54 This is to ensure well-defined behavior in a vanis
hubbe 2017/03/14 18:26:46 I suppose we're never going to have non-RGB ICC pr
ccameron 2017/03/14 21:41:02 Done.
800 // has been flushed from our cache. Just make something up. This will be
801 // inaccurate, so spam the console.
802 LOG(ERROR) << "Failed to retrieve original ICC profile, using sRGB";
803 return ScopedQcmsProfile(qcms_profile_sRGB());
804 }
794 return ScopedQcmsProfile(qcms_profile_from_memory( 805 return ScopedQcmsProfile(qcms_profile_from_memory(
795 icc_profile.GetData().data(), icc_profile.GetData().size())); 806 icc_profile.GetData().data(), icc_profile.GetData().size()));
796 } 807 }
797 808
798 ScopedQcmsProfile GetXYZD50Profile() { 809 ScopedQcmsProfile GetXYZD50Profile() {
799 // QCMS is trixy, it has a datatype called qcms_CIE_xyY, but what it expects 810 // QCMS is trixy, it has a datatype called qcms_CIE_xyY, but what it expects
800 // is in fact not xyY color coordinates, it just wants the x/y values of the 811 // is in fact not xyY color coordinates, it just wants the x/y values of the
801 // primaries with Y equal to 1.0. 812 // primaries with Y equal to 1.0.
802 qcms_CIE_xyYTRIPLE xyz; 813 qcms_CIE_xyYTRIPLE xyz;
803 qcms_CIE_xyY w; 814 qcms_CIE_xyY w;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 const ColorSpace& to, 924 const ColorSpace& to,
914 Intent intent) { 925 Intent intent) {
915 return std::unique_ptr<ColorTransform>( 926 return std::unique_ptr<ColorTransform>(
916 new ColorTransformInternal(from, to, intent)); 927 new ColorTransformInternal(from, to, intent));
917 } 928 }
918 929
919 ColorTransform::ColorTransform() {} 930 ColorTransform::ColorTransform() {}
920 ColorTransform::~ColorTransform() {} 931 ColorTransform::~ColorTransform() {}
921 932
922 } // namespace gfx 933 } // namespace gfx
OLDNEW
« ui/gfx/color_space.h ('K') | « ui/gfx/color_space_win.cc ('k') | ui/gfx/icc_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698