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 #ifndef SkMergeImageFilter_DEFINED 9 #define SkMergeImageFilter_DEFINED 10 11 #include "SkImageFilter.h" 12 13 class SK_API SkMergeImageFilter : public SkImageFilter { 14 public: 15 static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter>* const filters, int count, 16 const CropRect* cropRect = nullptr); 17 18 static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter> first, sk_sp<SkImageFilter> second, 19 const CropRect* cropRect = nullptr) { 20 sk_sp<SkImageFilter> array[] = { 21 std::move(first), 22 std::move(second), 23 }; 24 return Make(array, 2, cropRect); 25 } 26 27 SK_TO_STRING_OVERRIDE() 28 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter) 29 30 protected: 31 void flatten(SkWriteBuffer&) const override; 32 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, 33 SkIPoint* offset) const override; 34 sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override; 35 bool onCanHandleComplexCTM() const override { return true; } 36 37 private: 38 SkMergeImageFilter(sk_sp<SkImageFilter>* const filters, int count, const CropRect* cropRect); 39 40 typedef SkImageFilter INHERITED; 41 }; 42 43 #endif 44