1 /* 2 * Copyright 2013 Google Inc. 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 SkComposeImageFilter_DEFINED 9 #define SkComposeImageFilter_DEFINED 10 11 #include "SkFlattenable.h" 12 #include "SkImageFilter.h" 13 14 class SK_API SkComposeImageFilter : public SkImageFilter { 15 public: 16 static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter> outer, sk_sp<SkImageFilter> inner); 17 18 SkRect computeFastBounds(const SkRect& src) const override; 19 20 protected: SkComposeImageFilter(sk_sp<SkImageFilter> inputs[2])21 explicit SkComposeImageFilter(sk_sp<SkImageFilter> inputs[2]) : INHERITED(inputs, 2, nullptr) { 22 SkASSERT(inputs[0].get()); 23 SkASSERT(inputs[1].get()); 24 } 25 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, 26 SkIPoint* offset) const override; 27 sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override; 28 SkIRect onFilterBounds(const SkIRect&, const SkMatrix& ctm, 29 MapDirection, const SkIRect* inputRect) const override; onCanHandleComplexCTM()30 bool onCanHandleComplexCTM() const override { return true; } 31 32 private: 33 SK_FLATTENABLE_HOOKS(SkComposeImageFilter) 34 35 typedef SkImageFilter INHERITED; 36 }; 37 38 #endif 39