1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32

cc / paint / target_color_params.cc [blame]

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/paint/target_color_params.h"

#include <sstream>

#include "base/hash/hash.h"

namespace cc {

size_t TargetColorParams::GetHash() const {
  const uint32_t* hdr_max_luminance_relative_int =
      reinterpret_cast<const uint32_t*>(&hdr_max_luminance_relative);
  const uint32_t* sdr_max_luminance_nits_int =
      reinterpret_cast<const uint32_t*>(&sdr_max_luminance_nits);
  size_t hash = color_space.GetHash();
  hash = base::HashInts(hash, *hdr_max_luminance_relative_int);
  hash = base::HashInts(hash, *sdr_max_luminance_nits_int);
  return hash;
}

std::string TargetColorParams::ToString() const {
  std::ostringstream str;
  str << "color_space: " << color_space.ToString()
      << "sdr_max_luminance_nits: " << sdr_max_luminance_nits
      << "hdr_max_luminance_relative: " << hdr_max_luminance_relative;
  return str.str();
}

}  // namespace cc