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