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

Unified Diff: ui/gfx/color_space.cc

Issue 2795093002: color: Clean up dependencies to allow including in cc/paint (Closed)
Patch Set: Move to separate component Created 3 years, 9 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
Index: ui/gfx/color_space.cc
diff --git a/ui/gfx/color_space.cc b/ui/gfx/color_space.cc
index 7b5421d48bd5835077102e9a5e78022d3d4fa19e..27a0f54364ac73b8e6a28919253bb1cf5f783e99 100644
--- a/ui/gfx/color_space.cc
+++ b/ui/gfx/color_space.cc
@@ -14,7 +14,6 @@
#include "third_party/skia/include/core/SkICC.h"
#include "ui/gfx/icc_profile.h"
#include "ui/gfx/skia_color_space_util.h"
-#include "ui/gfx/transform.h"
namespace gfx {
@@ -188,6 +187,11 @@ ColorSpace::ColorSpace(const ColorSpace& other)
sizeof(custom_primary_matrix_));
}
}
+
+ColorSpace::ColorSpace(ColorSpace&& other) = default;
+
+ColorSpace& ColorSpace::operator=(const ColorSpace& other) = default;
+
ColorSpace::~ColorSpace() = default;
bool ColorSpace::IsValid() const {
@@ -332,6 +336,27 @@ bool ColorSpace::operator<(const ColorSpace& other) const {
return false;
}
+size_t ColorSpace::GetHash() const {
+ size_t result = (static_cast<size_t>(primaries_) << 0) |
+ (static_cast<size_t>(transfer_) << 8) |
+ (static_cast<size_t>(matrix_) << 16) |
+ (static_cast<size_t>(range_) << 24);
+ if (primaries_ == PrimaryID::CUSTOM) {
+ const uint32_t* params =
+ reinterpret_cast<const uint32_t*>(custom_primary_matrix_);
+ result ^= params[0];
+ result ^= params[4];
+ result ^= params[8];
+ }
+ if (transfer_ == TransferID::CUSTOM) {
+ const uint32_t* params =
+ reinterpret_cast<const uint32_t*>(custom_transfer_params_);
+ result ^= params[3];
+ result ^= params[6];
+ }
+ return result;
+}
+
std::string ColorSpace::ToString() const {
std::stringstream ss;
ss << "{primaries:";
« ui/gfx/BUILD.gn ('K') | « ui/gfx/color_space.h ('k') | ui/gfx/icc_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698