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

Side by Side Diff: tools/sk_tool_utils.cpp

Issue 1409993003: Misc: Don't run etc1 bench with invalid image and fix VS2015 build warning (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « bench/ETCBitmapBench.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « bench/ETCBitmapBench.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698