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

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

Issue 793873002: Don't cap the FEGaussian max kernel size. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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 | « no previous file | 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 (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 20 matching lines...) Expand all
31 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" 31 #include "platform/graphics/filters/SkiaImageFilterBuilder.h"
32 #include "platform/text/TextStream.h" 32 #include "platform/text/TextStream.h"
33 33
34 #include "SkBlurImageFilter.h" 34 #include "SkBlurImageFilter.h"
35 35
36 static inline float gaussianKernelFactor() 36 static inline float gaussianKernelFactor()
37 { 37 {
38 return 3 / 4.f * sqrtf(twoPiFloat); 38 return 3 / 4.f * sqrtf(twoPiFloat);
39 } 39 }
40 40
41 static const int gMaxKernelSize = 1000;
42
43 namespace blink { 41 namespace blink {
44 42
45 FEGaussianBlur::FEGaussianBlur(Filter* filter, float x, float y) 43 FEGaussianBlur::FEGaussianBlur(Filter* filter, float x, float y)
46 : FilterEffect(filter) 44 : FilterEffect(filter)
47 , m_stdX(x) 45 , m_stdX(x)
48 , m_stdY(y) 46 , m_stdY(y)
49 { 47 {
50 } 48 }
51 49
52 PassRefPtrWillBeRawPtr<FEGaussianBlur> FEGaussianBlur::create(Filter* filter, fl oat x, float y) 50 PassRefPtrWillBeRawPtr<FEGaussianBlur> FEGaussianBlur::create(Filter* filter, fl oat x, float y)
(...skipping 23 matching lines...) Expand all
76 74
77 IntSize FEGaussianBlur::calculateUnscaledKernelSize(const FloatPoint& std) 75 IntSize FEGaussianBlur::calculateUnscaledKernelSize(const FloatPoint& std)
78 { 76 {
79 ASSERT(std.x() >= 0 && std.y() >= 0); 77 ASSERT(std.x() >= 0 && std.y() >= 0);
80 78
81 IntSize kernelSize; 79 IntSize kernelSize;
82 // Limit the kernel size to 1000. A bigger radius won't make a big differenc e for the result image but 80 // Limit the kernel size to 1000. A bigger radius won't make a big differenc e for the result image but
83 // inflates the absolute paint rect to much. This is compatible with Firefox ' behavior. 81 // inflates the absolute paint rect to much. This is compatible with Firefox ' behavior.
84 if (std.x()) { 82 if (std.x()) {
85 int size = std::max<unsigned>(2, static_cast<unsigned>(floorf(std.x() * gaussianKernelFactor() + 0.5f))); 83 int size = std::max<unsigned>(2, static_cast<unsigned>(floorf(std.x() * gaussianKernelFactor() + 0.5f)));
86 kernelSize.setWidth(std::min(size, gMaxKernelSize)); 84 kernelSize.setWidth(size);
87 } 85 }
88 86
89 if (std.y()) { 87 if (std.y()) {
90 int size = std::max<unsigned>(2, static_cast<unsigned>(floorf(std.y() * gaussianKernelFactor() + 0.5f))); 88 int size = std::max<unsigned>(2, static_cast<unsigned>(floorf(std.y() * gaussianKernelFactor() + 0.5f)));
91 kernelSize.setHeight(std::min(size, gMaxKernelSize)); 89 kernelSize.setHeight(size);
92 } 90 }
93 91
94 return kernelSize; 92 return kernelSize;
95 } 93 }
96 94
97 IntSize FEGaussianBlur::calculateKernelSize(Filter* filter, const FloatPoint& st d) 95 IntSize FEGaussianBlur::calculateKernelSize(Filter* filter, const FloatPoint& st d)
98 { 96 {
99 FloatPoint stdError(filter->applyHorizontalScale(std.x()), filter->applyVert icalScale(std.y())); 97 FloatPoint stdError(filter->applyHorizontalScale(std.x()), filter->applyVert icalScale(std.y()));
100 98
101 return calculateUnscaledKernelSize(stdError); 99 return calculateUnscaledKernelSize(stdError);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 { 143 {
146 writeIndent(ts, indent); 144 writeIndent(ts, indent);
147 ts << "[feGaussianBlur"; 145 ts << "[feGaussianBlur";
148 FilterEffect::externalRepresentation(ts); 146 FilterEffect::externalRepresentation(ts);
149 ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\"]\n"; 147 ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\"]\n";
150 inputEffect(0)->externalRepresentation(ts, indent + 1); 148 inputEffect(0)->externalRepresentation(ts, indent + 1);
151 return ts; 149 return ts;
152 } 150 }
153 151
154 } // namespace blink 152 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698