Home | History | Annotate | Download | only in effects
      1 /*
      2  * Copyright 2011 The Android Open Source Project
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef SkBlurImageFilter_DEFINED
      9 #define SkBlurImageFilter_DEFINED
     10 
     11 #include "SkImageFilter.h"
     12 #include "SkSize.h"
     13 
     14 class SK_API SkBlurImageFilter : public SkImageFilter {
     15 public:
     16     static SkBlurImageFilter* Create(SkScalar sigmaX,
     17                                      SkScalar sigmaY,
     18                                      SkImageFilter* input = NULL,
     19                                      const CropRect* cropRect = NULL, uint32_t uniqueID = 0) {
     20         return SkNEW_ARGS(SkBlurImageFilter, (sigmaX, sigmaY, input, cropRect, uniqueID));
     21     }
     22 
     23     virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
     24 
     25     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilter)
     26 
     27 protected:
     28     SkBlurImageFilter(SkScalar sigmaX,
     29                       SkScalar sigmaY,
     30                       SkImageFilter* input,
     31                       const CropRect* cropRect,
     32                       uint32_t uniqueID);
     33 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
     34     explicit SkBlurImageFilter(SkReadBuffer& buffer);
     35 #endif
     36     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
     37 
     38     virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
     39                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
     40     virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
     41                                 SkIRect* dst) const SK_OVERRIDE;
     42 
     43     bool canFilterImageGPU() const SK_OVERRIDE { return true; }
     44     virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
     45                                 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
     46 
     47 private:
     48     SkSize   fSigma;
     49     typedef SkImageFilter INHERITED;
     50 };
     51 
     52 #endif
     53