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

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

Issue 12816002: Make zoom filter independent of the layer size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « cc/render_surface_filters.cc ('k') | ui/compositor/layer.h » ('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 "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
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
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 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls.
57 int zoom_inset;
58 #endif
55 59
56 if (!ReadParam(m, iter, &type)) 60 if (!ReadParam(m, iter, &type))
57 return false; 61 return false;
58 r->setType(type); 62 r->setType(type);
59 63
60 bool success = false; 64 bool success = false;
61 switch (type) { 65 switch (type) {
62 case WebKit::WebFilterOperation::FilterTypeGrayscale: 66 case WebKit::WebFilterOperation::FilterTypeGrayscale:
63 case WebKit::WebFilterOperation::FilterTypeSepia: 67 case WebKit::WebFilterOperation::FilterTypeSepia:
64 case WebKit::WebFilterOperation::FilterTypeSaturate: 68 case WebKit::WebFilterOperation::FilterTypeSaturate:
(...skipping 25 matching lines...) Expand all
90 if (!ReadParam(m, iter, &matrix[i])) 94 if (!ReadParam(m, iter, &matrix[i]))
91 break; 95 break;
92 } 96 }
93 if (i == 20) { 97 if (i == 20) {
94 r->setMatrix(matrix); 98 r->setMatrix(matrix);
95 success = true; 99 success = true;
96 } 100 }
97 break; 101 break;
98 } 102 }
99 case WebKit::WebFilterOperation::FilterTypeZoom: 103 case WebKit::WebFilterOperation::FilterTypeZoom:
100 if (ReadParam(m, iter, &zoomRect) && 104 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls.
101 ReadParam(m, iter, &amount)) { 105 if (ReadParam(m, iter, &amount) &&
102 r->setZoomRect(zoomRect); 106 ReadParam(m, iter, &zoom_inset) &&
107 amount >= 0.f &&
108 zoom_inset >= 0) {
103 r->setAmount(amount); 109 r->setAmount(amount);
110 r->setZoomInset(zoom_inset);
104 success = true; 111 success = true;
105 } 112 }
113 #endif
106 break; 114 break;
107 } 115 }
108 return success; 116 return success;
109 } 117 }
110 118
111 void ParamTraits<WebKit::WebFilterOperation>::Log( 119 void ParamTraits<WebKit::WebFilterOperation>::Log(
112 const param_type& p, std::string* l) { 120 const param_type& p, std::string* l) {
113 l->append("("); 121 l->append("(");
114 LogParam(static_cast<unsigned>(p.type()), l); 122 LogParam(static_cast<unsigned>(p.type()), l);
115 l->append(", "); 123 l->append(", ");
(...skipping 19 matching lines...) Expand all
135 LogParam(p.dropShadowColor(), l); 143 LogParam(p.dropShadowColor(), l);
136 break; 144 break;
137 case WebKit::WebFilterOperation::FilterTypeColorMatrix: 145 case WebKit::WebFilterOperation::FilterTypeColorMatrix:
138 for (int i = 0; i < 20; ++i) { 146 for (int i = 0; i < 20; ++i) {
139 if (i) 147 if (i)
140 l->append(", "); 148 l->append(", ");
141 LogParam(p.matrix()[i], l); 149 LogParam(p.matrix()[i], l);
142 } 150 }
143 break; 151 break;
144 case WebKit::WebFilterOperation::FilterTypeZoom: 152 case WebKit::WebFilterOperation::FilterTypeZoom:
145 LogParam(p.zoomRect(), l); 153 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls.
154 LogParam(p.amount(), l);
146 l->append(", "); 155 l->append(", ");
147 LogParam(p.amount(), l); 156 LogParam(p.zoomInset(), l);
157 #endif
148 break; 158 break;
149 } 159 }
150 l->append(")"); 160 l->append(")");
151 } 161 }
152 162
153 void ParamTraits<WebKit::WebFilterOperations>::Write( 163 void ParamTraits<WebKit::WebFilterOperations>::Write(
154 Message* m, const param_type& p) { 164 Message* m, const param_type& p) {
155 WriteParam(m, p.size()); 165 WriteParam(m, p.size());
156 for (std::size_t i = 0; i < p.size(); ++i) { 166 for (std::size_t i = 0; i < p.size(); ++i) {
157 WriteParam(m, p.at(i)); 167 WriteParam(m, p.at(i));
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 l->append(", ["); 689 l->append(", [");
680 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { 690 for (size_t i = 0; i < p.render_pass_list.size(); ++i) {
681 if (i) 691 if (i)
682 l->append(", "); 692 l->append(", ");
683 LogParam(*p.render_pass_list[i], l); 693 LogParam(*p.render_pass_list[i], l);
684 } 694 }
685 l->append("])"); 695 l->append("])");
686 } 696 }
687 697
688 } // namespace IPC 698 } // namespace IPC
OLDNEW
« no previous file with comments | « cc/render_surface_filters.cc ('k') | ui/compositor/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698