OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
9 #include "sk_tool_utils_flags.h" | 9 #include "sk_tool_utils_flags.h" |
10 | 10 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 void make_big_path(SkPath& path) { | 348 void make_big_path(SkPath& path) { |
349 #include "BigPathBench.inc" | 349 #include "BigPathBench.inc" |
350 } | 350 } |
351 | 351 |
352 static float gaussian2d_value(int x, int y, float sigma) { | 352 static float gaussian2d_value(int x, int y, float sigma) { |
353 // don't bother with the scale term since we're just going to normalize the | 353 // don't bother with the scale term since we're just going to normalize the |
354 // kernel anyways | 354 // kernel anyways |
355 float temp = exp(-(x*x + y*y)/(2*sigma*sigma)); | 355 float temp = expf(-(x*x + y*y)/(2*sigma*sigma)); |
356 return temp; | 356 return temp; |
357 } | 357 } |
358 | 358 |
359 static float* create_2d_kernel(float sigma, int* filterSize) { | 359 static float* create_2d_kernel(float sigma, int* filterSize) { |
360 // We will actually take 2*halfFilterSize+1 samples (i.e., our filter kernel | 360 // We will actually take 2*halfFilterSize+1 samples (i.e., our filter kernel |
361 // sizes are always odd) | 361 // sizes are always odd) |
362 int halfFilterSize = SkScalarCeilToInt(6*sigma)/2; | 362 int halfFilterSize = SkScalarCeilToInt(6*sigma)/2; |
363 int wh = *filterSize = 2*halfFilterSize + 1; | 363 int wh = *filterSize = 2*halfFilterSize + 1; |
364 | 364 |
365 float* temp = new float[wh*wh]; | 365 float* temp = new float[wh*wh]; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 for (int y = 0; y < src.height(); ++y) { | 437 for (int y = 0; y < src.height(); ++y) { |
438 for (int x = 0; x < src.width(); ++x) { | 438 for (int x = 0; x < src.width(); ++x) { |
439 *dst.getAddr32(x, y) = blur_pixel(src, x, y, kernel.get(), wh); | 439 *dst.getAddr32(x, y) = blur_pixel(src, x, y, kernel.get(), wh); |
440 } | 440 } |
441 } | 441 } |
442 | 442 |
443 return dst; | 443 return dst; |
444 } | 444 } |
445 | 445 |
446 } // namespace sk_tool_utils | 446 } // namespace sk_tool_utils |
OLD | NEW |