OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/basictypes.h" | |
8 #include "base/logging.h" | |
9 #include "skia/ext/convolver.h" | 7 #include "skia/ext/convolver.h" |
| 8 #include "SkTypes.h" |
10 | 9 |
11 namespace gfx { | 10 namespace skia { |
12 | 11 |
13 namespace { | 12 namespace { |
14 | 13 |
15 // Converts the argument to an 8-bit unsigned value by clamping to the range | 14 // Converts the argument to an 8-bit unsigned value by clamping to the range |
16 // 0-255. | 15 // 0-255. |
17 inline uint8 ClampTo8(int32 a) { | 16 inline unsigned char ClampTo8(int a) { |
18 if (static_cast<uint32>(a) < 256) | 17 if (static_cast<unsigned>(a) < 256) |
19 return a; // Avoid the extra check in the common case. | 18 return a; // Avoid the extra check in the common case. |
20 if (a < 0) | 19 if (a < 0) |
21 return 0; | 20 return 0; |
22 return 255; | 21 return 255; |
23 } | 22 } |
24 | 23 |
25 // Stores a list of rows in a circular buffer. The usage is you write into it | 24 // Stores a list of rows in a circular buffer. The usage is you write into it |
26 // by calling AdvanceRow. It will keep track of which row in the buffer it | 25 // by calling AdvanceRow. It will keep track of which row in the buffer it |
27 // should use next, and the total number of rows added. | 26 // should use next, and the total number of rows added. |
28 class CircularRowBuffer { | 27 class CircularRowBuffer { |
29 public: | 28 public: |
30 // The number of pixels in each row is given in |source_row_pixel_width|. | 29 // The number of pixels in each row is given in |source_row_pixel_width|. |
31 // The maximum number of rows needed in the buffer is |max_y_filter_size| | 30 // The maximum number of rows needed in the buffer is |max_y_filter_size| |
32 // (we only need to store enough rows for the biggest filter). | 31 // (we only need to store enough rows for the biggest filter). |
33 // | 32 // |
34 // We use the |first_input_row| to compute the coordinates of all of the | 33 // We use the |first_input_row| to compute the coordinates of all of the |
35 // following rows returned by Advance(). | 34 // following rows returned by Advance(). |
36 CircularRowBuffer(int dest_row_pixel_width, int max_y_filter_size, | 35 CircularRowBuffer(int dest_row_pixel_width, int max_y_filter_size, |
37 int first_input_row) | 36 int first_input_row) |
38 : row_byte_width_(dest_row_pixel_width * 4), | 37 : row_byte_width_(dest_row_pixel_width * 4), |
39 num_rows_(max_y_filter_size), | 38 num_rows_(max_y_filter_size), |
40 next_row_(0), | 39 next_row_(0), |
41 next_row_coordinate_(first_input_row) { | 40 next_row_coordinate_(first_input_row) { |
42 buffer_.resize(row_byte_width_ * max_y_filter_size); | 41 buffer_.resize(row_byte_width_ * max_y_filter_size); |
43 row_addresses_.resize(num_rows_); | 42 row_addresses_.resize(num_rows_); |
44 } | 43 } |
45 | 44 |
46 // Moves to the next row in the buffer, returning a pointer to the beginning | 45 // Moves to the next row in the buffer, returning a pointer to the beginning |
47 // of it. | 46 // of it. |
48 uint8* AdvanceRow() { | 47 unsigned char* AdvanceRow() { |
49 uint8* row = &buffer_[next_row_ * row_byte_width_]; | 48 unsigned char* row = &buffer_[next_row_ * row_byte_width_]; |
50 next_row_coordinate_++; | 49 next_row_coordinate_++; |
51 | 50 |
52 // Set the pointer to the next row to use, wrapping around if necessary. | 51 // Set the pointer to the next row to use, wrapping around if necessary. |
53 next_row_++; | 52 next_row_++; |
54 if (next_row_ == num_rows_) | 53 if (next_row_ == num_rows_) |
55 next_row_ = 0; | 54 next_row_ = 0; |
56 return row; | 55 return row; |
57 } | 56 } |
58 | 57 |
59 // Returns a pointer to an "unrolled" array of rows. These rows will start | 58 // Returns a pointer to an "unrolled" array of rows. These rows will start |
60 // at the y coordinate placed into |*first_row_index| and will continue in | 59 // at the y coordinate placed into |*first_row_index| and will continue in |
61 // order for the maximum number of rows in this circular buffer. | 60 // order for the maximum number of rows in this circular buffer. |
62 // | 61 // |
63 // The |first_row_index_| may be negative. This means the circular buffer | 62 // The |first_row_index_| may be negative. This means the circular buffer |
64 // starts before the top of the image (it hasn't been filled yet). | 63 // starts before the top of the image (it hasn't been filled yet). |
65 uint8* const* GetRowAddresses(int* first_row_index) { | 64 unsigned char* const* GetRowAddresses(int* first_row_index) { |
66 // Example for a 4-element circular buffer holding coords 6-9. | 65 // Example for a 4-element circular buffer holding coords 6-9. |
67 // Row 0 Coord 8 | 66 // Row 0 Coord 8 |
68 // Row 1 Coord 9 | 67 // Row 1 Coord 9 |
69 // Row 2 Coord 6 <- next_row_ = 2, next_row_coordinate_ = 10. | 68 // Row 2 Coord 6 <- next_row_ = 2, next_row_coordinate_ = 10. |
70 // Row 3 Coord 7 | 69 // Row 3 Coord 7 |
71 // | 70 // |
72 // The "next" row is also the first (lowest) coordinate. This computation | 71 // The "next" row is also the first (lowest) coordinate. This computation |
73 // may yield a negative value, but that's OK, the math will work out | 72 // may yield a negative value, but that's OK, the math will work out |
74 // since the user of this buffer will compute the offset relative | 73 // since the user of this buffer will compute the offset relative |
75 // to the first_row_index and the negative rows will never be used. | 74 // to the first_row_index and the negative rows will never be used. |
76 *first_row_index = next_row_coordinate_ - num_rows_; | 75 *first_row_index = next_row_coordinate_ - num_rows_; |
77 | 76 |
78 int cur_row = next_row_; | 77 int cur_row = next_row_; |
79 for (int i = 0; i < num_rows_; i++) { | 78 for (int i = 0; i < num_rows_; i++) { |
80 row_addresses_[i] = &buffer_[cur_row * row_byte_width_]; | 79 row_addresses_[i] = &buffer_[cur_row * row_byte_width_]; |
81 | 80 |
82 // Advance to the next row, wrapping if necessary. | 81 // Advance to the next row, wrapping if necessary. |
83 cur_row++; | 82 cur_row++; |
84 if (cur_row == num_rows_) | 83 if (cur_row == num_rows_) |
85 cur_row = 0; | 84 cur_row = 0; |
86 } | 85 } |
87 return &row_addresses_[0]; | 86 return &row_addresses_[0]; |
88 } | 87 } |
89 | 88 |
90 private: | 89 private: |
91 // The buffer storing the rows. They are packed, each one row_byte_width_. | 90 // The buffer storing the rows. They are packed, each one row_byte_width_. |
92 std::vector<uint8> buffer_; | 91 std::vector<unsigned char> buffer_; |
93 | 92 |
94 // Number of bytes per row in the |buffer_|. | 93 // Number of bytes per row in the |buffer_|. |
95 int row_byte_width_; | 94 int row_byte_width_; |
96 | 95 |
97 // The number of rows available in the buffer. | 96 // The number of rows available in the buffer. |
98 int num_rows_; | 97 int num_rows_; |
99 | 98 |
100 // The next row index we should write into. This wraps around as the | 99 // The next row index we should write into. This wraps around as the |
101 // circular buffer is used. | 100 // circular buffer is used. |
102 int next_row_; | 101 int next_row_; |
103 | 102 |
104 // The y coordinate of the |next_row_|. This is incremented each time a | 103 // The y coordinate of the |next_row_|. This is incremented each time a |
105 // new row is appended and does not wrap. | 104 // new row is appended and does not wrap. |
106 int next_row_coordinate_; | 105 int next_row_coordinate_; |
107 | 106 |
108 // Buffer used by GetRowAddresses(). | 107 // Buffer used by GetRowAddresses(). |
109 std::vector<uint8*> row_addresses_; | 108 std::vector<unsigned char*> row_addresses_; |
110 }; | 109 }; |
111 | 110 |
112 // Convolves horizontally along a single row. The row data is given in | 111 // Convolves horizontally along a single row. The row data is given in |
113 // |src_data| and continues for the num_values() of the filter. | 112 // |src_data| and continues for the num_values() of the filter. |
114 template<bool has_alpha> | 113 template<bool has_alpha> |
115 void ConvolveHorizontally(const uint8* src_data, | 114 void ConvolveHorizontally(const unsigned char* src_data, |
116 const ConvolusionFilter1D& filter, | 115 const ConvolusionFilter1D& filter, |
117 unsigned char* out_row) { | 116 unsigned char* out_row) { |
118 // Loop over each pixel on this row in the output image. | 117 // Loop over each pixel on this row in the output image. |
119 int num_values = filter.num_values(); | 118 int num_values = filter.num_values(); |
120 for (int out_x = 0; out_x < num_values; out_x++) { | 119 for (int out_x = 0; out_x < num_values; out_x++) { |
121 // Get the filter that determines the current output pixel. | 120 // Get the filter that determines the current output pixel. |
122 int filter_offset, filter_length; | 121 int filter_offset, filter_length; |
123 const int16* filter_values = | 122 const ConvolusionFilter1D::Fixed* filter_values = |
124 filter.FilterForValue(out_x, &filter_offset, &filter_length); | 123 filter.FilterForValue(out_x, &filter_offset, &filter_length); |
125 | 124 |
126 // Compute the first pixel in this row that the filter affects. It will | 125 // Compute the first pixel in this row that the filter affects. It will |
127 // touch |filter_length| pixels (4 bytes each) after this. | 126 // touch |filter_length| pixels (4 bytes each) after this. |
128 const uint8* row_to_filter = &src_data[filter_offset * 4]; | 127 const unsigned char* row_to_filter = &src_data[filter_offset * 4]; |
129 | 128 |
130 // Apply the filter to the row to get the destination pixel in |accum|. | 129 // Apply the filter to the row to get the destination pixel in |accum|. |
131 int32 accum[4] = {0}; | 130 int32 accum[4] = {0}; |
132 for (int filter_x = 0; filter_x < filter_length; filter_x++) { | 131 for (int filter_x = 0; filter_x < filter_length; filter_x++) { |
133 int16 cur_filter = filter_values[filter_x]; | 132 ConvolusionFilter1D::Fixed cur_filter = filter_values[filter_x]; |
134 accum[0] += cur_filter * row_to_filter[filter_x * 4 + 0]; | 133 accum[0] += cur_filter * row_to_filter[filter_x * 4 + 0]; |
135 accum[1] += cur_filter * row_to_filter[filter_x * 4 + 1]; | 134 accum[1] += cur_filter * row_to_filter[filter_x * 4 + 1]; |
136 accum[2] += cur_filter * row_to_filter[filter_x * 4 + 2]; | 135 accum[2] += cur_filter * row_to_filter[filter_x * 4 + 2]; |
137 if (has_alpha) | 136 if (has_alpha) |
138 accum[3] += cur_filter * row_to_filter[filter_x * 4 + 3]; | 137 accum[3] += cur_filter * row_to_filter[filter_x * 4 + 3]; |
139 } | 138 } |
140 | 139 |
141 // Bring this value back in range. All of the filter scaling factors | 140 // Bring this value back in range. All of the filter scaling factors |
142 // are in fixed point with kShiftBits bits of fractional part. | 141 // are in fixed point with kShiftBits bits of fractional part. |
143 accum[0] >>= ConvolusionFilter1D::kShiftBits; | 142 accum[0] >>= ConvolusionFilter1D::kShiftBits; |
(...skipping 11 matching lines...) Expand all Loading... |
155 } | 154 } |
156 } | 155 } |
157 | 156 |
158 // Does vertical convolusion to produce one output row. The filter values and | 157 // Does vertical convolusion to produce one output row. The filter values and |
159 // length are given in the first two parameters. These are applied to each | 158 // length are given in the first two parameters. These are applied to each |
160 // of the rows pointed to in the |source_data_rows| array, with each row | 159 // of the rows pointed to in the |source_data_rows| array, with each row |
161 // being |pixel_width| wide. | 160 // being |pixel_width| wide. |
162 // | 161 // |
163 // The output must have room for |pixel_width * 4| bytes. | 162 // The output must have room for |pixel_width * 4| bytes. |
164 template<bool has_alpha> | 163 template<bool has_alpha> |
165 void ConvolveVertically(const int16* filter_values, | 164 void ConvolveVertically(const ConvolusionFilter1D::Fixed* filter_values, |
166 int filter_length, | 165 int filter_length, |
167 uint8* const* source_data_rows, | 166 unsigned char* const* source_data_rows, |
168 int pixel_width, | 167 int pixel_width, |
169 uint8* out_row) { | 168 unsigned char* out_row) { |
170 // We go through each column in the output and do a vertical convolusion, | 169 // We go through each column in the output and do a vertical convolusion, |
171 // generating one output pixel each time. | 170 // generating one output pixel each time. |
172 for (int out_x = 0; out_x < pixel_width; out_x++) { | 171 for (int out_x = 0; out_x < pixel_width; out_x++) { |
173 // Compute the number of bytes over in each row that the current column | 172 // Compute the number of bytes over in each row that the current column |
174 // we're convolving starts at. The pixel will cover the next 4 bytes. | 173 // we're convolving starts at. The pixel will cover the next 4 bytes. |
175 int byte_offset = out_x * 4; | 174 int byte_offset = out_x * 4; |
176 | 175 |
177 // Apply the filter to one column of pixels. | 176 // Apply the filter to one column of pixels. |
178 int32 accum[4] = {0}; | 177 int32 accum[4] = {0}; |
179 for (int filter_y = 0; filter_y < filter_length; filter_y++) { | 178 for (int filter_y = 0; filter_y < filter_length; filter_y++) { |
180 int16 cur_filter = filter_values[filter_y]; | 179 ConvolusionFilter1D::Fixed cur_filter = filter_values[filter_y]; |
181 accum[0] += cur_filter * source_data_rows[filter_y][byte_offset + 0]; | 180 accum[0] += cur_filter * source_data_rows[filter_y][byte_offset + 0]; |
182 accum[1] += cur_filter * source_data_rows[filter_y][byte_offset + 1]; | 181 accum[1] += cur_filter * source_data_rows[filter_y][byte_offset + 1]; |
183 accum[2] += cur_filter * source_data_rows[filter_y][byte_offset + 2]; | 182 accum[2] += cur_filter * source_data_rows[filter_y][byte_offset + 2]; |
184 if (has_alpha) | 183 if (has_alpha) |
185 accum[3] += cur_filter * source_data_rows[filter_y][byte_offset + 3]; | 184 accum[3] += cur_filter * source_data_rows[filter_y][byte_offset + 3]; |
186 } | 185 } |
187 | 186 |
188 // Bring this value back in range. All of the filter scaling factors | 187 // Bring this value back in range. All of the filter scaling factors |
189 // are in fixed point with kShiftBits bits of precision. | 188 // are in fixed point with kShiftBits bits of precision. |
190 accum[0] >>= ConvolusionFilter1D::kShiftBits; | 189 accum[0] >>= ConvolusionFilter1D::kShiftBits; |
191 accum[1] >>= ConvolusionFilter1D::kShiftBits; | 190 accum[1] >>= ConvolusionFilter1D::kShiftBits; |
192 accum[2] >>= ConvolusionFilter1D::kShiftBits; | 191 accum[2] >>= ConvolusionFilter1D::kShiftBits; |
193 if (has_alpha) | 192 if (has_alpha) |
194 accum[3] >>= ConvolusionFilter1D::kShiftBits; | 193 accum[3] >>= ConvolusionFilter1D::kShiftBits; |
195 | 194 |
196 // Store the new pixel. | 195 // Store the new pixel. |
197 out_row[byte_offset + 0] = ClampTo8(accum[0]); | 196 out_row[byte_offset + 0] = ClampTo8(accum[0]); |
198 out_row[byte_offset + 1] = ClampTo8(accum[1]); | 197 out_row[byte_offset + 1] = ClampTo8(accum[1]); |
199 out_row[byte_offset + 2] = ClampTo8(accum[2]); | 198 out_row[byte_offset + 2] = ClampTo8(accum[2]); |
200 if (has_alpha) { | 199 if (has_alpha) { |
201 uint8 alpha = ClampTo8(accum[3]); | 200 unsigned char alpha = ClampTo8(accum[3]); |
202 | 201 |
203 // Make sure the alpha channel doesn't come out larger than any of the | 202 // Make sure the alpha channel doesn't come out larger than any of the |
204 // color channels. We use premultipled alpha channels, so this should | 203 // color channels. We use premultipled alpha channels, so this should |
205 // never happen, but rounding errors will cause this from time to time. | 204 // never happen, but rounding errors will cause this from time to time. |
206 // These "impossible" colors will cause overflows (and hence random pixel | 205 // These "impossible" colors will cause overflows (and hence random pixel |
207 // values) when the resulting bitmap is drawn to the screen. | 206 // values) when the resulting bitmap is drawn to the screen. |
208 // | 207 // |
209 // We only need to do this when generating the final output row (here). | 208 // We only need to do this when generating the final output row (here). |
210 int max_color_channel = std::max(out_row[byte_offset + 0], | 209 int max_color_channel = std::max(out_row[byte_offset + 0], |
211 std::max(out_row[byte_offset + 1], out_row[byte_offset + 2])); | 210 std::max(out_row[byte_offset + 1], out_row[byte_offset + 2])); |
(...skipping 14 matching lines...) Expand all Loading... |
226 | 225 |
227 void ConvolusionFilter1D::AddFilter(int filter_offset, | 226 void ConvolusionFilter1D::AddFilter(int filter_offset, |
228 const float* filter_values, | 227 const float* filter_values, |
229 int filter_length) { | 228 int filter_length) { |
230 FilterInstance instance; | 229 FilterInstance instance; |
231 instance.data_location = static_cast<int>(filter_values_.size()); | 230 instance.data_location = static_cast<int>(filter_values_.size()); |
232 instance.offset = filter_offset; | 231 instance.offset = filter_offset; |
233 instance.length = filter_length; | 232 instance.length = filter_length; |
234 filters_.push_back(instance); | 233 filters_.push_back(instance); |
235 | 234 |
236 DCHECK(filter_length > 0); | 235 SkASSERT(filter_length > 0); |
237 for (int i = 0; i < filter_length; i++) | 236 for (int i = 0; i < filter_length; i++) |
238 filter_values_.push_back(FloatToFixed(filter_values[i])); | 237 filter_values_.push_back(FloatToFixed(filter_values[i])); |
239 | 238 |
240 max_filter_ = std::max(max_filter_, filter_length); | 239 max_filter_ = std::max(max_filter_, filter_length); |
241 } | 240 } |
242 | 241 |
243 void ConvolusionFilter1D::AddFilter(int filter_offset, | 242 void ConvolusionFilter1D::AddFilter(int filter_offset, |
244 const int16* filter_values, | 243 const Fixed* filter_values, |
245 int filter_length) { | 244 int filter_length) { |
246 FilterInstance instance; | 245 FilterInstance instance; |
247 instance.data_location = static_cast<int>(filter_values_.size()); | 246 instance.data_location = static_cast<int>(filter_values_.size()); |
248 instance.offset = filter_offset; | 247 instance.offset = filter_offset; |
249 instance.length = filter_length; | 248 instance.length = filter_length; |
250 filters_.push_back(instance); | 249 filters_.push_back(instance); |
251 | 250 |
252 DCHECK(filter_length > 0); | 251 SkASSERT(filter_length > 0); |
253 for (int i = 0; i < filter_length; i++) | 252 for (int i = 0; i < filter_length; i++) |
254 filter_values_.push_back(filter_values[i]); | 253 filter_values_.push_back(filter_values[i]); |
255 | 254 |
256 max_filter_ = std::max(max_filter_, filter_length); | 255 max_filter_ = std::max(max_filter_, filter_length); |
257 } | 256 } |
258 | 257 |
259 // BGRAConvolve2D ------------------------------------------------------------- | 258 // BGRAConvolve2D ------------------------------------------------------------- |
260 | 259 |
261 void BGRAConvolve2D(const uint8* source_data, | 260 void BGRAConvolve2D(const unsigned char* source_data, |
262 int source_byte_row_stride, | 261 int source_byte_row_stride, |
263 bool source_has_alpha, | 262 bool source_has_alpha, |
264 const ConvolusionFilter1D& filter_x, | 263 const ConvolusionFilter1D& filter_x, |
265 const ConvolusionFilter1D& filter_y, | 264 const ConvolusionFilter1D& filter_y, |
266 uint8* output) { | 265 unsigned char* output) { |
267 int max_y_filter_size = filter_y.max_filter(); | 266 int max_y_filter_size = filter_y.max_filter(); |
268 | 267 |
269 // The next row in the input that we will generate a horizontally | 268 // The next row in the input that we will generate a horizontally |
270 // convolved row for. If the filter doesn't start at the beginning of the | 269 // convolved row for. If the filter doesn't start at the beginning of the |
271 // image (this is the case when we are only resizing a subset), then we | 270 // image (this is the case when we are only resizing a subset), then we |
272 // don't want to generate any output rows before that. Compute the starting | 271 // don't want to generate any output rows before that. Compute the starting |
273 // row for convolusion as the first pixel for the first vertical filter. | 272 // row for convolusion as the first pixel for the first vertical filter. |
274 int filter_offset, filter_length; | 273 int filter_offset, filter_length; |
275 const int16* filter_values = | 274 const ConvolusionFilter1D::Fixed* filter_values = |
276 filter_y.FilterForValue(0, &filter_offset, &filter_length); | 275 filter_y.FilterForValue(0, &filter_offset, &filter_length); |
277 int next_x_row = filter_offset; | 276 int next_x_row = filter_offset; |
278 | 277 |
279 // We loop over each row in the input doing a horizontal convolusion. This | 278 // We loop over each row in the input doing a horizontal convolusion. This |
280 // will result in a horizontally convolved image. We write the results into | 279 // will result in a horizontally convolved image. We write the results into |
281 // a circular buffer of convolved rows and do vertical convolusion as rows | 280 // a circular buffer of convolved rows and do vertical convolusion as rows |
282 // are available. This prevents us from having to store the entire | 281 // are available. This prevents us from having to store the entire |
283 // intermediate image and helps cache coherency. | 282 // intermediate image and helps cache coherency. |
284 CircularRowBuffer row_buffer(filter_x.num_values(), max_y_filter_size, | 283 CircularRowBuffer row_buffer(filter_x.num_values(), max_y_filter_size, |
285 filter_offset); | 284 filter_offset); |
(...skipping 14 matching lines...) Expand all Loading... |
300 filter_x, row_buffer.AdvanceRow()); | 299 filter_x, row_buffer.AdvanceRow()); |
301 } else { | 300 } else { |
302 ConvolveHorizontally<false>( | 301 ConvolveHorizontally<false>( |
303 &source_data[next_x_row * source_byte_row_stride], | 302 &source_data[next_x_row * source_byte_row_stride], |
304 filter_x, row_buffer.AdvanceRow()); | 303 filter_x, row_buffer.AdvanceRow()); |
305 } | 304 } |
306 next_x_row++; | 305 next_x_row++; |
307 } | 306 } |
308 | 307 |
309 // Compute where in the output image this row of final data will go. | 308 // Compute where in the output image this row of final data will go. |
310 uint8* cur_output_row = &output[out_y * output_row_byte_width]; | 309 unsigned char* cur_output_row = &output[out_y * output_row_byte_width]; |
311 | 310 |
312 // Get the list of rows that the circular buffer has, in order. | 311 // Get the list of rows that the circular buffer has, in order. |
313 int first_row_in_circular_buffer; | 312 int first_row_in_circular_buffer; |
314 uint8* const* rows_to_convolve = | 313 unsigned char* const* rows_to_convolve = |
315 row_buffer.GetRowAddresses(&first_row_in_circular_buffer); | 314 row_buffer.GetRowAddresses(&first_row_in_circular_buffer); |
316 | 315 |
317 // Now compute the start of the subset of those rows that the filter | 316 // Now compute the start of the subset of those rows that the filter |
318 // needs. | 317 // needs. |
319 uint8* const* first_row_for_filter = | 318 unsigned char* const* first_row_for_filter = |
320 &rows_to_convolve[filter_offset - first_row_in_circular_buffer]; | 319 &rows_to_convolve[filter_offset - first_row_in_circular_buffer]; |
321 | 320 |
322 if (source_has_alpha) { | 321 if (source_has_alpha) { |
323 ConvolveVertically<true>(filter_values, filter_length, | 322 ConvolveVertically<true>(filter_values, filter_length, |
324 first_row_for_filter, | 323 first_row_for_filter, |
325 filter_x.num_values(), cur_output_row); | 324 filter_x.num_values(), cur_output_row); |
326 } else { | 325 } else { |
327 ConvolveVertically<false>(filter_values, filter_length, | 326 ConvolveVertically<false>(filter_values, filter_length, |
328 first_row_for_filter, | 327 first_row_for_filter, |
329 filter_x.num_values(), cur_output_row); | 328 filter_x.num_values(), cur_output_row); |
330 } | 329 } |
331 } | 330 } |
332 } | 331 } |
333 | 332 |
334 } // namespace gfx | 333 } // namespace skia |
335 | 334 |
OLD | NEW |