Line data Source code
1 : /*
2 : * Copyright 2015 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 SkLocalMatrixImageFilter_DEFINED
9 : #define SkLocalMatrixImageFilter_DEFINED
10 :
11 : #include "SkImageFilter.h"
12 :
13 : /**
14 : * Wraps another imagefilter + matrix, such that using this filter will give the same result
15 : * as using the wrapped filter with the matrix applied to its context.
16 : */
17 0 : class SkLocalMatrixImageFilter : public SkImageFilter {
18 : public:
19 : static sk_sp<SkImageFilter> Make(const SkMatrix& localM, sk_sp<SkImageFilter> input);
20 :
21 : SK_TO_STRING_OVERRIDE()
22 0 : SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixImageFilter)
23 :
24 : protected:
25 : void flatten(SkWriteBuffer&) const override;
26 : sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
27 : SkIPoint* offset) const override;
28 : SkIRect onFilterBounds(const SkIRect& src, const SkMatrix&, MapDirection) const override;
29 :
30 : private:
31 : SkLocalMatrixImageFilter(const SkMatrix& localM, sk_sp<SkImageFilter> input);
32 :
33 : SkMatrix fLocalM;
34 :
35 : typedef SkImageFilter INHERITED;
36 : };
37 :
38 : #endif
|