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

Side by Side Diff: Source/platform/graphics/filters/FEGaussianBlur.cpp

Issue 170453004: Add constant twoPiDouble/twoPiFloat to MathExtras.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add constant values to header Created 6 years, 10 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 | « Source/platform/graphics/Path.cpp ('k') | Source/platform/transforms/AffineTransform.cpp » ('j') | 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 (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) 2010 Igalia, S.L. 6 * Copyright (C) 2010 Igalia, S.L.
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * Copyright (C) 2013 Google Inc. All rights reserved. 8 * Copyright (C) 2013 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 23 matching lines...) Expand all
34 #include "platform/text/TextStream.h" 34 #include "platform/text/TextStream.h"
35 #include "wtf/MathExtras.h" 35 #include "wtf/MathExtras.h"
36 #include "wtf/Uint8ClampedArray.h" 36 #include "wtf/Uint8ClampedArray.h"
37 37
38 #include "SkBlurImageFilter.h" 38 #include "SkBlurImageFilter.h"
39 39
40 using namespace std; 40 using namespace std;
41 41
42 static inline float gaussianKernelFactor() 42 static inline float gaussianKernelFactor()
43 { 43 {
44 return 3 / 4.f * sqrtf(2 * piFloat); 44 return 3 / 4.f * sqrtf(twoPiFloat);
45 } 45 }
46 46
47 static const unsigned gMaxKernelSize = 1000; 47 static const unsigned gMaxKernelSize = 1000;
48 48
49 namespace WebCore { 49 namespace WebCore {
50 50
51 FEGaussianBlur::FEGaussianBlur(Filter* filter, float x, float y) 51 FEGaussianBlur::FEGaussianBlur(Filter* filter, float x, float y)
52 : FilterEffect(filter) 52 : FilterEffect(filter)
53 , m_stdX(x) 53 , m_stdX(x)
54 , m_stdY(y) 54 , m_stdY(y)
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 return ts; 362 return ts;
363 } 363 }
364 364
365 float FEGaussianBlur::calculateStdDeviation(float radius) 365 float FEGaussianBlur::calculateStdDeviation(float radius)
366 { 366 {
367 // Blur radius represents 2/3 times the kernel size, the dest pixel is half of the radius applied 3 times 367 // Blur radius represents 2/3 times the kernel size, the dest pixel is half of the radius applied 3 times
368 return max((radius * 2 / 3.f - 0.5f) / gaussianKernelFactor(), 0.f); 368 return max((radius * 2 / 3.f - 0.5f) / gaussianKernelFactor(), 0.f);
369 } 369 }
370 370
371 } // namespace WebCore 371 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/graphics/Path.cpp ('k') | Source/platform/transforms/AffineTransform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698