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 SK_TO_STRING_OVERRIDE() 22 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter) 23 24 protected: 25 SkMagnifierImageFilter(const SkRect& srcRect, 26 SkScalar inset, 27 sk_sp<SkImageFilter> input, 28 const CropRect* cropRect); 29 void flatten(SkWriteBuffer&) const override; 30 31 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, 32 SkIPoint* offset) const override; 33 sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override; 34 35 private: 36 SkRect fSrcRect; 37 SkScalar fInset; 38 39 typedef SkImageFilter INHERITED; 40 }; 41 42 #endif 43