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

Unified Diff: ui/gfx/icc_profile.cc

Issue 2873203003: color: Add --force-color-profile command line flag (Closed)
Patch Set: Created 3 years, 7 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/icc_profile.h ('k') | ui/gfx/icc_profile_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/icc_profile.cc
diff --git a/ui/gfx/icc_profile.cc b/ui/gfx/icc_profile.cc
index 044e03bef3aa3856f77b5e5eb0e5bbdfb257e37a..d87e7d2d2d810cceb409b0132c63116542856d49 100644
--- a/ui/gfx/icc_profile.cc
+++ b/ui/gfx/icc_profile.cc
@@ -6,12 +6,14 @@
#include <list>
+#include "base/command_line.h"
#include "base/containers/mru_cache.h"
#include "base/lazy_instance.h"
#include "base/synchronization/lock.h"
#include "third_party/skia/include/core/SkColorSpaceXform.h"
#include "third_party/skia/include/core/SkICC.h"
#include "ui/gfx/skia_color_space_util.h"
+#include "ui/gfx/switches.h"
namespace gfx {
@@ -105,11 +107,38 @@ ICCProfile ICCProfile::FromDataWithId(const void* data,
#if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(USE_X11)
// static
ICCProfile ICCProfile::FromBestMonitor() {
+ if (HasForcedProfile())
+ return GetForcedProfile();
return ICCProfile();
}
#endif
// static
+bool ICCProfile::HasForcedProfile() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kForceColorProfile);
+}
+
+// static
+ICCProfile ICCProfile::GetForcedProfile() {
+ DCHECK(HasForcedProfile());
+ ICCProfile icc_profile;
+ std::string value =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kForceColorProfile);
+ if (value == "srgb") {
+ ColorSpace::CreateSRGB().GetICCProfile(&icc_profile);
+ } else if (value == "generic-rgb") {
+ ColorSpace generic_rgb_color_space(ColorSpace::PrimaryID::APPLE_GENERIC_RGB,
+ ColorSpace::TransferID::GAMMA18);
+ generic_rgb_color_space.GetICCProfile(&icc_profile);
+ } else {
+ LOG(ERROR) << "Invalid forced color profile";
+ }
+ return icc_profile;
+}
+
+// static
const std::vector<char>& ICCProfile::GetData() const {
return data_;
}
« no previous file with comments | « ui/gfx/icc_profile.h ('k') | ui/gfx/icc_profile_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698