| 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 6129e1dc53ed01384d7dc042bfc6d41989227bbe..657adc32735d78ed84b5b8ac55b0a99a17d28701 100644
|
| --- a/ui/gfx/ipc/color/gfx_param_traits.cc
|
| +++ b/ui/gfx/ipc/color/gfx_param_traits.cc
|
| @@ -16,10 +16,10 @@ void ParamTraits<gfx::ColorSpace>::GetSize(base::PickleSizer* s,
|
| GetParamSize(s, p.matrix_);
|
| GetParamSize(s, p.range_);
|
| GetParamSize(s, p.icc_profile_id_);
|
| - if (p.primaries_ == gfx::ColorSpace::PrimaryID::CUSTOM) {
|
| - for (int i = 0; i < 12; i++)
|
| - GetParamSize(s, p.custom_primary_matrix_[i]);
|
| - }
|
| + 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_));
|
| }
|
|
|
| void ParamTraits<gfx::ColorSpace>::Write(base::Pickle* m,
|
| @@ -30,8 +30,12 @@ void ParamTraits<gfx::ColorSpace>::Write(base::Pickle* m,
|
| WriteParam(m, p.range_);
|
| WriteParam(m, p.icc_profile_id_);
|
| if (p.primaries_ == gfx::ColorSpace::PrimaryID::CUSTOM) {
|
| - for (int i = 0; i < 12; i++)
|
| - WriteParam(m, p.custom_primary_matrix_[i]);
|
| + 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_));
|
| }
|
| }
|
|
|
| @@ -48,12 +52,18 @@ bool ParamTraits<gfx::ColorSpace>::Read(const base::Pickle* m,
|
| return false;
|
| if (!ReadParam(m, iter, &r->icc_profile_id_))
|
| return false;
|
| -
|
| if (r->primaries_ == gfx::ColorSpace::PrimaryID::CUSTOM) {
|
| - for (int i = 0; i < 12; i++) {
|
| - if (!ReadParam(m, iter, r->custom_primary_matrix_ + i))
|
| - return false;
|
| - }
|
| + 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_));
|
| }
|
| return true;
|
| }
|
| @@ -63,6 +73,36 @@ void ParamTraits<gfx::ColorSpace>::Log(const gfx::ColorSpace& p,
|
| 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
|
|
|
| // Generate param traits size methods.
|
|
|