| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkResizeImageFilter_DEFINED | 8 #ifndef SkResizeImageFilter_DEFINED |
| 9 #define SkResizeImageFilter_DEFINED | 9 #define SkResizeImageFilter_DEFINED |
| 10 | 10 |
| 11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
| 12 #include "SkScalar.h" | 12 #include "SkScalar.h" |
| 13 #include "SkRect.h" | 13 #include "SkRect.h" |
| 14 #include "SkPoint.h" | 14 #include "SkPoint.h" |
| 15 #include "SkPaint.h" | 15 #include "SkPaint.h" |
| 16 | 16 |
| 17 /*! \class SkResizeImageFilter | 17 /*! \class SkResizeImageFilter |
| 18 Resampling image filter. This filter draws its source image resampled using
the given scale | 18 Resampling image filter. This filter draws its source image resampled using
the given scale |
| 19 values. | 19 values. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 class SK_API SkResizeImageFilter : public SkImageFilter { | 22 class SK_API SkResizeImageFilter : public SkImageFilter { |
| 23 public: | 23 public: |
| 24 virtual ~SkResizeImageFilter(); |
| 25 |
| 24 /** Construct a (scaling-only) resampling image filter. | 26 /** Construct a (scaling-only) resampling image filter. |
| 25 * @param sx The x scale parameter to apply when resizing. | 27 * @param sx The x scale parameter to apply when resizing. |
| 26 * @param sy The y scale parameter to apply when resizing. | 28 * @param sy The y scale parameter to apply when resizing. |
| 27 * @param filterLevel The quality of filtering to apply when scaling. | 29 * @param filterLevel The quality of filtering to apply when scaling. |
| 28 * @param input The input image filter. If NULL, the src bitmap | 30 * @param input The input image filter. If NULL, the src bitmap |
| 29 * passed to filterImage() is used instead. | 31 * passed to filterImage() is used instead. |
| 30 */ | 32 */ |
| 33 static SkResizeImageFilter* Create(SkScalar sx, SkScalar sy, SkPaint::Filter
Level filterLevel, |
| 34 SkImageFilter* input = NULL) { |
| 35 return SkNEW_ARGS(SkResizeImageFilter, (sx, sy, filterLevel, input)); |
| 36 } |
| 31 | 37 |
| 32 SkResizeImageFilter(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLev
el, | |
| 33 SkImageFilter* input = NULL); | |
| 34 virtual ~SkResizeImageFilter(); | |
| 35 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; | 38 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; |
| 36 | 39 |
| 37 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkResizeImageFilter) | 40 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkResizeImageFilter) |
| 38 | 41 |
| 39 protected: | 42 protected: |
| 40 SkResizeImageFilter(SkReadBuffer& buffer); | 43 SkResizeImageFilter(SkReadBuffer& buffer); |
| 41 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 44 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 42 | 45 |
| 43 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 46 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
| 44 SkBitmap* result, SkIPoint* loc) const SK_OVERRID
E; | 47 SkBitmap* result, SkIPoint* loc) const SK_OVERRID
E; |
| 45 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, | 48 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, |
| 46 SkIRect* dst) const SK_OVERRIDE; | 49 SkIRect* dst) const SK_OVERRIDE; |
| 47 | 50 |
| 51 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS |
| 52 public: |
| 53 #endif |
| 54 SkResizeImageFilter(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLev
el, |
| 55 SkImageFilter* input = NULL); |
| 56 |
| 48 private: | 57 private: |
| 49 SkScalar fSx, fSy; | 58 SkScalar fSx, fSy; |
| 50 SkPaint::FilterLevel fFilterLevel; | 59 SkPaint::FilterLevel fFilterLevel; |
| 51 typedef SkImageFilter INHERITED; | 60 typedef SkImageFilter INHERITED; |
| 52 }; | 61 }; |
| 53 | 62 |
| 54 #endif | 63 #endif |
| OLD | NEW |