aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-15 04:49:18 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-15 04:49:18 +0000
commita612d4c5134655fe6703c8d2f63be710aa1e2767 (patch)
tree61e262f0e035e1ef5c99b1d1c96b632659273a81 /include
parent32678d9a453e2c9fd26e92be429cdd84250b4d85 (diff)
Implement a resize image filter. This is needed for the "filterRes" feature in SVG filter effects, which specifies the required size for intermediate processing buffers. In order to make this work, we need to render the primitive at the given resolution (doable at the callsite in Blink), and then to resize the result to the actual on-screen size. The latter is where this filter comes in.
It simply applies a scaling factor (and the current CTM) to its input, and draws its input bitmap at that size. R=reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=13077 Reverted: https://code.google.com/p/skia/source/detail?r=13078 BUG= Review URL: https://codereview.chromium.org/136863006 git-svn-id: http://skia.googlecode.com/svn/trunk@13082 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/effects/SkResizeImageFilter.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/include/effects/SkResizeImageFilter.h b/include/effects/SkResizeImageFilter.h
new file mode 100644
index 0000000000..d63855561e
--- /dev/null
+++ b/include/effects/SkResizeImageFilter.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2013 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
+
+#include "SkImageFilter.h"
+#include "SkScalar.h"
+#include "SkRect.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 SK_API SkResizeImageFilter : public SkImageFilter {
+public:
+ /** 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.
+ * @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.
+ */
+
+ SkResizeImageFilter(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLevel,
+ SkImageFilter* input = NULL);
+ virtual ~SkResizeImageFilter();
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkResizeImageFilter)
+
+protected:
+ SkResizeImageFilter(SkFlattenableReadBuffer& buffer);
+ virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+ SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
+
+private:
+ SkScalar fSx, fSy;
+ SkPaint::FilterLevel fFilterLevel;
+ typedef SkImageFilter INHERITED;
+};
+
+#endif