| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/common/cc_messages.h" | 5 #include "content/common/cc_messages.h" |
| 6 | 6 |
| 7 #include "content/public/common/common_param_traits.h" | 7 #include "content/public/common/common_param_traits.h" |
| 8 #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h" | 8 #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h" |
| 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa
trix.h" | 10 #include "ui/gfx/transform.h" |
| 11 | 11 |
| 12 namespace IPC { | 12 namespace IPC { |
| 13 | 13 |
| 14 void ParamTraits<WebKit::WebData>::Write(Message* m, const param_type& p) { | 14 void ParamTraits<WebKit::WebData>::Write(Message* m, const param_type& p) { |
| 15 if (p.isEmpty()) { | 15 if (p.isEmpty()) { |
| 16 m->WriteData(NULL, 0); | 16 m->WriteData(NULL, 0); |
| 17 } else { | 17 } else { |
| 18 m->WriteData(p.data(), p.size()); | 18 m->WriteData(p.data(), p.size()); |
| 19 } | 19 } |
| 20 } | 20 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 const param_type& p, std::string* l) { | 201 const param_type& p, std::string* l) { |
| 202 l->append("("); | 202 l->append("("); |
| 203 for (std::size_t i = 0; i < p.size(); ++i) { | 203 for (std::size_t i = 0; i < p.size(); ++i) { |
| 204 if (i) | 204 if (i) |
| 205 l->append(", "); | 205 l->append(", "); |
| 206 LogParam(p.at(i), l); | 206 LogParam(p.at(i), l); |
| 207 } | 207 } |
| 208 l->append(")"); | 208 l->append(")"); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void ParamTraits<WebKit::WebTransformationMatrix>::Write( | 211 void ParamTraits<gfx::Transform>::Write( |
| 212 Message* m, const param_type& p) { | 212 Message* m, const param_type& p) { |
| 213 WriteParam(m, p.m11()); | 213 WriteParam(m, p.matrix().getDouble(0, 0)); |
| 214 WriteParam(m, p.m12()); | 214 WriteParam(m, p.matrix().getDouble(1, 0)); |
| 215 WriteParam(m, p.m13()); | 215 WriteParam(m, p.matrix().getDouble(2, 0)); |
| 216 WriteParam(m, p.m14()); | 216 WriteParam(m, p.matrix().getDouble(3, 0)); |
| 217 WriteParam(m, p.m21()); | 217 WriteParam(m, p.matrix().getDouble(0, 1)); |
| 218 WriteParam(m, p.m22()); | 218 WriteParam(m, p.matrix().getDouble(1, 1)); |
| 219 WriteParam(m, p.m23()); | 219 WriteParam(m, p.matrix().getDouble(2, 1)); |
| 220 WriteParam(m, p.m24()); | 220 WriteParam(m, p.matrix().getDouble(3, 1)); |
| 221 WriteParam(m, p.m31()); | 221 WriteParam(m, p.matrix().getDouble(0, 2)); |
| 222 WriteParam(m, p.m32()); | 222 WriteParam(m, p.matrix().getDouble(1, 2)); |
| 223 WriteParam(m, p.m33()); | 223 WriteParam(m, p.matrix().getDouble(2, 2)); |
| 224 WriteParam(m, p.m34()); | 224 WriteParam(m, p.matrix().getDouble(3, 2)); |
| 225 WriteParam(m, p.m41()); | 225 WriteParam(m, p.matrix().getDouble(0, 3)); |
| 226 WriteParam(m, p.m42()); | 226 WriteParam(m, p.matrix().getDouble(1, 3)); |
| 227 WriteParam(m, p.m43()); | 227 WriteParam(m, p.matrix().getDouble(2, 3)); |
| 228 WriteParam(m, p.m44()); | 228 WriteParam(m, p.matrix().getDouble(3, 3)); |
| 229 } | 229 } |
| 230 | 230 |
| 231 bool ParamTraits<WebKit::WebTransformationMatrix>::Read( | 231 bool ParamTraits<gfx::Transform>::Read( |
| 232 const Message* m, PickleIterator* iter, param_type* r) { | 232 const Message* m, PickleIterator* iter, param_type* r) { |
| 233 // Note: In this function, "m12" means 1st row, 2nd column of the matrix. |
| 234 // This is consistent with Skia's row-column notation, but backwards from |
| 235 // WebCore's column-row notation. |
| 233 double m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, | 236 double m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, |
| 234 m41, m42, m43, m44; | 237 m41, m42, m43, m44; |
| 238 |
| 235 bool success = | 239 bool success = |
| 236 ReadParam(m, iter, &m11) && | 240 ReadParam(m, iter, &m11) && |
| 241 ReadParam(m, iter, &m21) && |
| 242 ReadParam(m, iter, &m31) && |
| 243 ReadParam(m, iter, &m41) && |
| 237 ReadParam(m, iter, &m12) && | 244 ReadParam(m, iter, &m12) && |
| 245 ReadParam(m, iter, &m22) && |
| 246 ReadParam(m, iter, &m32) && |
| 247 ReadParam(m, iter, &m42) && |
| 238 ReadParam(m, iter, &m13) && | 248 ReadParam(m, iter, &m13) && |
| 249 ReadParam(m, iter, &m23) && |
| 250 ReadParam(m, iter, &m33) && |
| 251 ReadParam(m, iter, &m43) && |
| 239 ReadParam(m, iter, &m14) && | 252 ReadParam(m, iter, &m14) && |
| 240 ReadParam(m, iter, &m21) && | |
| 241 ReadParam(m, iter, &m22) && | |
| 242 ReadParam(m, iter, &m23) && | |
| 243 ReadParam(m, iter, &m24) && | 253 ReadParam(m, iter, &m24) && |
| 244 ReadParam(m, iter, &m31) && | |
| 245 ReadParam(m, iter, &m32) && | |
| 246 ReadParam(m, iter, &m33) && | |
| 247 ReadParam(m, iter, &m34) && | 254 ReadParam(m, iter, &m34) && |
| 248 ReadParam(m, iter, &m41) && | |
| 249 ReadParam(m, iter, &m42) && | |
| 250 ReadParam(m, iter, &m43) && | |
| 251 ReadParam(m, iter, &m44); | 255 ReadParam(m, iter, &m44); |
| 252 | 256 |
| 253 if (success) { | 257 if (success) { |
| 254 r->setM11(m11); | 258 r->matrix().setDouble(0, 0, m11); |
| 255 r->setM12(m12); | 259 r->matrix().setDouble(1, 0, m21); |
| 256 r->setM13(m13); | 260 r->matrix().setDouble(2, 0, m31); |
| 257 r->setM14(m14); | 261 r->matrix().setDouble(3, 0, m41); |
| 258 r->setM21(m21); | 262 r->matrix().setDouble(0, 1, m12); |
| 259 r->setM22(m22); | 263 r->matrix().setDouble(1, 1, m22); |
| 260 r->setM23(m23); | 264 r->matrix().setDouble(2, 1, m32); |
| 261 r->setM24(m24); | 265 r->matrix().setDouble(3, 1, m42); |
| 262 r->setM31(m31); | 266 r->matrix().setDouble(0, 2, m13); |
| 263 r->setM32(m32); | 267 r->matrix().setDouble(1, 2, m23); |
| 264 r->setM33(m33); | 268 r->matrix().setDouble(2, 2, m33); |
| 265 r->setM34(m34); | 269 r->matrix().setDouble(3, 2, m43); |
| 266 r->setM41(m41); | 270 r->matrix().setDouble(0, 3, m14); |
| 267 r->setM42(m42); | 271 r->matrix().setDouble(1, 3, m24); |
| 268 r->setM43(m43); | 272 r->matrix().setDouble(2, 3, m34); |
| 269 r->setM44(m44); | 273 r->matrix().setDouble(3, 3, m44); |
| 270 } | 274 } |
| 271 | 275 |
| 272 return success; | 276 return success; |
| 273 } | 277 } |
| 274 | 278 |
| 275 void ParamTraits<WebKit::WebTransformationMatrix>::Log( | 279 void ParamTraits<gfx::Transform>::Log( |
| 276 const param_type& p, std::string* l) { | 280 const param_type& p, std::string* l) { |
| 277 l->append("("); | 281 l->append("("); |
| 278 LogParam(p.m11(), l); | 282 LogParam(p.matrix().getDouble(0, 0), l); |
| 279 l->append(", "); | 283 l->append(", "); |
| 280 LogParam(p.m12(), l); | 284 LogParam(p.matrix().getDouble(1, 0), l); |
| 281 l->append(", "); | 285 l->append(", "); |
| 282 LogParam(p.m13(), l); | 286 LogParam(p.matrix().getDouble(2, 0), l); |
| 283 l->append(", "); | 287 l->append(", "); |
| 284 LogParam(p.m14(), l); | 288 LogParam(p.matrix().getDouble(3, 0), l); |
| 285 l->append(", "); | 289 l->append(", "); |
| 286 LogParam(p.m21(), l); | 290 LogParam(p.matrix().getDouble(0, 1), l); |
| 287 l->append(", "); | 291 l->append(", "); |
| 288 LogParam(p.m22(), l); | 292 LogParam(p.matrix().getDouble(1, 1), l); |
| 289 l->append(", "); | 293 l->append(", "); |
| 290 LogParam(p.m23(), l); | 294 LogParam(p.matrix().getDouble(2, 1), l); |
| 291 l->append(", "); | 295 l->append(", "); |
| 292 LogParam(p.m24(), l); | 296 LogParam(p.matrix().getDouble(3, 1), l); |
| 293 l->append(", "); | 297 l->append(", "); |
| 294 LogParam(p.m31(), l); | 298 LogParam(p.matrix().getDouble(0, 2), l); |
| 295 l->append(", "); | 299 l->append(", "); |
| 296 LogParam(p.m32(), l); | 300 LogParam(p.matrix().getDouble(1, 2), l); |
| 297 l->append(", "); | 301 l->append(", "); |
| 298 LogParam(p.m33(), l); | 302 LogParam(p.matrix().getDouble(2, 2), l); |
| 299 l->append(", "); | 303 l->append(", "); |
| 300 LogParam(p.m34(), l); | 304 LogParam(p.matrix().getDouble(3, 2), l); |
| 301 l->append(", "); | 305 l->append(", "); |
| 302 LogParam(p.m41(), l); | 306 LogParam(p.matrix().getDouble(0, 3), l); |
| 303 l->append(", "); | 307 l->append(", "); |
| 304 LogParam(p.m42(), l); | 308 LogParam(p.matrix().getDouble(1, 3), l); |
| 305 l->append(", "); | 309 l->append(", "); |
| 306 LogParam(p.m43(), l); | 310 LogParam(p.matrix().getDouble(2, 3), l); |
| 307 l->append(", "); | 311 l->append(", "); |
| 308 LogParam(p.m44(), l); | 312 LogParam(p.matrix().getDouble(3, 3), l); |
| 309 l->append(") "); | 313 l->append(") "); |
| 310 } | 314 } |
| 311 | 315 |
| 312 void ParamTraits<cc::RenderPass>::Write( | 316 void ParamTraits<cc::RenderPass>::Write( |
| 313 Message* m, const param_type& p) { | 317 Message* m, const param_type& p) { |
| 314 WriteParam(m, p.id); | 318 WriteParam(m, p.id); |
| 315 WriteParam(m, p.output_rect); | 319 WriteParam(m, p.output_rect); |
| 316 WriteParam(m, p.damage_rect); | 320 WriteParam(m, p.damage_rect); |
| 317 WriteParam(m, p.transform_to_root_target); | 321 WriteParam(m, p.transform_to_root_target); |
| 318 WriteParam(m, p.has_transparent_background); | 322 WriteParam(m, p.has_transparent_background); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 if (!ReadParam(m, iter, quad.get())) | 403 if (!ReadParam(m, iter, quad.get())) |
| 400 return scoped_ptr<QuadType>(NULL).template PassAs<cc::DrawQuad>(); | 404 return scoped_ptr<QuadType>(NULL).template PassAs<cc::DrawQuad>(); |
| 401 return quad.template PassAs<cc::DrawQuad>(); | 405 return quad.template PassAs<cc::DrawQuad>(); |
| 402 } | 406 } |
| 403 | 407 |
| 404 bool ParamTraits<cc::RenderPass>::Read( | 408 bool ParamTraits<cc::RenderPass>::Read( |
| 405 const Message* m, PickleIterator* iter, param_type* p) { | 409 const Message* m, PickleIterator* iter, param_type* p) { |
| 406 cc::RenderPass::Id id(-1, -1); | 410 cc::RenderPass::Id id(-1, -1); |
| 407 gfx::Rect output_rect; | 411 gfx::Rect output_rect; |
| 408 gfx::RectF damage_rect; | 412 gfx::RectF damage_rect; |
| 409 WebKit::WebTransformationMatrix transform_to_root_target; | 413 gfx::Transform transform_to_root_target; |
| 410 bool has_transparent_background; | 414 bool has_transparent_background; |
| 411 bool has_occlusion_from_outside_target_surface; | 415 bool has_occlusion_from_outside_target_surface; |
| 412 WebKit::WebFilterOperations filters; | 416 WebKit::WebFilterOperations filters; |
| 413 WebKit::WebFilterOperations background_filters; | 417 WebKit::WebFilterOperations background_filters; |
| 414 size_t shared_quad_state_list_size; | 418 size_t shared_quad_state_list_size; |
| 415 size_t quad_list_size; | 419 size_t quad_list_size; |
| 416 | 420 |
| 417 if (!ReadParam(m, iter, &id) || | 421 if (!ReadParam(m, iter, &id) || |
| 418 !ReadParam(m, iter, &output_rect) || | 422 !ReadParam(m, iter, &output_rect) || |
| 419 !ReadParam(m, iter, &damage_rect) || | 423 !ReadParam(m, iter, &damage_rect) || |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 LogParam(*cc::YUVVideoDrawQuad::MaterialCast(quad), l); | 568 LogParam(*cc::YUVVideoDrawQuad::MaterialCast(quad), l); |
| 565 break; | 569 break; |
| 566 case cc::DrawQuad::INVALID: | 570 case cc::DrawQuad::INVALID: |
| 567 break; | 571 break; |
| 568 } | 572 } |
| 569 } | 573 } |
| 570 l->append("])"); | 574 l->append("])"); |
| 571 } | 575 } |
| 572 | 576 |
| 573 } // namespace IPC | 577 } // namespace IPC |
| OLD | NEW |