| 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 "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/output/filter_operations.h" | 8 #include "cc/output/filter_operations.h" |
| 9 #include "content/public/common/common_param_traits.h" | 9 #include "content/public/common/common_param_traits.h" |
| 10 #include "ui/gfx/transform.h" | 10 #include "ui/gfx/transform.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 WriteParam(m, p.drop_shadow_color()); | 33 WriteParam(m, p.drop_shadow_color()); |
| 34 break; | 34 break; |
| 35 case cc::FilterOperation::COLOR_MATRIX: | 35 case cc::FilterOperation::COLOR_MATRIX: |
| 36 for (int i = 0; i < 20; ++i) | 36 for (int i = 0; i < 20; ++i) |
| 37 WriteParam(m, p.matrix()[i]); | 37 WriteParam(m, p.matrix()[i]); |
| 38 break; | 38 break; |
| 39 case cc::FilterOperation::ZOOM: | 39 case cc::FilterOperation::ZOOM: |
| 40 WriteParam(m, p.amount()); | 40 WriteParam(m, p.amount()); |
| 41 WriteParam(m, p.zoom_inset()); | 41 WriteParam(m, p.zoom_inset()); |
| 42 break; | 42 break; |
| 43 case cc::FilterOperation::REFERENCE: |
| 44 // Reference filters cannot be serialized until crbug.com/164084 is fixed. |
| 45 break; |
| 43 } | 46 } |
| 44 } | 47 } |
| 45 | 48 |
| 46 bool ParamTraits<cc::FilterOperation>::Read( | 49 bool ParamTraits<cc::FilterOperation>::Read( |
| 47 const Message* m, PickleIterator* iter, param_type* r) { | 50 const Message* m, PickleIterator* iter, param_type* r) { |
| 48 cc::FilterOperation::FilterType type; | 51 cc::FilterOperation::FilterType type; |
| 49 float amount; | 52 float amount; |
| 50 gfx::Point drop_shadow_offset; | 53 gfx::Point drop_shadow_offset; |
| 51 SkColor drop_shadow_color; | 54 SkColor drop_shadow_color; |
| 52 SkScalar matrix[20]; | 55 SkScalar matrix[20]; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 case cc::FilterOperation::ZOOM: | 101 case cc::FilterOperation::ZOOM: |
| 99 if (ReadParam(m, iter, &amount) && | 102 if (ReadParam(m, iter, &amount) && |
| 100 ReadParam(m, iter, &zoom_inset) && | 103 ReadParam(m, iter, &zoom_inset) && |
| 101 amount >= 0.f && | 104 amount >= 0.f && |
| 102 zoom_inset >= 0) { | 105 zoom_inset >= 0) { |
| 103 r->set_amount(amount); | 106 r->set_amount(amount); |
| 104 r->set_zoom_inset(zoom_inset); | 107 r->set_zoom_inset(zoom_inset); |
| 105 success = true; | 108 success = true; |
| 106 } | 109 } |
| 107 break; | 110 break; |
| 111 case cc::FilterOperation::REFERENCE: |
| 112 // Reference filters cannot be serialized until crbug.com/164084 is fixed. |
| 113 NOTREACHED(); |
| 114 success = false; |
| 115 break; |
| 108 } | 116 } |
| 109 return success; | 117 return success; |
| 110 } | 118 } |
| 111 | 119 |
| 112 void ParamTraits<cc::FilterOperation>::Log( | 120 void ParamTraits<cc::FilterOperation>::Log( |
| 113 const param_type& p, std::string* l) { | 121 const param_type& p, std::string* l) { |
| 114 l->append("("); | 122 l->append("("); |
| 115 LogParam(static_cast<unsigned>(p.type()), l); | 123 LogParam(static_cast<unsigned>(p.type()), l); |
| 116 l->append(", "); | 124 l->append(", "); |
| 117 | 125 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 140 if (i) | 148 if (i) |
| 141 l->append(", "); | 149 l->append(", "); |
| 142 LogParam(p.matrix()[i], l); | 150 LogParam(p.matrix()[i], l); |
| 143 } | 151 } |
| 144 break; | 152 break; |
| 145 case cc::FilterOperation::ZOOM: | 153 case cc::FilterOperation::ZOOM: |
| 146 LogParam(p.amount(), l); | 154 LogParam(p.amount(), l); |
| 147 l->append(", "); | 155 l->append(", "); |
| 148 LogParam(p.zoom_inset(), l); | 156 LogParam(p.zoom_inset(), l); |
| 149 break; | 157 break; |
| 158 case cc::FilterOperation::REFERENCE: |
| 159 // Reference filters cannot be serialized until crbug.com/164084 is fixed. |
| 160 break; |
| 150 } | 161 } |
| 151 l->append(")"); | 162 l->append(")"); |
| 152 } | 163 } |
| 153 | 164 |
| 154 void ParamTraits<cc::FilterOperations>::Write( | 165 void ParamTraits<cc::FilterOperations>::Write( |
| 155 Message* m, const param_type& p) { | 166 Message* m, const param_type& p) { |
| 156 WriteParam(m, p.size()); | 167 WriteParam(m, p.size()); |
| 157 for (std::size_t i = 0; i < p.size(); ++i) { | 168 for (std::size_t i = 0; i < p.size(); ++i) { |
| 158 WriteParam(m, p.at(i)); | 169 WriteParam(m, p.at(i)); |
| 159 } | 170 } |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 l->append(", ["); | 718 l->append(", ["); |
| 708 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { | 719 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { |
| 709 if (i) | 720 if (i) |
| 710 l->append(", "); | 721 l->append(", "); |
| 711 LogParam(*p.render_pass_list[i], l); | 722 LogParam(*p.render_pass_list[i], l); |
| 712 } | 723 } |
| 713 l->append("])"); | 724 l->append("])"); |
| 714 } | 725 } |
| 715 | 726 |
| 716 } // namespace IPC | 727 } // namespace IPC |
| OLD | NEW |