Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make disable_color_correct_rendering patch work again #35088

Merged
merged 1 commit into from Jul 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions patches/chromium/disable_color_correct_rendering.patch
Expand Up @@ -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 3824e500fd88105e9c6d459f23097b2b4f0686ed..927ede7608a5c6992e9f9fb05e4b8e43b7e10cf8 100644
index 3824e500fd88105e9c6d459f23097b2b4f0686ed..958c592de85a194d5c2ba640a64549afedbb73c1 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1889,6 +1889,9 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw(
@@ -1889,6 +1889,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;
+ }

Expand Down Expand Up @@ -260,7 +261,7 @@ index 5f2451eefad211c85460eb457ad3d6e184540d59..d9d8352c6b1b8db8d86ad1ed1d4a3d30
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 6260d73068636f4a8d4c73c161a4ffe165b267d0..2686ef0dfb7d8b667647d11fece5aa8e1be76fe5 100644
index 6260d73068636f4a8d4c73c161a4ffe165b267d0..2d86f6829b9ad8927a03f288cc78d6ce65d7c5c0 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 @@
Expand All @@ -279,7 +280,18 @@ index 6260d73068636f4a8d4c73c161a4ffe165b267d0..2686ef0dfb7d8b667647d11fece5aa8e

namespace blink {

@@ -118,6 +120,11 @@ uint8_t CanvasColorParams::BytesPerPixel() const {
@@ -21,6 +23,10 @@ namespace {
// 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 {
Expand Down