| OLD | NEW |
| (Empty) |
| 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 virtual ~SkResizeImageFilter(); | |
| 25 | |
| 26 /** Construct a (scaling-only) resampling image filter. | |
| 27 * @param sx The x scale parameter to apply when resizing. | |
| 28 * @param sy The y scale parameter to apply when resizing. | |
| 29 * @param filterLevel The quality of filtering to apply when scaling. | |
| 30 * @param input The input image filter. If NULL, the src bitmap | |
| 31 * passed to filterImage() is used instead. | |
| 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 } | |
| 37 | |
| 38 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; | |
| 39 | |
| 40 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkResizeImageFilter) | |
| 41 | |
| 42 protected: | |
| 43 SkResizeImageFilter(SkReadBuffer& buffer); | |
| 44 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | |
| 45 | |
| 46 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | |
| 47 SkBitmap* result, SkIPoint* loc) const SK_OVERRID
E; | |
| 48 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, | |
| 49 SkIRect* dst) const SK_OVERRIDE; | |
| 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 | |
| 57 private: | |
| 58 SkScalar fSx, fSy; | |
| 59 SkPaint::FilterLevel fFilterLevel; | |
| 60 typedef SkImageFilter INHERITED; | |
| 61 }; | |
| 62 | |
| 63 #endif | |
| OLD | NEW |