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 WriteParam(m, p.zoomRect()); | 41 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls. |
42 WriteParam(m, p.amount()); | 42 WriteParam(m, p.amount()); |
43 WriteParam(m, p.zoomInset()); | |
44 #endif | |
piman
2013/03/13 06:01:14
It's a bit awkward to leave it like that, where th
danakj
2013/03/13 06:05:48
True. Ok, made it not read anything.
| |
43 break; | 45 break; |
44 } | 46 } |
45 } | 47 } |
46 | 48 |
47 bool ParamTraits<WebKit::WebFilterOperation>::Read( | 49 bool ParamTraits<WebKit::WebFilterOperation>::Read( |
48 const Message* m, PickleIterator* iter, param_type* r) { | 50 const Message* m, PickleIterator* iter, param_type* r) { |
49 WebKit::WebFilterOperation::FilterType type; | 51 WebKit::WebFilterOperation::FilterType type; |
50 float amount; | 52 float amount; |
51 WebKit::WebPoint dropShadowOffset; | 53 WebKit::WebPoint dropShadowOffset; |
52 WebKit::WebColor dropShadowColor; | 54 WebKit::WebColor dropShadowColor; |
53 SkScalar matrix[20]; | 55 SkScalar matrix[20]; |
54 WebKit::WebRect zoomRect; | 56 int zoomInset; |
55 | 57 |
56 if (!ReadParam(m, iter, &type)) | 58 if (!ReadParam(m, iter, &type)) |
57 return false; | 59 return false; |
58 r->setType(type); | 60 r->setType(type); |
59 | 61 |
60 bool success = false; | 62 bool success = false; |
61 switch (type) { | 63 switch (type) { |
62 case WebKit::WebFilterOperation::FilterTypeGrayscale: | 64 case WebKit::WebFilterOperation::FilterTypeGrayscale: |
63 case WebKit::WebFilterOperation::FilterTypeSepia: | 65 case WebKit::WebFilterOperation::FilterTypeSepia: |
64 case WebKit::WebFilterOperation::FilterTypeSaturate: | 66 case WebKit::WebFilterOperation::FilterTypeSaturate: |
(...skipping 25 matching lines...) Expand all Loading... | |
90 if (!ReadParam(m, iter, &matrix[i])) | 92 if (!ReadParam(m, iter, &matrix[i])) |
91 break; | 93 break; |
92 } | 94 } |
93 if (i == 20) { | 95 if (i == 20) { |
94 r->setMatrix(matrix); | 96 r->setMatrix(matrix); |
95 success = true; | 97 success = true; |
96 } | 98 } |
97 break; | 99 break; |
98 } | 100 } |
99 case WebKit::WebFilterOperation::FilterTypeZoom: | 101 case WebKit::WebFilterOperation::FilterTypeZoom: |
100 if (ReadParam(m, iter, &zoomRect) && | 102 if (ReadParam(m, iter, &amount) && |
101 ReadParam(m, iter, &amount)) { | 103 ReadParam(m, iter, &zoomInset)) { |
102 r->setZoomRect(zoomRect); | 104 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls. |
103 r->setAmount(amount); | 105 r->setAmount(amount); |
106 r->setZoomInset(zoomInset); | |
107 #else | |
108 r->setAmount(0.f); | |
109 r->setZoomRect(WebKit::WebRect(0, 0, 0, 0)); | |
110 #endif | |
104 success = true; | 111 success = true; |
105 } | 112 } |
106 break; | 113 break; |
107 } | 114 } |
108 return success; | 115 return success; |
109 } | 116 } |
110 | 117 |
111 void ParamTraits<WebKit::WebFilterOperation>::Log( | 118 void ParamTraits<WebKit::WebFilterOperation>::Log( |
112 const param_type& p, std::string* l) { | 119 const param_type& p, std::string* l) { |
113 l->append("("); | 120 l->append("("); |
(...skipping 21 matching lines...) Expand all Loading... | |
135 LogParam(p.dropShadowColor(), l); | 142 LogParam(p.dropShadowColor(), l); |
136 break; | 143 break; |
137 case WebKit::WebFilterOperation::FilterTypeColorMatrix: | 144 case WebKit::WebFilterOperation::FilterTypeColorMatrix: |
138 for (int i = 0; i < 20; ++i) { | 145 for (int i = 0; i < 20; ++i) { |
139 if (i) | 146 if (i) |
140 l->append(", "); | 147 l->append(", "); |
141 LogParam(p.matrix()[i], l); | 148 LogParam(p.matrix()[i], l); |
142 } | 149 } |
143 break; | 150 break; |
144 case WebKit::WebFilterOperation::FilterTypeZoom: | 151 case WebKit::WebFilterOperation::FilterTypeZoom: |
145 LogParam(p.zoomRect(), l); | 152 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls. |
153 LogParam(p.amount(), l); | |
146 l->append(", "); | 154 l->append(", "); |
147 LogParam(p.amount(), l); | 155 LogParam(p.zoomInset(), l); |
156 #endif | |
148 break; | 157 break; |
149 } | 158 } |
150 l->append(")"); | 159 l->append(")"); |
151 } | 160 } |
152 | 161 |
153 void ParamTraits<WebKit::WebFilterOperations>::Write( | 162 void ParamTraits<WebKit::WebFilterOperations>::Write( |
154 Message* m, const param_type& p) { | 163 Message* m, const param_type& p) { |
155 WriteParam(m, p.size()); | 164 WriteParam(m, p.size()); |
156 for (std::size_t i = 0; i < p.size(); ++i) { | 165 for (std::size_t i = 0; i < p.size(); ++i) { |
157 WriteParam(m, p.at(i)); | 166 WriteParam(m, p.at(i)); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 l->append(", ["); | 688 l->append(", ["); |
680 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { | 689 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { |
681 if (i) | 690 if (i) |
682 l->append(", "); | 691 l->append(", "); |
683 LogParam(*p.render_pass_list[i], l); | 692 LogParam(*p.render_pass_list[i], l); |
684 } | 693 } |
685 l->append("])"); | 694 l->append("])"); |
686 } | 695 } |
687 | 696 |
688 } // namespace IPC | 697 } // namespace IPC |
OLD | NEW |