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

Unified Diff: ui/gfx/ipc/color/gfx_param_traits.cc

Issue 2663453002: Revert of Use SkICC in gfx::ICCProfile and gfx::ColorSpace (Closed)
Patch Set: Created 3 years, 11 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/ipc/color/gfx_param_traits.h ('k') | ui/gfx/ipc/color/gfx_param_traits_macros.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/ipc/color/gfx_param_traits.cc
diff --git a/ui/gfx/ipc/color/gfx_param_traits.cc b/ui/gfx/ipc/color/gfx_param_traits.cc
index 657adc32735d78ed84b5b8ac55b0a99a17d28701..6129e1dc53ed01384d7dc042bfc6d41989227bbe 100644
--- a/ui/gfx/ipc/color/gfx_param_traits.cc
+++ b/ui/gfx/ipc/color/gfx_param_traits.cc
@@ -16,10 +16,10 @@
GetParamSize(s, p.matrix_);
GetParamSize(s, p.range_);
GetParamSize(s, p.icc_profile_id_);
- if (p.primaries_ == gfx::ColorSpace::PrimaryID::CUSTOM)
- s->AddData(sizeof(p.custom_primary_matrix_));
- if (p.transfer_ == gfx::ColorSpace::TransferID::CUSTOM)
- s->AddData(sizeof(p.custom_transfer_params_));
+ if (p.primaries_ == gfx::ColorSpace::PrimaryID::CUSTOM) {
+ for (int i = 0; i < 12; i++)
+ GetParamSize(s, p.custom_primary_matrix_[i]);
+ }
}
void ParamTraits<gfx::ColorSpace>::Write(base::Pickle* m,
@@ -30,12 +30,8 @@
WriteParam(m, p.range_);
WriteParam(m, p.icc_profile_id_);
if (p.primaries_ == gfx::ColorSpace::PrimaryID::CUSTOM) {
- m->WriteBytes(reinterpret_cast<const char*>(p.custom_primary_matrix_),
- sizeof(p.custom_primary_matrix_));
- }
- if (p.transfer_ == gfx::ColorSpace::TransferID::CUSTOM) {
- m->WriteBytes(reinterpret_cast<const char*>(p.custom_transfer_params_),
- sizeof(p.custom_transfer_params_));
+ for (int i = 0; i < 12; i++)
+ WriteParam(m, p.custom_primary_matrix_[i]);
}
}
@@ -52,18 +48,12 @@
return false;
if (!ReadParam(m, iter, &r->icc_profile_id_))
return false;
+
if (r->primaries_ == gfx::ColorSpace::PrimaryID::CUSTOM) {
- const char* data = nullptr;
- if (!iter->ReadBytes(&data, sizeof(r->custom_primary_matrix_)))
- return false;
- memcpy(r->custom_primary_matrix_, data, sizeof(r->custom_primary_matrix_));
- }
- if (r->transfer_ == gfx::ColorSpace::TransferID::CUSTOM) {
- const char* data = nullptr;
- if (!iter->ReadBytes(&data, sizeof(r->custom_transfer_params_)))
- return false;
- memcpy(r->custom_transfer_params_, data,
- sizeof(r->custom_transfer_params_));
+ for (int i = 0; i < 12; i++) {
+ if (!ReadParam(m, iter, r->custom_primary_matrix_ + i))
+ return false;
+ }
}
return true;
}
@@ -71,36 +61,6 @@
void ParamTraits<gfx::ColorSpace>::Log(const gfx::ColorSpace& p,
std::string* l) {
l->append("<gfx::ColorSpace>");
-}
-
-void ParamTraits<gfx::ICCProfile>::GetSize(base::PickleSizer* s,
- const gfx::ICCProfile& p) {
- GetParamSize(s, p.id_);
- GetParamSize(s, p.data_);
-}
-
-void ParamTraits<gfx::ICCProfile>::Write(base::Pickle* m,
- const gfx::ICCProfile& p) {
- WriteParam(m, p.id_);
- WriteParam(m, p.data_);
-}
-
-bool ParamTraits<gfx::ICCProfile>::Read(const base::Pickle* m,
- base::PickleIterator* iter,
- gfx::ICCProfile* r) {
- if (!ReadParam(m, iter, &r->id_))
- return false;
- if (!ReadParam(m, iter, &r->data_))
- return false;
- // Ensure that this entry is added to the global ICC profile cache, if it
- // is not there already.
- r->ComputeColorSpaceAndCache();
- return true;
-}
-
-void ParamTraits<gfx::ICCProfile>::Log(const gfx::ICCProfile& p,
- std::string* l) {
- l->append("<gfx::ICCProfile>");
}
} // namespace IPC
« no previous file with comments | « ui/gfx/ipc/color/gfx_param_traits.h ('k') | ui/gfx/ipc/color/gfx_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698