Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / include / effects / SkResizeImageFilter.h
1 /*
2  * Copyright 2013 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 SkResizeImageFilter_DEFINED
9 #define SkResizeImageFilter_DEFINED
10
11 #include "SkImageFilter.h"
12 #include "SkScalar.h"
13 #include "SkRect.h"
14 #include "SkPoint.h"
15 #include "SkPaint.h"
16
17 /*! \class SkResizeImageFilter
18     Resampling image filter. This filter draws its source image resampled using the given scale
19     values.
20  */
21
22 class SK_API SkResizeImageFilter : public SkImageFilter {
23 public:
24     /** Construct a (scaling-only) resampling image filter.
25      *  @param sx           The x scale parameter to apply when resizing.
26      *  @param sy           The y scale parameter to apply when resizing.
27      *  @param filterLevel  The quality of filtering to apply when scaling.
28      *  @param input        The input image filter.  If NULL, the src bitmap
29      *                      passed to filterImage() is used instead.
30      */
31
32     SkResizeImageFilter(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLevel,
33                         SkImageFilter* input = NULL);
34     virtual ~SkResizeImageFilter();
35
36     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkResizeImageFilter)
37
38 protected:
39     SkResizeImageFilter(SkReadBuffer& buffer);
40     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
41
42     virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
43                                SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
44
45 private:
46     SkScalar              fSx, fSy;
47     SkPaint::FilterLevel  fFilterLevel;
48     typedef SkImageFilter INHERITED;
49 };
50
51 #endif