target_color_params.cc 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "cc/paint/target_color_params.h"
  5. #include <sstream>
  6. #include "base/hash/hash.h"
  7. namespace cc {
  8. size_t TargetColorParams::GetHash() const {
  9. const uint32_t* hdr_max_luminance_relative_int =
  10. reinterpret_cast<const uint32_t*>(&hdr_max_luminance_relative);
  11. const uint32_t* sdr_max_luminance_nits_int =
  12. reinterpret_cast<const uint32_t*>(&sdr_max_luminance_nits);
  13. size_t hash = color_space.GetHash();
  14. hash = base::HashInts(hash, *hdr_max_luminance_relative_int);
  15. hash = base::HashInts(hash, *sdr_max_luminance_nits_int);
  16. hash = base::HashInts(hash, enable_tone_mapping);
  17. return hash;
  18. }
  19. std::string TargetColorParams::ToString() const {
  20. std::ostringstream str;
  21. str << "color_space: " << color_space.ToString()
  22. << "sdr_max_luminance_nits: " << sdr_max_luminance_nits
  23. << "hdr_max_luminance_relative: " << hdr_max_luminance_relative
  24. << "enable_tone_mapping: " << enable_tone_mapping;
  25. return str.str();
  26. }
  27. } // namespace cc