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

Unified Diff: ui/gfx/color_transform.cc

Issue 2229953003: Support for custom primaries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test updated Created 4 years, 4 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/color_transform.h ('k') | ui/gfx/color_transform_fuzzer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_transform.cc
diff --git a/ui/gfx/color_transform.cc b/ui/gfx/color_transform.cc
index 7e5f05a7178a61582a7cb96fd2ad96109ce16442..4cbb325e3d15d83d751f0a18f403ab4fd08b154d 100644
--- a/ui/gfx/color_transform.cc
+++ b/ui/gfx/color_transform.cc
@@ -500,7 +500,7 @@ class ColorSpaceToColorSpaceTransform : public ColorTransform {
const ColorSpace& to,
Intent intent)
: from_(from), to_(to) {
- if (intent == Intent::PERCEPTUAL) {
+ if (intent == Intent::INTENT_PERCEPTUAL) {
switch (from_.transfer_) {
case ColorSpace::TransferID::UNSPECIFIED:
case ColorSpace::TransferID::BT709:
@@ -523,12 +523,26 @@ class ColorSpaceToColorSpaceTransform : public ColorTransform {
c_ *= Invert(GetRangeAdjustMatrix(to_.range_, to_.matrix_));
*to_transfer_matrix *= GetTransferMatrix(to_.matrix_);
- b_ *= Invert(GetPrimaryMatrix(to_.primaries_));
- b_ *= GetPrimaryMatrix(from_.primaries_);
+ b_ *= Invert(GetPrimaryTransform(to_));
+ b_ *= GetPrimaryTransform(from_);
*from_transfer_matrix *= Invert(GetTransferMatrix(from_.matrix_));
a_ *= GetRangeAdjustMatrix(from_.range_, from_.matrix_);
}
+ static Transform GetPrimaryTransform(const ColorSpace& c) {
+ if (c.primaries_ == ColorSpace::PrimaryID::CUSTOM) {
+ return Transform(c.custom_primary_matrix_[0], c.custom_primary_matrix_[1],
+ c.custom_primary_matrix_[2], c.custom_primary_matrix_[3],
+ c.custom_primary_matrix_[4], c.custom_primary_matrix_[5],
+ c.custom_primary_matrix_[6], c.custom_primary_matrix_[7],
+ c.custom_primary_matrix_[8], c.custom_primary_matrix_[9],
+ c.custom_primary_matrix_[10],
+ c.custom_primary_matrix_[11], 0.0f, 0.0f, 0.0f, 1.0f);
+ } else {
+ return GetPrimaryMatrix(c.primaries_);
+ }
+ }
+
void transform(TriStim* colors, size_t num) override {
for (size_t i = 0; i < num; i++) {
TriStim c = colors[i];
« no previous file with comments | « ui/gfx/color_transform.h ('k') | ui/gfx/color_transform_fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698