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/compositor_frame.h" | 7 #include "cc/compositor_frame.h" |
8 #include "content/public/common/common_param_traits.h" | 8 #include "content/public/common/common_param_traits.h" |
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h" |
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 case WebKit::WebFilterOperation::FilterTypeDropShadow: | 31 case WebKit::WebFilterOperation::FilterTypeDropShadow: |
32 WriteParam(m, p.dropShadowOffset()); | 32 WriteParam(m, p.dropShadowOffset()); |
33 WriteParam(m, p.amount()); | 33 WriteParam(m, p.amount()); |
34 WriteParam(m, p.dropShadowColor()); | 34 WriteParam(m, p.dropShadowColor()); |
35 break; | 35 break; |
36 case WebKit::WebFilterOperation::FilterTypeColorMatrix: | 36 case WebKit::WebFilterOperation::FilterTypeColorMatrix: |
37 for (int i = 0; i < 20; ++i) | 37 for (int i = 0; i < 20; ++i) |
38 WriteParam(m, p.matrix()[i]); | 38 WriteParam(m, p.matrix()[i]); |
39 break; | 39 break; |
40 case WebKit::WebFilterOperation::FilterTypeZoom: | 40 case WebKit::WebFilterOperation::FilterTypeZoom: |
41 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls. | |
42 WriteParam(m, p.amount()); | 41 WriteParam(m, p.amount()); |
43 WriteParam(m, p.zoomInset()); | 42 WriteParam(m, p.zoomInset()); |
44 #endif | |
45 break; | 43 break; |
46 } | 44 } |
47 } | 45 } |
48 | 46 |
49 bool ParamTraits<WebKit::WebFilterOperation>::Read( | 47 bool ParamTraits<WebKit::WebFilterOperation>::Read( |
50 const Message* m, PickleIterator* iter, param_type* r) { | 48 const Message* m, PickleIterator* iter, param_type* r) { |
51 WebKit::WebFilterOperation::FilterType type; | 49 WebKit::WebFilterOperation::FilterType type; |
52 float amount; | 50 float amount; |
53 WebKit::WebPoint dropShadowOffset; | 51 WebKit::WebPoint dropShadowOffset; |
54 WebKit::WebColor dropShadowColor; | 52 WebKit::WebColor dropShadowColor; |
55 SkScalar matrix[20]; | 53 SkScalar matrix[20]; |
56 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls. | |
57 int zoom_inset; | 54 int zoom_inset; |
58 #endif | |
59 | 55 |
60 if (!ReadParam(m, iter, &type)) | 56 if (!ReadParam(m, iter, &type)) |
61 return false; | 57 return false; |
62 r->setType(type); | 58 r->setType(type); |
63 | 59 |
64 bool success = false; | 60 bool success = false; |
65 switch (type) { | 61 switch (type) { |
66 case WebKit::WebFilterOperation::FilterTypeGrayscale: | 62 case WebKit::WebFilterOperation::FilterTypeGrayscale: |
67 case WebKit::WebFilterOperation::FilterTypeSepia: | 63 case WebKit::WebFilterOperation::FilterTypeSepia: |
68 case WebKit::WebFilterOperation::FilterTypeSaturate: | 64 case WebKit::WebFilterOperation::FilterTypeSaturate: |
(...skipping 25 matching lines...) Expand all Loading... |
94 if (!ReadParam(m, iter, &matrix[i])) | 90 if (!ReadParam(m, iter, &matrix[i])) |
95 break; | 91 break; |
96 } | 92 } |
97 if (i == 20) { | 93 if (i == 20) { |
98 r->setMatrix(matrix); | 94 r->setMatrix(matrix); |
99 success = true; | 95 success = true; |
100 } | 96 } |
101 break; | 97 break; |
102 } | 98 } |
103 case WebKit::WebFilterOperation::FilterTypeZoom: | 99 case WebKit::WebFilterOperation::FilterTypeZoom: |
104 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls. | |
105 if (ReadParam(m, iter, &amount) && | 100 if (ReadParam(m, iter, &amount) && |
106 ReadParam(m, iter, &zoom_inset) && | 101 ReadParam(m, iter, &zoom_inset) && |
107 amount >= 0.f && | 102 amount >= 0.f && |
108 zoom_inset >= 0) { | 103 zoom_inset >= 0) { |
109 r->setAmount(amount); | 104 r->setAmount(amount); |
110 r->setZoomInset(zoom_inset); | 105 r->setZoomInset(zoom_inset); |
111 success = true; | 106 success = true; |
112 } | 107 } |
113 #endif | |
114 break; | 108 break; |
115 } | 109 } |
116 return success; | 110 return success; |
117 } | 111 } |
118 | 112 |
119 void ParamTraits<WebKit::WebFilterOperation>::Log( | 113 void ParamTraits<WebKit::WebFilterOperation>::Log( |
120 const param_type& p, std::string* l) { | 114 const param_type& p, std::string* l) { |
121 l->append("("); | 115 l->append("("); |
122 LogParam(static_cast<unsigned>(p.type()), l); | 116 LogParam(static_cast<unsigned>(p.type()), l); |
123 l->append(", "); | 117 l->append(", "); |
(...skipping 19 matching lines...) Expand all Loading... |
143 LogParam(p.dropShadowColor(), l); | 137 LogParam(p.dropShadowColor(), l); |
144 break; | 138 break; |
145 case WebKit::WebFilterOperation::FilterTypeColorMatrix: | 139 case WebKit::WebFilterOperation::FilterTypeColorMatrix: |
146 for (int i = 0; i < 20; ++i) { | 140 for (int i = 0; i < 20; ++i) { |
147 if (i) | 141 if (i) |
148 l->append(", "); | 142 l->append(", "); |
149 LogParam(p.matrix()[i], l); | 143 LogParam(p.matrix()[i], l); |
150 } | 144 } |
151 break; | 145 break; |
152 case WebKit::WebFilterOperation::FilterTypeZoom: | 146 case WebKit::WebFilterOperation::FilterTypeZoom: |
153 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls. | |
154 LogParam(p.amount(), l); | 147 LogParam(p.amount(), l); |
155 l->append(", "); | 148 l->append(", "); |
156 LogParam(p.zoomInset(), l); | 149 LogParam(p.zoomInset(), l); |
157 #endif | |
158 break; | 150 break; |
159 } | 151 } |
160 l->append(")"); | 152 l->append(")"); |
161 } | 153 } |
162 | 154 |
163 void ParamTraits<WebKit::WebFilterOperations>::Write( | 155 void ParamTraits<WebKit::WebFilterOperations>::Write( |
164 Message* m, const param_type& p) { | 156 Message* m, const param_type& p) { |
165 WriteParam(m, p.size()); | 157 WriteParam(m, p.size()); |
166 for (std::size_t i = 0; i < p.size(); ++i) { | 158 for (std::size_t i = 0; i < p.size(); ++i) { |
167 WriteParam(m, p.at(i)); | 159 WriteParam(m, p.at(i)); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 l->append(", ["); | 681 l->append(", ["); |
690 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { | 682 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { |
691 if (i) | 683 if (i) |
692 l->append(", "); | 684 l->append(", "); |
693 LogParam(*p.render_pass_list[i], l); | 685 LogParam(*p.render_pass_list[i], l); |
694 } | 686 } |
695 l->append("])"); | 687 l->append("])"); |
696 } | 688 } |
697 | 689 |
698 } // namespace IPC | 690 } // namespace IPC |
OLD | NEW |