| 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_;
|
| }
|
|
|