Commit 37aab329 authored by Reza.Zakerinasab's avatar Reza.Zakerinasab Committed by Commit Bot

Bind canvas color management to GPU compositing

Bug: 840371
Change-Id: Ia606c6a773b202be623fc31d9dcb542a4e483d7f
Reviewed-on: https://chromium-review.googlesource.com/c/1277186
Commit-Queue: Mohammad Reza Zakerinasab <zakerinasab@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599214}
parent 1e301632
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "third_party/blink/renderer/core/origin_trials/origin_trials.h" #include "third_party/blink/renderer/core/origin_trials/origin_trials.h"
#include "third_party/blink/renderer/core/workers/worker_animation_frame_provider.h" #include "third_party/blink/renderer/core/workers/worker_animation_frame_provider.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h"
...@@ -44,14 +45,17 @@ CanvasRenderingContext::CanvasRenderingContext( ...@@ -44,14 +45,17 @@ CanvasRenderingContext::CanvasRenderingContext(
creation_attributes_(attrs) { creation_attributes_(attrs) {
// Supported color spaces: srgb-uint8, srgb-f16, p3-f16, rec2020-f16. For wide // Supported color spaces: srgb-uint8, srgb-f16, p3-f16, rec2020-f16. For wide
// gamut color spaces, user must explicitly request for float16 storage. // gamut color spaces, user must explicitly request for float16 storage.
// Otherwise, we fall back to srgb-uint8. Invalid requests fall back to // Otherwise, we fall back to srgb-uint8. If GPU compositing is not available,
// srgb-uint8 too. // again we fall back to srgb-uint8. Invalid requests also fall back to
if (creation_attributes_.pixel_format == kF16CanvasPixelFormatName) { // srgb-uint8.
color_params_.SetCanvasPixelFormat(kF16CanvasPixelFormat); if (SharedGpuContext::IsGpuCompositingEnabled()) {
if (creation_attributes_.color_space == kRec2020CanvasColorSpaceName) if (creation_attributes_.pixel_format == kF16CanvasPixelFormatName) {
color_params_.SetCanvasColorSpace(kRec2020CanvasColorSpace); color_params_.SetCanvasPixelFormat(kF16CanvasPixelFormat);
else if (creation_attributes_.color_space == kP3CanvasColorSpaceName) if (creation_attributes_.color_space == kRec2020CanvasColorSpaceName)
color_params_.SetCanvasColorSpace(kP3CanvasColorSpace); color_params_.SetCanvasColorSpace(kRec2020CanvasColorSpace);
else if (creation_attributes_.color_space == kP3CanvasColorSpaceName)
color_params_.SetCanvasColorSpace(kP3CanvasColorSpace);
}
} }
if (!creation_attributes_.alpha) { if (!creation_attributes_.alpha) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment