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 
15 class SK_API SkMagnifierImageFilter : public SkImageFilter {
16 public:
17     static sk_sp<SkImageFilter> Make(const SkRect& srcRect, SkScalar inset,
18                                      sk_sp<SkImageFilter> input,
19                                      const CropRect* cropRect = nullptr);
20 
21 protected:
22     SkMagnifierImageFilter(const SkRect& srcRect,
23                            SkScalar inset,
24                            sk_sp<SkImageFilter> input,
25                            const CropRect* cropRect);
26     void flatten(SkWriteBuffer&) const override;
27 
28     sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
29                                         SkIPoint* offset) const override;
30     sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override;
31 
32 private:
33     SK_FLATTENABLE_HOOKS(SkMagnifierImageFilter)
34 
35     SkRect   fSrcRect;
36     SkScalar fInset;
37 
38     typedef SkImageFilter INHERITED;
39 };
40 
41 #endif
42