Index: include/effects/SkMatrixImageFilter.h |
diff --git a/include/effects/SkResizeImageFilter.h b/include/effects/SkMatrixImageFilter.h |
similarity index 51% |
copy from include/effects/SkResizeImageFilter.h |
copy to include/effects/SkMatrixImageFilter.h |
index fb55eea42c298b09571f0e74703071f4d3d6f500..004c6ef9ed00bf9480b5d3fafd380702f0d40ccb 100644 |
--- a/include/effects/SkResizeImageFilter.h |
+++ b/include/effects/SkMatrixImageFilter.h |
@@ -1,46 +1,47 @@ |
/* |
- * Copyright 2013 The Android Open Source Project |
+ * Copyright 2014 The Android Open Source Project |
* |
* Use of this source code is governed by a BSD-style license that can be |
* found in the LICENSE file. |
*/ |
-#ifndef SkResizeImageFilter_DEFINED |
-#define SkResizeImageFilter_DEFINED |
+#ifndef SkMatrixImageFilter_DEFINED |
+#define SkMatrixImageFilter_DEFINED |
#include "SkImageFilter.h" |
#include "SkScalar.h" |
-#include "SkRect.h" |
+#include "SkSize.h" |
#include "SkPoint.h" |
#include "SkPaint.h" |
-/*! \class SkResizeImageFilter |
- Resampling image filter. This filter draws its source image resampled using the given scale |
- values. |
+/*! \class SkMatrixImageFilter |
+ Matrix transformation image filter. This filter draws its source |
+ input transformed by the given matrix. |
*/ |
-class SK_API SkResizeImageFilter : public SkImageFilter { |
+class SK_API SkMatrixImageFilter : public SkImageFilter { |
public: |
- virtual ~SkResizeImageFilter(); |
- |
- /** Construct a (scaling-only) resampling image filter. |
- * @param sx The x scale parameter to apply when resizing. |
- * @param sy The y scale parameter to apply when resizing. |
+ /** Construct a 2D transformation image filter. |
+ * @param transform The matrix to apply when drawing the src bitmap |
* @param filterLevel The quality of filtering to apply when scaling. |
* @param input The input image filter. If NULL, the src bitmap |
* passed to filterImage() is used instead. |
*/ |
- static SkResizeImageFilter* Create(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLevel, |
- SkImageFilter* input = NULL) { |
- return SkNEW_ARGS(SkResizeImageFilter, (sx, sy, filterLevel, input)); |
- } |
+ |
+ static SkMatrixImageFilter* Create(const SkMatrix& transform, |
+ SkPaint::FilterLevel, |
+ SkImageFilter* input = NULL); |
+ virtual ~SkMatrixImageFilter(); |
virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; |
- SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkResizeImageFilter) |
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixImageFilter) |
protected: |
- SkResizeImageFilter(SkReadBuffer& buffer); |
+ SkMatrixImageFilter(const SkMatrix& transform, |
+ SkPaint::FilterLevel, |
+ SkImageFilter* input = NULL); |
+ SkMatrixImageFilter(SkReadBuffer& buffer); |
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
@@ -48,14 +49,8 @@ protected: |
virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, |
SkIRect* dst) const SK_OVERRIDE; |
-#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS |
-public: |
-#endif |
- SkResizeImageFilter(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLevel, |
- SkImageFilter* input = NULL); |
- |
private: |
- SkScalar fSx, fSy; |
+ SkMatrix fTransform; |
SkPaint::FilterLevel fFilterLevel; |
typedef SkImageFilter INHERITED; |
}; |