Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Side by Side Diff: content/common/cc_messages.cc

Issue 21154002: Add support for converting cc::FilterOperations into an SkImageFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/cc_messages.h ('k') | content/common/cc_messages_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/filter_operations.h" 9 #include "cc/output/filter_operations.h"
10 #include "content/public/common/common_param_traits.h" 10 #include "content/public/common/common_param_traits.h"
(...skipping 26 matching lines...) Expand all
37 WriteParam(m, p.drop_shadow_color()); 37 WriteParam(m, p.drop_shadow_color());
38 break; 38 break;
39 case cc::FilterOperation::COLOR_MATRIX: 39 case cc::FilterOperation::COLOR_MATRIX:
40 for (int i = 0; i < 20; ++i) 40 for (int i = 0; i < 20; ++i)
41 WriteParam(m, p.matrix()[i]); 41 WriteParam(m, p.matrix()[i]);
42 break; 42 break;
43 case cc::FilterOperation::ZOOM: 43 case cc::FilterOperation::ZOOM:
44 WriteParam(m, p.amount()); 44 WriteParam(m, p.amount());
45 WriteParam(m, p.zoom_inset()); 45 WriteParam(m, p.zoom_inset());
46 break; 46 break;
47 case cc::FilterOperation::REFERENCE:
48 WriteParam(m, p.image_filter());
49 break;
47 } 50 }
48 } 51 }
49 52
50 bool ParamTraits<cc::FilterOperation>::Read( 53 bool ParamTraits<cc::FilterOperation>::Read(
51 const Message* m, PickleIterator* iter, param_type* r) { 54 const Message* m, PickleIterator* iter, param_type* r) {
52 cc::FilterOperation::FilterType type; 55 cc::FilterOperation::FilterType type;
53 float amount; 56 float amount;
54 gfx::Point drop_shadow_offset; 57 gfx::Point drop_shadow_offset;
55 SkColor drop_shadow_color; 58 SkColor drop_shadow_color;
56 SkScalar matrix[20]; 59 SkScalar matrix[20];
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 case cc::FilterOperation::ZOOM: 105 case cc::FilterOperation::ZOOM:
103 if (ReadParam(m, iter, &amount) && 106 if (ReadParam(m, iter, &amount) &&
104 ReadParam(m, iter, &zoom_inset) && 107 ReadParam(m, iter, &zoom_inset) &&
105 amount >= 0.f && 108 amount >= 0.f &&
106 zoom_inset >= 0) { 109 zoom_inset >= 0) {
107 r->set_amount(amount); 110 r->set_amount(amount);
108 r->set_zoom_inset(zoom_inset); 111 r->set_zoom_inset(zoom_inset);
109 success = true; 112 success = true;
110 } 113 }
111 break; 114 break;
115 case cc::FilterOperation::REFERENCE: {
116 skia::RefPtr<SkImageFilter> filter;
117 if (!ReadParam(m, iter, &filter)) {
118 success = false;
119 break;
120 }
121 r->set_image_filter(filter);
122 success = true;
123 break;
124 }
112 } 125 }
113 return success; 126 return success;
114 } 127 }
115 128
116 void ParamTraits<cc::FilterOperation>::Log( 129 void ParamTraits<cc::FilterOperation>::Log(
117 const param_type& p, std::string* l) { 130 const param_type& p, std::string* l) {
118 l->append("("); 131 l->append("(");
119 LogParam(static_cast<unsigned>(p.type()), l); 132 LogParam(static_cast<unsigned>(p.type()), l);
120 l->append(", "); 133 l->append(", ");
121 134
(...skipping 22 matching lines...) Expand all
144 if (i) 157 if (i)
145 l->append(", "); 158 l->append(", ");
146 LogParam(p.matrix()[i], l); 159 LogParam(p.matrix()[i], l);
147 } 160 }
148 break; 161 break;
149 case cc::FilterOperation::ZOOM: 162 case cc::FilterOperation::ZOOM:
150 LogParam(p.amount(), l); 163 LogParam(p.amount(), l);
151 l->append(", "); 164 l->append(", ");
152 LogParam(p.zoom_inset(), l); 165 LogParam(p.zoom_inset(), l);
153 break; 166 break;
167 case cc::FilterOperation::REFERENCE:
168 LogParam(p.image_filter(), l);
169 break;
154 } 170 }
155 l->append(")"); 171 l->append(")");
156 } 172 }
157 173
158 void ParamTraits<cc::FilterOperations>::Write( 174 void ParamTraits<cc::FilterOperations>::Write(
159 Message* m, const param_type& p) { 175 Message* m, const param_type& p) {
160 WriteParam(m, p.size()); 176 WriteParam(m, p.size());
161 for (std::size_t i = 0; i < p.size(); ++i) { 177 for (std::size_t i = 0; i < p.size(); ++i) {
162 WriteParam(m, p.at(i)); 178 WriteParam(m, p.at(i));
163 } 179 }
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 l->append(", ["); 762 l->append(", [");
747 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { 763 for (size_t i = 0; i < p.render_pass_list.size(); ++i) {
748 if (i) 764 if (i)
749 l->append(", "); 765 l->append(", ");
750 LogParam(*p.render_pass_list[i], l); 766 LogParam(*p.render_pass_list[i], l);
751 } 767 }
752 l->append("])"); 768 l->append("])");
753 } 769 }
754 770
755 } // namespace IPC 771 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/cc_messages.h ('k') | content/common/cc_messages_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698