fix: Make disable_color_correct_rendering patch work again (#35050)

Fix disable_color_correct_rendering patch.
This commit is contained in:
Devin Foley 2022-07-26 09:35:10 -07:00 committed by GitHub
parent c842f63383
commit 0be73d18ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,14 +20,15 @@ to deal with color spaces. That is being tracked at
https://crbug.com/634542 and https://crbug.com/711107.
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 6a148c3173f8f5653b945ed9b6ffcbf48d76d511..b30c2e686ff9b64691142ff893225c60cedeaebd 100644
index 6a148c3173f8f5653b945ed9b6ffcbf48d76d511..3809ffe0f487e60539db58980b3232030ce8d4f8 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1864,6 +1864,9 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw(
@@ -1864,6 +1864,10 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw(
TargetColorParams LayerTreeHostImpl::GetTargetColorParams(
gfx::ContentColorUsage content_color_usage) const {
TargetColorParams params;
+ if (!settings_.enable_color_correct_rendering) {
+ params.color_space = gfx::ColorSpace();
+ return params;
+ }
@ -112,7 +113,7 @@ index 3f0a3b2133f0d48054f33df28b93a9ee40d7ed78..801bf4b1090a8f0de922fdac6c4145c2
sandbox::policy::switches::kDisableSeccompFilterSandbox,
sandbox::policy::switches::kNoSandbox,
diff --git a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc
index 75d7af9a79d4e7f2cd39e45496ab5fff66407638..b4ddafdd126edd16172f00448bbbd56eaf509b1f 100644
index 75d7af9a79d4e7f2cd39e45496ab5fff66407638..35b0bb908245330fbdc5205caa3299bf6fd8f7b4 100644
--- a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc
+++ b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc
@@ -4,6 +4,7 @@
@ -131,7 +132,18 @@ index 75d7af9a79d4e7f2cd39e45496ab5fff66407638..b4ddafdd126edd16172f00448bbbd56e
namespace blink {
@@ -118,6 +120,11 @@ uint8_t CanvasColorParams::BytesPerPixel() const {
@@ -19,6 +21,10 @@ namespace blink {
// Level 4 specification.
gfx::ColorSpace PredefinedColorSpaceToGfxColorSpace(
PredefinedColorSpace color_space) {
+ auto* cmd_line = base::CommandLine::ForCurrentProcess();
+ if (cmd_line->HasSwitch(switches::kDisableColorCorrectRendering)) {
+ return gfx::ColorSpace();
+ }
switch (color_space) {
case PredefinedColorSpace::kSRGB:
return gfx::ColorSpace::CreateSRGB();
@@ -118,6 +124,11 @@ uint8_t CanvasColorParams::BytesPerPixel() const {
}
gfx::ColorSpace CanvasColorParams::GetStorageGfxColorSpace() const {