1/* 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2013 Google Inc. All rights reserved. 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Library General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Library General Public License for more details. 16 * 17 * You should have received a copy of the GNU Library General Public License 18 * along with this library; see the file COPYING.LIB. If not, write to 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * Boston, MA 02110-1301, USA. 21 */ 22 23#ifndef FEGaussianBlur_h 24#define FEGaussianBlur_h 25 26#include "platform/graphics/filters/Filter.h" 27#include "platform/graphics/filters/FilterEffect.h" 28 29namespace WebCore { 30 31class PLATFORM_EXPORT FEGaussianBlur : public FilterEffect { 32public: 33 static PassRefPtr<FEGaussianBlur> create(Filter*, float, float); 34 35 float stdDeviationX() const; 36 void setStdDeviationX(float); 37 38 float stdDeviationY() const; 39 void setStdDeviationY(float); 40 41 virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL; 42 virtual FloatRect determineAbsolutePaintRect(const FloatRect& requestedRect) OVERRIDE; 43 static IntSize calculateKernelSize(Filter*, const FloatPoint& std); 44 static IntSize calculateUnscaledKernelSize(const FloatPoint& std); 45 46 virtual TextStream& externalRepresentation(TextStream&, int indention) const OVERRIDE; 47 48private: 49 static const int s_minimalRectDimension = 100 * 100; // Empirical data limit for parallel jobs 50 51 template<typename Type> 52 friend class ParallelJobs; 53 54 struct PlatformApplyParameters { 55 FEGaussianBlur* filter; 56 RefPtr<Uint8ClampedArray> srcPixelArray; 57 RefPtr<Uint8ClampedArray> dstPixelArray; 58 int width; 59 int height; 60 unsigned kernelSizeX; 61 unsigned kernelSizeY; 62 }; 63 64 FEGaussianBlur(Filter*, float, float); 65 66 virtual void applySoftware() OVERRIDE; 67 68 virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) OVERRIDE; 69 70 float m_stdX; 71 float m_stdY; 72}; 73 74} // namespace WebCore 75 76#endif // FEGaussianBlur_h 77