1/*
2 * Copyright 2012 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
9#ifndef SkMagnifierImageFilter_DEFINED
10#define SkMagnifierImageFilter_DEFINED
11
12#include "SkRect.h"
13#include "SkImageFilter.h"
14
15class SK_API SkMagnifierImageFilter : public SkImageFilter {
16public:
17    static SkMagnifierImageFilter* Create(const SkRect& srcRect, SkScalar inset) {
18        return SkNEW_ARGS(SkMagnifierImageFilter, (srcRect, inset));
19    }
20
21    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter)
22
23protected:
24    SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset);
25    explicit SkMagnifierImageFilter(SkReadBuffer& buffer);
26    virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
27
28    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
29                               SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
30#if SK_SUPPORT_GPU
31    virtual bool asNewEffect(GrEffectRef** effect, GrTexture* texture, const SkMatrix& matrix, const SkIRect& bounds) const SK_OVERRIDE;
32#endif
33
34private:
35    SkRect fSrcRect;
36    SkScalar fInset;
37    typedef SkImageFilter INHERITED;
38};
39
40#endif
41