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

Unified Diff: ui/gfx/color_transform.cc

Issue 2691213007: color: Don't use QCMS for transforms unless necessary (Closed)
Patch Set: Incorporate review feedback 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/color_space.cc ('k') | ui/gfx/color_transform_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_transform.cc
diff --git a/ui/gfx/color_transform.cc b/ui/gfx/color_transform.cc
index e88f3a56b92cedc78ef39b696e39653d75a24f23..933252a9fc43f9b3b12e5061e3e03359f77e8b68 100644
--- a/ui/gfx/color_transform.cc
+++ b/ui/gfx/color_transform.cc
@@ -277,6 +277,11 @@ class ColorTransformInternal : public ColorTransform {
ColorTransform::Intent intent);
void Simplify();
+ // Retrieve the ICC profile from which |color_space| was created, only if that
+ // is a more precise representation of the color space than the primaries and
+ // transfer function in |color_space|.
+ ScopedQcmsProfile GetQCMSProfileIfNecessary(const ColorSpace& color_space);
+
std::list<std::unique_ptr<ColorTransformStep>> steps_;
};
@@ -653,9 +658,10 @@ class QCMSColorTransform : public ColorTransformStep {
ScopedQcmsProfile to_;
};
-ScopedQcmsProfile GetQCMSProfileIfAvailable(const ColorSpace& color_space) {
- ICCProfile icc_profile = ICCProfile::FromColorSpace(color_space);
- if (icc_profile.GetData().empty())
+ScopedQcmsProfile ColorTransformInternal::GetQCMSProfileIfNecessary(
+ const ColorSpace& color_space) {
+ ICCProfile icc_profile;
+ if (!ICCProfile::FromId(color_space.icc_profile_id_, true, &icc_profile))
return nullptr;
return ScopedQcmsProfile(qcms_profile_from_memory(
icc_profile.GetData().data(), icc_profile.GetData().size()));
@@ -690,8 +696,8 @@ ColorTransformInternal::ColorTransformInternal(const ColorSpace& from,
if (!from.IsValid())
return;
- ScopedQcmsProfile from_profile = GetQCMSProfileIfAvailable(from);
- ScopedQcmsProfile to_profile = GetQCMSProfileIfAvailable(to);
+ ScopedQcmsProfile from_profile = GetQCMSProfileIfNecessary(from);
+ ScopedQcmsProfile to_profile = GetQCMSProfileIfNecessary(to);
bool has_from_profile = !!from_profile;
bool has_to_profile = !!to_profile;
« no previous file with comments | « ui/gfx/color_space.cc ('k') | ui/gfx/color_transform_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698