• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "SkReadBuffer.h"
13 #include "SkString.h"
14 
15 /**
16  *  Wraps another imagefilter + matrix, such that using this filter will give the same result
17  *  as using the wrapped filter with the matrix applied to its context.
18  */
19 class SkLocalMatrixImageFilter : public SkImageFilter {
20 public:
21     static SkImageFilter* Create(const SkMatrix& localM, SkImageFilter* input);
22 
23     SK_TO_STRING_OVERRIDE()
24     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixImageFilter)
25 
26 protected:
27     void flatten(SkWriteBuffer&) const override;
28     bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&,
29                                  SkBitmap* result, SkIPoint* offset) const override;
30     bool onFilterBounds(const SkIRect& src, const SkMatrix&, SkIRect* dst,
31                         MapDirection) const override;
32 
33 private:
34     SkLocalMatrixImageFilter(const SkMatrix& localM, SkImageFilter* input);
35 
36     SkMatrix                    fLocalM;
37 
38     typedef SkImageFilter INHERITED;
39 };
40 
41 #endif
42