Initial import of Cobalt 2.8885 2016-07-27
diff --git a/src/third_party/skia/include/effects/Sk1DPathEffect.h b/src/third_party/skia/include/effects/Sk1DPathEffect.h
new file mode 100644
index 0000000..87047e4
--- /dev/null
+++ b/src/third_party/skia/include/effects/Sk1DPathEffect.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2006 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 Sk1DPathEffect_DEFINED
+#define Sk1DPathEffect_DEFINED
+
+#include "SkPathEffect.h"
+#include "SkPath.h"
+
+class SkPathMeasure;
+
+// This class is not exported to java.
+class SK_API Sk1DPathEffect : public SkPathEffect {
+public:
+ virtual bool filterPath(SkPath* dst, const SkPath& src,
+ SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
+
+protected:
+ /** Called at the start of each contour, returns the initial offset
+ into that contour.
+ */
+ virtual SkScalar begin(SkScalar contourLength) const = 0;
+ /** Called with the current distance along the path, with the current matrix
+ for the point/tangent at the specified distance.
+ Return the distance to travel for the next call. If return <= 0, then that
+ contour is done.
+ */
+ virtual SkScalar next(SkPath* dst, SkScalar dist, SkPathMeasure&) const = 0;
+
+private:
+ typedef SkPathEffect INHERITED;
+};
+
+class SK_API SkPath1DPathEffect : public Sk1DPathEffect {
+public:
+ enum Style {
+ kTranslate_Style, // translate the shape to each position
+ kRotate_Style, // rotate the shape about its center
+ kMorph_Style, // transform each point, and turn lines into curves
+
+ kStyleCount
+ };
+
+ /** Dash by replicating the specified path.
+ @param path The path to replicate (dash)
+ @param advance The space between instances of path
+ @param phase distance (mod advance) along path for its initial position
+ @param style how to transform path at each point (based on the current
+ position and tangent)
+ */
+ static SkPath1DPathEffect* Create(const SkPath& path, SkScalar advance, SkScalar phase,
+ Style style) {
+ return SkNEW_ARGS(SkPath1DPathEffect, (path, advance, phase, style));
+ }
+
+ virtual bool filterPath(SkPath*, const SkPath&,
+ SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect)
+
+protected:
+ SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Style);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkPath1DPathEffect(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ // overrides from Sk1DPathEffect
+ virtual SkScalar begin(SkScalar contourLength) const SK_OVERRIDE;
+ virtual SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const SK_OVERRIDE;
+
+private:
+ SkPath fPath; // copied from constructor
+ SkScalar fAdvance; // copied from constructor
+ SkScalar fInitialOffset; // computed from phase
+ Style fStyle; // copied from constructor
+
+ typedef Sk1DPathEffect INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/Sk2DPathEffect.h b/src/third_party/skia/include/effects/Sk2DPathEffect.h
new file mode 100644
index 0000000..80a27a3
--- /dev/null
+++ b/src/third_party/skia/include/effects/Sk2DPathEffect.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2006 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 Sk2DPathEffect_DEFINED
+#define Sk2DPathEffect_DEFINED
+
+#include "SkPath.h"
+#include "SkPathEffect.h"
+#include "SkMatrix.h"
+
+class SK_API Sk2DPathEffect : public SkPathEffect {
+public:
+ virtual bool filterPath(SkPath*, const SkPath&, SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
+
+ SK_DECLARE_UNFLATTENABLE_OBJECT()
+
+protected:
+ /** New virtual, to be overridden by subclasses.
+ This is called once from filterPath, and provides the
+ uv parameter bounds for the path. Subsequent calls to
+ next() will receive u and v values within these bounds,
+ and then a call to end() will signal the end of processing.
+ */
+ virtual void begin(const SkIRect& uvBounds, SkPath* dst) const;
+ virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const;
+ virtual void end(SkPath* dst) const;
+
+ /** Low-level virtual called per span of locations in the u-direction.
+ The default implementation calls next() repeatedly with each
+ location.
+ */
+ virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const;
+
+ const SkMatrix& getMatrix() const { return fMatrix; }
+
+ // protected so that subclasses can call this during unflattening
+ explicit Sk2DPathEffect(const SkMatrix& mat);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit Sk2DPathEffect(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkMatrix fMatrix, fInverse;
+ bool fMatrixIsInvertible;
+
+ // illegal
+ Sk2DPathEffect(const Sk2DPathEffect&);
+ Sk2DPathEffect& operator=(const Sk2DPathEffect&);
+
+ friend class Sk2DPathEffectBlitter;
+ typedef SkPathEffect INHERITED;
+};
+
+class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
+public:
+ static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) {
+ return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix));
+ }
+
+ virtual bool filterPath(SkPath* dst, const SkPath& src,
+ SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect)
+
+protected:
+ SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
+ : Sk2DPathEffect(matrix), fWidth(width) {}
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkLine2DPathEffect(SkReadBuffer&);
+#endif
+
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE;
+
+private:
+ SkScalar fWidth;
+
+ typedef Sk2DPathEffect INHERITED;
+};
+
+class SK_API SkPath2DPathEffect : public Sk2DPathEffect {
+public:
+ /**
+ * Stamp the specified path to fill the shape, using the matrix to define
+ * the latice.
+ */
+ static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path) {
+ return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path));
+ }
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect)
+
+protected:
+ SkPath2DPathEffect(const SkMatrix&, const SkPath&);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkPath2DPathEffect(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE;
+
+private:
+ SkPath fPath;
+
+ typedef Sk2DPathEffect INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkAlphaThresholdFilter.h b/src/third_party/skia/include/effects/SkAlphaThresholdFilter.h
new file mode 100644
index 0000000..f409ee0
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkAlphaThresholdFilter.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkAlphaThresholdFilter_DEFINED
+#define SkAlphaThresholdFilter_DEFINED
+
+#include "SkRegion.h"
+#include "SkImageFilter.h"
+
+class SK_API SkAlphaThresholdFilter {
+public:
+ /**
+ * Creates an image filter that samples a region. If the sample is inside the
+ * region the alpha of the image is boosted up to a threshold value. If it is
+ * outside the region then the alpha is decreased to the threshold value.
+ * The 0,0 point of the region corresponds to the upper left corner of the
+ * source image.
+ */
+ static SkImageFilter* Create(const SkRegion& region, SkScalar innerThreshold,
+ SkScalar outerThreshold, SkImageFilter* input = NULL);
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkArithmeticMode.h b/src/third_party/skia/include/effects/SkArithmeticMode.h
new file mode 100644
index 0000000..3b9585d
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkArithmeticMode.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkArithmeticMode_DEFINED
+#define SkArithmeticMode_DEFINED
+
+#include "SkFlattenable.h"
+#include "SkScalar.h"
+
+class SkXfermode;
+
+class SK_API SkArithmeticMode {
+public:
+ /**
+ * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4]
+ *
+ * src and dst are treated as being [0.0 .. 1.0]. The polynomial is
+ * evaluated on their unpremultiplied components.
+ *
+ * k1=k2=k3=0, k4=1.0 results in returning opaque white
+ * k1=k3=k4=0, k2=1.0 results in returning the src
+ * k1=k2=k4=0, k3=1.0 results in returning the dst
+ */
+ static SkXfermode* Create(SkScalar k1, SkScalar k2,
+ SkScalar k3, SkScalar k4,
+ bool enforcePMColor = true);
+
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP();
+
+private:
+ SkArithmeticMode(); // can't be instantiated
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkAvoidXfermode.h b/src/third_party/skia/include/effects/SkAvoidXfermode.h
new file mode 100644
index 0000000..53ce708
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkAvoidXfermode.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2006 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 SkAvoidXfermode_DEFINED
+#define SkAvoidXfermode_DEFINED
+
+#include "SkXfermode.h"
+
+/** \class SkAvoidXfermode
+
+ This xfermode will draw the src everywhere except on top of the specified
+ color.
+*/
+class SK_API SkAvoidXfermode : public SkXfermode {
+public:
+ enum Mode {
+ kAvoidColor_Mode, //!< draw everywhere except on the opColor
+ kTargetColor_Mode //!< draw only on top of the opColor
+ };
+
+ /** This xfermode draws, or doesn't draw, based on the destination's
+ distance from an op-color.
+
+ There are two modes, and each mode interprets a tolerance value.
+
+ Avoid: In this mode, drawing is allowed only on destination pixels that
+ are different from the op-color.
+ Tolerance near 0: avoid any colors even remotely similar to the op-color
+ Tolerance near 255: avoid only colors nearly identical to the op-color
+
+ Target: In this mode, drawing only occurs on destination pixels that
+ are similar to the op-color
+ Tolerance near 0: draw only on colors that are nearly identical to the op-color
+ Tolerance near 255: draw on any colors even remotely similar to the op-color
+ */
+ static SkAvoidXfermode* Create(SkColor opColor, U8CPU tolerance, Mode mode) {
+ return SkNEW_ARGS(SkAvoidXfermode, (opColor, tolerance, mode));
+ }
+
+ // overrides from SkXfermode
+ virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
+ const SkAlpha aa[]) const SK_OVERRIDE;
+ virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
+ const SkAlpha aa[]) const SK_OVERRIDE;
+ virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
+ const SkAlpha aa[]) const SK_OVERRIDE;
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAvoidXfermode)
+
+protected:
+ SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkAvoidXfermode(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkColor fOpColor;
+ uint32_t fDistMul; // x.14 cached from fTolerance
+ uint8_t fTolerance;
+ Mode fMode;
+
+ typedef SkXfermode INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkBitmapSource.h b/src/third_party/skia/include/effects/SkBitmapSource.h
new file mode 100644
index 0000000..9004a46
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkBitmapSource.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2012 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 SkBitmapSource_DEFINED
+#define SkBitmapSource_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkBitmap.h"
+
+class SK_API SkBitmapSource : public SkImageFilter {
+public:
+ static SkBitmapSource* Create(const SkBitmap& bitmap) {
+ return SkNEW_ARGS(SkBitmapSource, (bitmap));
+ }
+ static SkBitmapSource* Create(const SkBitmap& bitmap, const SkRect& srcRect,
+ const SkRect& dstRect) {
+ return SkNEW_ARGS(SkBitmapSource, (bitmap, srcRect, dstRect));
+ }
+ virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource)
+
+protected:
+ explicit SkBitmapSource(const SkBitmap& bitmap);
+ SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect& dstRect);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkBitmapSource(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const SK_OVERRIDE;
+
+private:
+ SkBitmap fBitmap;
+ SkRect fSrcRect, fDstRect;
+ typedef SkImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkBlurDrawLooper.h b/src/third_party/skia/include/effects/SkBlurDrawLooper.h
new file mode 100644
index 0000000..9db9f0d
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkBlurDrawLooper.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2008 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 SkBlurDrawLooper_DEFINED
+#define SkBlurDrawLooper_DEFINED
+
+#include "SkDrawLooper.h"
+#include "SkColor.h"
+
+class SkMaskFilter;
+class SkColorFilter;
+
+/** \class SkBlurDrawLooper
+ This class draws a shadow of the object (possibly offset), and then draws
+ the original object in its original position.
+ should there be an option to just draw the shadow/blur layer? webkit?
+*/
+class SK_API SkBlurDrawLooper : public SkDrawLooper {
+public:
+ enum BlurFlags {
+ kNone_BlurFlag = 0x00,
+ /**
+ The blur layer's dx/dy/radius aren't affected by the canvas
+ transform.
+ */
+ kIgnoreTransform_BlurFlag = 0x01,
+ kOverrideColor_BlurFlag = 0x02,
+ kHighQuality_BlurFlag = 0x04,
+ /** mask for all blur flags */
+ kAll_BlurFlag = 0x07
+ };
+
+ static SkBlurDrawLooper* Create(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy,
+ uint32_t flags = kNone_BlurFlag) {
+ return SkNEW_ARGS(SkBlurDrawLooper, (color, sigma, dx, dy, flags));
+ }
+
+ virtual ~SkBlurDrawLooper();
+
+ virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVERRIDE;
+
+ virtual size_t contextSize() const SK_OVERRIDE { return sizeof(BlurDrawLooperContext); }
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper)
+
+protected:
+ SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy,
+ uint32_t flags);
+
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkBlurDrawLooper(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool asABlurShadow(BlurShadowRec*) const SK_OVERRIDE;
+
+private:
+ SkMaskFilter* fBlur;
+ SkColorFilter* fColorFilter;
+ SkScalar fDx, fDy, fSigma;
+ SkColor fBlurColor;
+ uint32_t fBlurFlags;
+
+ enum State {
+ kBeforeEdge,
+ kAfterEdge,
+ kDone
+ };
+
+ class BlurDrawLooperContext : public SkDrawLooper::Context {
+ public:
+ explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper);
+
+ virtual bool next(SkCanvas* canvas, SkPaint* paint) SK_OVERRIDE;
+
+ private:
+ const SkBlurDrawLooper* fLooper;
+ State fState;
+ };
+
+ void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags);
+ void initEffects();
+
+ typedef SkDrawLooper INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkBlurImageFilter.h b/src/third_party/skia/include/effects/SkBlurImageFilter.h
new file mode 100644
index 0000000..cfa895a
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkBlurImageFilter.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2011 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 SkBlurImageFilter_DEFINED
+#define SkBlurImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkSize.h"
+
+class SK_API SkBlurImageFilter : public SkImageFilter {
+public:
+ static SkBlurImageFilter* Create(SkScalar sigmaX,
+ SkScalar sigmaY,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL, uint32_t uniqueID = 0) {
+ return SkNEW_ARGS(SkBlurImageFilter, (sigmaX, sigmaY, input, cropRect, uniqueID));
+ }
+
+ virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilter)
+
+protected:
+ SkBlurImageFilter(SkScalar sigmaX,
+ SkScalar sigmaY,
+ SkImageFilter* input,
+ const CropRect* cropRect,
+ uint32_t uniqueID);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkBlurImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
+ SkIRect* dst) const SK_OVERRIDE;
+
+ bool canFilterImageGPU() const SK_OVERRIDE { return true; }
+ virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+
+private:
+ SkSize fSigma;
+ typedef SkImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkBlurMaskFilter.h b/src/third_party/skia/include/effects/SkBlurMaskFilter.h
new file mode 100644
index 0000000..356475e
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkBlurMaskFilter.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2006 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 SkBlurMaskFilter_DEFINED
+#define SkBlurMaskFilter_DEFINED
+
+// we include this since our callers will need to at least be able to ref/unref
+#include "SkMaskFilter.h"
+#include "SkScalar.h"
+#include "SkBlurTypes.h"
+
+class SK_API SkBlurMaskFilter {
+public:
+ /**
+ * If radius > 0, return the corresponding sigma, else return 0. Use this to convert from the
+ * (legacy) idea of specify the blur "radius" to the standard notion of specifying its sigma.
+ */
+ static SkScalar ConvertRadiusToSigma(SkScalar radius);
+
+ enum BlurFlags {
+ kNone_BlurFlag = 0x00,
+ /** The blur layer's radius is not affected by transforms */
+ kIgnoreTransform_BlurFlag = 0x01,
+ /** Use a smother, higher qulity blur algorithm */
+ kHighQuality_BlurFlag = 0x02,
+ /** mask for all blur flags */
+ kAll_BlurFlag = 0x03
+ };
+
+ /** Create a blur maskfilter.
+ * @param style The SkBlurStyle to use
+ * @param sigma Standard deviation of the Gaussian blur to apply. Must be > 0.
+ * @param flags Flags to use - defaults to none
+ * @return The new blur maskfilter
+ */
+ static SkMaskFilter* Create(SkBlurStyle style, SkScalar sigma, uint32_t flags = kNone_BlurFlag);
+
+ /** Create an emboss maskfilter
+ @param blurSigma standard deviation of the Gaussian blur to apply
+ before applying lighting (e.g. 3)
+ @param direction array of 3 scalars [x, y, z] specifying the direction of the light source
+ @param ambient 0...1 amount of ambient light
+ @param specular coefficient for specular highlights (e.g. 8)
+ @return the emboss maskfilter
+ */
+ static SkMaskFilter* CreateEmboss(SkScalar blurSigma, const SkScalar direction[3],
+ SkScalar ambient, SkScalar specular);
+
+ SK_ATTR_DEPRECATED("use sigma version")
+ static SkMaskFilter* CreateEmboss(const SkScalar direction[3],
+ SkScalar ambient, SkScalar specular,
+ SkScalar blurRadius);
+
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
+
+private:
+ SkBlurMaskFilter(); // can't be instantiated
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkColorFilterImageFilter.h b/src/third_party/skia/include/effects/SkColorFilterImageFilter.h
new file mode 100644
index 0000000..46f2d2a
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkColorFilterImageFilter.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2012 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 SkColorFilterImageFilter_DEFINED
+#define SkColorFilterImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+
+class SkColorFilter;
+
+class SK_API SkColorFilterImageFilter : public SkImageFilter {
+public:
+ static SkColorFilterImageFilter* Create(SkColorFilter* cf,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL,
+ uint32_t uniqueID = 0);
+ virtual ~SkColorFilterImageFilter();
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorFilterImageFilter)
+
+protected:
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkColorFilterImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+
+ virtual bool asColorFilter(SkColorFilter**) const SK_OVERRIDE;
+
+private:
+ SkColorFilterImageFilter(SkColorFilter* cf,
+ SkImageFilter* input,
+ const CropRect* cropRect,
+ uint32_t uniqueID);
+ SkColorFilter* fColorFilter;
+
+ typedef SkImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkColorMatrix.h b/src/third_party/skia/include/effects/SkColorMatrix.h
new file mode 100644
index 0000000..c598a12
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkColorMatrix.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2007 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 SkColorMatrix_DEFINED
+#define SkColorMatrix_DEFINED
+
+#include "SkScalar.h"
+
+class SK_API SkColorMatrix {
+public:
+ SkScalar fMat[20];
+
+ enum Elem {
+ kR_Scale = 0,
+ kG_Scale = 6,
+ kB_Scale = 12,
+ kA_Scale = 18,
+
+ kR_Trans = 4,
+ kG_Trans = 9,
+ kB_Trans = 14,
+ kA_Trans = 19,
+ };
+
+ void setIdentity();
+ void setScale(SkScalar rScale, SkScalar gScale, SkScalar bScale,
+ SkScalar aScale = SK_Scalar1);
+ void preScale(SkScalar rScale, SkScalar gScale, SkScalar bScale,
+ SkScalar aScale = SK_Scalar1);
+ void postScale(SkScalar rScale, SkScalar gScale, SkScalar bScale,
+ SkScalar aScale = SK_Scalar1);
+ void postTranslate(SkScalar rTrans, SkScalar gTrans, SkScalar bTrans,
+ SkScalar aTrans = 0);
+
+ enum Axis {
+ kR_Axis = 0,
+ kG_Axis = 1,
+ kB_Axis = 2
+ };
+ void setRotate(Axis, SkScalar degrees);
+ void setSinCos(Axis, SkScalar sine, SkScalar cosine);
+ void preRotate(Axis, SkScalar degrees);
+ void postRotate(Axis, SkScalar degrees);
+
+ void setConcat(const SkColorMatrix& a, const SkColorMatrix& b);
+ void preConcat(const SkColorMatrix& mat) { this->setConcat(*this, mat); }
+ void postConcat(const SkColorMatrix& mat) { this->setConcat(mat, *this); }
+
+ void setSaturation(SkScalar sat);
+ void setRGB2YUV();
+ void setYUV2RGB();
+
+ bool operator==(const SkColorMatrix& other) const {
+ return 0 == memcmp(fMat, other.fMat, sizeof(fMat));
+ }
+
+ bool operator!=(const SkColorMatrix& other) const { return !((*this) == other); }
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkColorMatrixFilter.h b/src/third_party/skia/include/effects/SkColorMatrixFilter.h
new file mode 100644
index 0000000..dad4062
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkColorMatrixFilter.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2007 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 SkColorMatrixFilter_DEFINED
+#define SkColorMatrixFilter_DEFINED
+
+#include "SkColorFilter.h"
+#include "SkColorMatrix.h"
+
+class SK_API SkColorMatrixFilter : public SkColorFilter {
+public:
+ static SkColorMatrixFilter* Create(const SkColorMatrix& cm) {
+ return SkNEW_ARGS(SkColorMatrixFilter, (cm));
+ }
+ static SkColorMatrixFilter* Create(const SkScalar array[20]) {
+ return SkNEW_ARGS(SkColorMatrixFilter, (array));
+ }
+
+ // overrides from SkColorFilter
+ virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const SK_OVERRIDE;
+ virtual void filterSpan16(const uint16_t src[], int count, uint16_t[]) const SK_OVERRIDE;
+ virtual uint32_t getFlags() const SK_OVERRIDE;
+ virtual bool asColorMatrix(SkScalar matrix[20]) const SK_OVERRIDE;
+#if SK_SUPPORT_GPU
+ virtual GrFragmentProcessor* asFragmentProcessor(GrContext*) const SK_OVERRIDE;
+#endif
+
+ struct State {
+ int32_t fArray[20];
+ int fShift;
+ };
+
+ SK_TO_STRING_OVERRIDE()
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorMatrixFilter)
+
+protected:
+ explicit SkColorMatrixFilter(const SkColorMatrix&);
+ explicit SkColorMatrixFilter(const SkScalar array[20]);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkColorMatrixFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkColorMatrix fMatrix;
+
+ typedef void (*Proc)(const State&, unsigned r, unsigned g, unsigned b,
+ unsigned a, int32_t result[4]);
+
+ Proc fProc;
+ State fState;
+ uint32_t fFlags;
+
+ void initState(const SkScalar array[20]);
+
+ typedef SkColorFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkComposeImageFilter.h b/src/third_party/skia/include/effects/SkComposeImageFilter.h
new file mode 100644
index 0000000..26eed37
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkComposeImageFilter.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkComposeImageFilter_DEFINED
+#define SkComposeImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+
+class SK_API SkComposeImageFilter : public SkImageFilter {
+public:
+ virtual ~SkComposeImageFilter();
+
+ static SkImageFilter* Create(SkImageFilter* outer, SkImageFilter* inner) {
+ if (NULL == outer) {
+ return SkSafeRef(inner);
+ }
+ if (NULL == inner) {
+ return SkRef(outer);
+ }
+ SkImageFilter* inputs[2] = { outer, inner };
+ return SkNEW_ARGS(SkComposeImageFilter, (inputs));
+ }
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter)
+
+protected:
+ explicit SkComposeImageFilter(SkImageFilter* inputs[2]) : INHERITED(2, inputs) {
+ SkASSERT(inputs[0]);
+ SkASSERT(inputs[1]);
+ }
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkComposeImageFilter(SkReadBuffer& buffer);
+#endif
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const SK_OVERRIDE;
+
+private:
+ typedef SkImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkCornerPathEffect.h b/src/third_party/skia/include/effects/SkCornerPathEffect.h
new file mode 100644
index 0000000..e61d494
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkCornerPathEffect.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 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 SkCornerPathEffect_DEFINED
+#define SkCornerPathEffect_DEFINED
+
+#include "SkPathEffect.h"
+
+/** \class SkCornerPathEffect
+
+ SkCornerPathEffect is a subclass of SkPathEffect that can turn sharp corners
+ into various treatments (e.g. rounded corners)
+*/
+class SK_API SkCornerPathEffect : public SkPathEffect {
+public:
+ /** radius must be > 0 to have an effect. It specifies the distance from each corner
+ that should be "rounded".
+ */
+ static SkCornerPathEffect* Create(SkScalar radius) {
+ return SkNEW_ARGS(SkCornerPathEffect, (radius));
+ }
+ virtual ~SkCornerPathEffect();
+
+ virtual bool filterPath(SkPath* dst, const SkPath& src,
+ SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCornerPathEffect)
+
+protected:
+ explicit SkCornerPathEffect(SkScalar radius);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkCornerPathEffect(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkScalar fRadius;
+
+ typedef SkPathEffect INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkDashPathEffect.h b/src/third_party/skia/include/effects/SkDashPathEffect.h
new file mode 100644
index 0000000..3946224
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkDashPathEffect.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2006 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 SkDashPathEffect_DEFINED
+#define SkDashPathEffect_DEFINED
+
+#include "SkPathEffect.h"
+
+/** \class SkDashPathEffect
+
+ SkDashPathEffect is a subclass of SkPathEffect that implements dashing
+*/
+class SK_API SkDashPathEffect : public SkPathEffect {
+public:
+ /** intervals: array containing an even number of entries (>=2), with
+ the even indices specifying the length of "on" intervals, and the odd
+ indices specifying the length of "off" intervals.
+ count: number of elements in the intervals array
+ phase: offset into the intervals array (mod the sum of all of the
+ intervals).
+
+ For example: if intervals[] = {10, 20}, count = 2, and phase = 25,
+ this will set up a dashed path like so:
+ 5 pixels off
+ 10 pixels on
+ 20 pixels off
+ 10 pixels on
+ 20 pixels off
+ ...
+ A phase of -5, 25, 55, 85, etc. would all result in the same path,
+ because the sum of all the intervals is 30.
+
+ Note: only affects stroked paths.
+ */
+ static SkDashPathEffect* Create(const SkScalar intervals[], int count,
+ SkScalar phase) {
+ return SkNEW_ARGS(SkDashPathEffect, (intervals, count, phase));
+ }
+ virtual ~SkDashPathEffect();
+
+ virtual bool filterPath(SkPath* dst, const SkPath& src,
+ SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
+
+ virtual bool asPoints(PointData* results, const SkPath& src,
+ const SkStrokeRec&, const SkMatrix&,
+ const SkRect*) const SK_OVERRIDE;
+
+ virtual DashType asADash(DashInfo* info) const SK_OVERRIDE;
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDashPathEffect)
+
+protected:
+ SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkDashPathEffect(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkScalar* fIntervals;
+ int32_t fCount;
+ SkScalar fPhase;
+ // computed from phase
+ SkScalar fInitialDashLength;
+ int32_t fInitialDashIndex;
+ SkScalar fIntervalLength;
+
+ typedef SkPathEffect INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkDiscretePathEffect.h b/src/third_party/skia/include/effects/SkDiscretePathEffect.h
new file mode 100644
index 0000000..8f1082c
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkDiscretePathEffect.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2006 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 SkDiscretePathEffect_DEFINED
+#define SkDiscretePathEffect_DEFINED
+
+#include "SkPathEffect.h"
+
+/** \class SkDiscretePathEffect
+
+ This path effect chops a path into discrete segments, and randomly displaces them.
+*/
+class SK_API SkDiscretePathEffect : public SkPathEffect {
+public:
+ /** Break the path into segments of segLength length, and randomly move the endpoints
+ away from the original path by a maximum of deviation.
+ Note: works on filled or framed paths
+
+ @param seedAssist This is a caller-supplied seedAssist that modifies
+ the seed value that is used to randomize the path
+ segments' endpoints. If not supplied it defaults to 0,
+ in which case filtering a path multiple times will
+ result in the same set of segments (this is useful for
+ testing). If a caller does not want this behaviour
+ they can pass in a different seedAssist to get a
+ different set of path segments.
+ */
+ static SkDiscretePathEffect* Create(SkScalar segLength,
+ SkScalar deviation,
+ uint32_t seedAssist=0) {
+ return SkNEW_ARGS(SkDiscretePathEffect,
+ (segLength, deviation, seedAssist));
+ }
+
+ virtual bool filterPath(SkPath* dst, const SkPath& src,
+ SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect)
+
+protected:
+ SkDiscretePathEffect(SkScalar segLength,
+ SkScalar deviation,
+ uint32_t seedAssist);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkDiscretePathEffect(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkScalar fSegLength, fPerterb;
+
+ /* Caller-supplied 32 bit seed assist */
+ uint32_t fSeedAssist;
+
+ typedef SkPathEffect INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkDisplacementMapEffect.h b/src/third_party/skia/include/effects/SkDisplacementMapEffect.h
new file mode 100644
index 0000000..0a658ac
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkDisplacementMapEffect.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkDisplacementMapEffect_DEFINED
+#define SkDisplacementMapEffect_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkBitmap.h"
+
+class SK_API SkDisplacementMapEffect : public SkImageFilter {
+public:
+ enum ChannelSelectorType {
+ kUnknown_ChannelSelectorType,
+ kR_ChannelSelectorType,
+ kG_ChannelSelectorType,
+ kB_ChannelSelectorType,
+ kA_ChannelSelectorType
+ };
+
+ ~SkDisplacementMapEffect();
+
+ static SkDisplacementMapEffect* Create(ChannelSelectorType xChannelSelector,
+ ChannelSelectorType yChannelSelector,
+ SkScalar scale, SkImageFilter* displacement,
+ SkImageFilter* color = NULL,
+ const CropRect* cropRect = NULL,
+ uint32_t uniqueID = 0);
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDisplacementMapEffect)
+
+ virtual bool onFilterImage(Proxy* proxy,
+ const SkBitmap& src,
+ const Context& ctx,
+ SkBitmap* dst,
+ SkIPoint* offset) const SK_OVERRIDE;
+ virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
+
+ virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
+ SkIRect* dst) const SK_OVERRIDE;
+
+#if SK_SUPPORT_GPU
+ virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
+ virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+#endif
+
+protected:
+ SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
+ ChannelSelectorType yChannelSelector,
+ SkScalar scale, SkImageFilter* inputs[2],
+ const CropRect* cropRect,
+ uint32_t uniqueID);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkDisplacementMapEffect(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ ChannelSelectorType fXChannelSelector;
+ ChannelSelectorType fYChannelSelector;
+ SkScalar fScale;
+ typedef SkImageFilter INHERITED;
+ const SkImageFilter* getDisplacementInput() const { return getInput(0); }
+ const SkImageFilter* getColorInput() const { return getInput(1); }
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkDrawExtraPathEffect.h b/src/third_party/skia/include/effects/SkDrawExtraPathEffect.h
new file mode 100644
index 0000000..392a46b
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkDrawExtraPathEffect.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2008 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 SK_DRAW_EXTRA_PATH_EFFECT_H
+#define SK_DRAW_EXTRA_PATH_EFFECT_H
+
+class SkAnimator;
+
+void InitializeSkExtraPathEffects(SkAnimator* animator);
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkDropShadowImageFilter.h b/src/third_party/skia/include/effects/SkDropShadowImageFilter.h
new file mode 100644
index 0000000..0d6c24e
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkDropShadowImageFilter.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkColor.h"
+#include "SkImageFilter.h"
+#include "SkScalar.h"
+
+class SK_API SkDropShadowImageFilter : public SkImageFilter {
+public:
+ static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy,
+ SkScalar sigmaX, SkScalar sigmaY, SkColor color,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL,
+ uint32_t uniqueID = 0) {
+ return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY,
+ color, input, cropRect, uniqueID));
+ }
+ virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter)
+
+protected:
+ SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor,
+ SkImageFilter* input, const CropRect* cropRect, uint32_t uniqueID);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkDropShadowImageFilter(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+ virtual bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
+ SkIRect* dst) const SK_OVERRIDE;
+
+private:
+ SkScalar fDx, fDy, fSigmaX, fSigmaY;
+ SkColor fColor;
+ typedef SkImageFilter INHERITED;
+};
diff --git a/src/third_party/skia/include/effects/SkEmbossMaskFilter.h b/src/third_party/skia/include/effects/SkEmbossMaskFilter.h
new file mode 100644
index 0000000..74895fb
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkEmbossMaskFilter.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2006 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 SkEmbossMaskFilter_DEFINED
+#define SkEmbossMaskFilter_DEFINED
+
+#include "SkMaskFilter.h"
+
+/** \class SkEmbossMaskFilter
+
+ This mask filter creates a 3D emboss look, by specifying a light and blur amount.
+*/
+class SK_API SkEmbossMaskFilter : public SkMaskFilter {
+public:
+ struct Light {
+ SkScalar fDirection[3]; // x,y,z
+ uint16_t fPad;
+ uint8_t fAmbient;
+ uint8_t fSpecular; // exponent, 4.4 right now
+ };
+
+ static SkEmbossMaskFilter* Create(SkScalar blurSigma, const Light& light);
+
+ // overrides from SkMaskFilter
+ // This method is not exported to java.
+ virtual SkMask::Format getFormat() const SK_OVERRIDE;
+ // This method is not exported to java.
+ virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
+ SkIPoint* margin) const SK_OVERRIDE;
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmbossMaskFilter)
+
+protected:
+ SkEmbossMaskFilter(SkScalar blurSigma, const Light& light);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkEmbossMaskFilter(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ Light fLight;
+ SkScalar fBlurSigma;
+
+ typedef SkMaskFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkGradientShader.h b/src/third_party/skia/include/effects/SkGradientShader.h
new file mode 100644
index 0000000..8d1a931
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkGradientShader.h
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2006 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 SkGradientShader_DEFINED
+#define SkGradientShader_DEFINED
+
+#include "SkShader.h"
+
+#define SK_SUPPORT_LEGACY_GRADIENT_FACTORIES
+
+/** \class SkGradientShader
+
+ SkGradientShader hosts factories for creating subclasses of SkShader that
+ render linear and radial gradients.
+*/
+class SK_API SkGradientShader {
+public:
+ enum Flags {
+ /** By default gradients will interpolate their colors in unpremul space
+ * and then premultiply each of the results. By setting this flag, the
+ * gradients will premultiply their colors first, and then interpolate
+ * between them.
+ */
+ kInterpolateColorsInPremul_Flag = 1 << 0,
+ };
+
+ /** Returns a shader that generates a linear gradient between the two
+ specified points.
+ <p />
+ CreateLinear returns a shader with a reference count of 1.
+ The caller should decrement the shader's reference count when done with the shader.
+ It is an error for count to be < 2.
+ @param pts The start and end points for the gradient.
+ @param colors The array[count] of colors, to be distributed between the two points
+ @param pos May be NULL. array[count] of SkScalars, or NULL, of the relative position of
+ each corresponding color in the colors array. If this is NULL,
+ the the colors are distributed evenly between the start and end point.
+ If this is not null, the values must begin with 0, end with 1.0, and
+ intermediate values must be strictly increasing.
+ @param count Must be >=2. The number of colors (and pos if not NULL) entries.
+ @param mode The tiling mode
+ */
+ static SkShader* CreateLinear(const SkPoint pts[2],
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode,
+ uint32_t flags, const SkMatrix* localMatrix);
+
+ static SkShader* CreateLinear(const SkPoint pts[2],
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode) {
+ return CreateLinear(pts, colors, pos, count, mode, 0, NULL);
+ }
+
+#ifdef SK_SUPPORT_LEGACY_GRADIENT_FACTORIES
+ static SkShader* CreateLinear(const SkPoint pts[2],
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode, void* ignored,
+ uint32_t flags, const SkMatrix* localMatrix) {
+ return CreateLinear(pts, colors, pos, count, mode, flags, localMatrix);
+ }
+#endif
+
+ /** Returns a shader that generates a radial gradient given the center and radius.
+ <p />
+ CreateRadial returns a shader with a reference count of 1.
+ The caller should decrement the shader's reference count when done with the shader.
+ It is an error for colorCount to be < 2, or for radius to be <= 0.
+ @param center The center of the circle for this gradient
+ @param radius Must be positive. The radius of the circle for this gradient
+ @param colors The array[count] of colors, to be distributed between the center and edge of the circle
+ @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of
+ each corresponding color in the colors array. If this is NULL,
+ the the colors are distributed evenly between the center and edge of the circle.
+ If this is not null, the values must begin with 0, end with 1.0, and
+ intermediate values must be strictly increasing.
+ @param count Must be >= 2. The number of colors (and pos if not NULL) entries
+ @param mode The tiling mode
+ */
+ static SkShader* CreateRadial(const SkPoint& center, SkScalar radius,
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode,
+ uint32_t flags, const SkMatrix* localMatrix);
+
+ static SkShader* CreateRadial(const SkPoint& center, SkScalar radius,
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode) {
+ return CreateRadial(center, radius, colors, pos, count, mode, 0, NULL);
+ }
+
+#ifdef SK_SUPPORT_LEGACY_GRADIENT_FACTORIES
+ static SkShader* CreateRadial(const SkPoint& center, SkScalar radius,
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode, void* ignored,
+ uint32_t flags, const SkMatrix* localMatrix) {
+ return CreateRadial(center, radius, colors, pos, count, mode, flags, localMatrix);
+ }
+#endif
+
+ /** Returns a shader that generates a radial gradient given the start position, start radius, end position and end radius.
+ <p />
+ CreateTwoPointRadial returns a shader with a reference count of 1.
+ The caller should decrement the shader's reference count when done with the shader.
+ It is an error for colorCount to be < 2, for startRadius or endRadius to be < 0, or for
+ startRadius to be equal to endRadius.
+ @param start The center of the start circle for this gradient
+ @param startRadius Must be positive. The radius of the start circle for this gradient.
+ @param end The center of the end circle for this gradient
+ @param endRadius Must be positive. The radius of the end circle for this gradient.
+ @param colors The array[count] of colors, to be distributed between the center and edge of the circle
+ @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of
+ each corresponding color in the colors array. If this is NULL,
+ the the colors are distributed evenly between the center and edge of the circle.
+ If this is not null, the values must begin with 0, end with 1.0, and
+ intermediate values must be strictly increasing.
+ @param count Must be >= 2. The number of colors (and pos if not NULL) entries
+ @param mode The tiling mode
+ */
+ static SkShader* CreateTwoPointRadial(const SkPoint& start, SkScalar startRadius,
+ const SkPoint& end, SkScalar endRadius,
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode,
+ uint32_t flags, const SkMatrix* localMatrix);
+
+ static SkShader* CreateTwoPointRadial(const SkPoint& start, SkScalar startRadius,
+ const SkPoint& end, SkScalar endRadius,
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode) {
+ return CreateTwoPointRadial(start, startRadius, end, endRadius, colors, pos, count, mode,
+ 0, NULL);
+ }
+
+#ifdef SK_SUPPORT_LEGACY_GRADIENT_FACTORIES
+ static SkShader* CreateTwoPointRadial(const SkPoint& start, SkScalar startRadius,
+ const SkPoint& end, SkScalar endRadius,
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode, void* ignored,
+ uint32_t flags, const SkMatrix* localMatrix) {
+ return CreateTwoPointRadial(start, startRadius, end, endRadius, colors, pos, count, mode,
+ flags, localMatrix);
+ }
+#endif
+
+ /**
+ * Returns a shader that generates a conical gradient given two circles, or
+ * returns NULL if the inputs are invalid. The gradient interprets the
+ * two circles according to the following HTML spec.
+ * http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient
+ */
+ static SkShader* CreateTwoPointConical(const SkPoint& start, SkScalar startRadius,
+ const SkPoint& end, SkScalar endRadius,
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode,
+ uint32_t flags, const SkMatrix* localMatrix);
+
+ static SkShader* CreateTwoPointConical(const SkPoint& start, SkScalar startRadius,
+ const SkPoint& end, SkScalar endRadius,
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode) {
+ return CreateTwoPointConical(start, startRadius, end, endRadius, colors, pos, count, mode,
+ 0, NULL);
+ }
+
+#ifdef SK_SUPPORT_LEGACY_GRADIENT_FACTORIES
+ static SkShader* CreateTwoPointConical(const SkPoint& start, SkScalar startRadius,
+ const SkPoint& end, SkScalar endRadius,
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode, void* ignored,
+ uint32_t flags, const SkMatrix* localMatrix) {
+ return CreateTwoPointConical(start, startRadius, end, endRadius, colors, pos, count, mode,
+ flags, localMatrix);
+ }
+#endif
+
+ /** Returns a shader that generates a sweep gradient given a center.
+ <p />
+ CreateSweep returns a shader with a reference count of 1.
+ The caller should decrement the shader's reference count when done with the shader.
+ It is an error for colorCount to be < 2.
+ @param cx The X coordinate of the center of the sweep
+ @param cx The Y coordinate of the center of the sweep
+ @param colors The array[count] of colors, to be distributed around the center.
+ @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of
+ each corresponding color in the colors array. If this is NULL,
+ the the colors are distributed evenly between the center and edge of the circle.
+ If this is not null, the values must begin with 0, end with 1.0, and
+ intermediate values must be strictly increasing.
+ @param count Must be >= 2. The number of colors (and pos if not NULL) entries
+ */
+ static SkShader* CreateSweep(SkScalar cx, SkScalar cy,
+ const SkColor colors[], const SkScalar pos[], int count,
+ uint32_t flags, const SkMatrix* localMatrix);
+
+ static SkShader* CreateSweep(SkScalar cx, SkScalar cy,
+ const SkColor colors[], const SkScalar pos[], int count) {
+ return CreateSweep(cx, cy, colors, pos, count, 0, NULL);
+ }
+
+#ifdef SK_SUPPORT_LEGACY_GRADIENT_FACTORIES
+ static SkShader* CreateSweep(SkScalar cx, SkScalar cy,
+ const SkColor colors[], const SkScalar pos[], int count,
+ void* ignored,
+ uint32_t flags, const SkMatrix* localMatrix) {
+ return CreateSweep(cx, cy, colors, pos, count, flags, localMatrix);
+ }
+#endif
+
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkLayerDrawLooper.h b/src/third_party/skia/include/effects/SkLayerDrawLooper.h
new file mode 100644
index 0000000..5bb8b66
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkLayerDrawLooper.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkLayerDrawLooper_DEFINED
+#define SkLayerDrawLooper_DEFINED
+
+#include "SkDrawLooper.h"
+#include "SkPaint.h"
+#include "SkPoint.h"
+#include "SkXfermode.h"
+
+class SK_API SkLayerDrawLooper : public SkDrawLooper {
+public:
+ SK_DECLARE_INST_COUNT(SkLayerDrawLooper)
+
+ virtual ~SkLayerDrawLooper();
+
+ /**
+ * Bits specifies which aspects of the layer's paint should replace the
+ * corresponding aspects on the draw's paint.
+ * kEntirePaint_Bits means use the layer's paint completely.
+ * 0 means ignore the layer's paint... except for fColorMode, which is
+ * always applied.
+ */
+ enum Bits {
+ kStyle_Bit = 1 << 0, //!< use this layer's Style/stroke settings
+ kTextSkewX_Bit = 1 << 1, //!< use this layer's textskewx
+ kPathEffect_Bit = 1 << 2, //!< use this layer's patheffect
+ kMaskFilter_Bit = 1 << 3, //!< use this layer's maskfilter
+ kShader_Bit = 1 << 4, //!< use this layer's shader
+ kColorFilter_Bit = 1 << 5, //!< use this layer's colorfilter
+ kXfermode_Bit = 1 << 6, //!< use this layer's xfermode
+
+ /**
+ * Use the layer's paint entirely, with these exceptions:
+ * - We never override the draw's paint's text_encoding, since that is
+ * used to interpret the text/len parameters in draw[Pos]Text.
+ * - Color is always computed using the LayerInfo's fColorMode.
+ */
+ kEntirePaint_Bits = -1
+
+ };
+ typedef int32_t BitFlags;
+
+ /**
+ * Info for how to apply the layer's paint and offset.
+ *
+ * fColorMode controls how we compute the final color for the layer:
+ * The layer's paint's color is treated as the SRC
+ * The draw's paint's color is treated as the DST
+ * final-color = Mode(layers-color, draws-color);
+ * Any SkXfermode::Mode will work. Two common choices are:
+ * kSrc_Mode: to use the layer's color, ignoring the draw's
+ * kDst_Mode: to just keep the draw's color, ignoring the layer's
+ */
+ struct SK_API LayerInfo {
+ BitFlags fPaintBits;
+ SkXfermode::Mode fColorMode;
+ SkVector fOffset;
+ bool fPostTranslate; //!< applies to fOffset
+
+ /**
+ * Initial the LayerInfo. Defaults to settings that will draw the
+ * layer with no changes: e.g.
+ * fPaintBits == 0
+ * fColorMode == kDst_Mode
+ * fOffset == (0, 0)
+ */
+ LayerInfo();
+ };
+
+ virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVERRIDE;
+
+ virtual size_t contextSize() const SK_OVERRIDE { return sizeof(LayerDrawLooperContext); }
+
+ virtual bool asABlurShadow(BlurShadowRec* rec) const SK_OVERRIDE;
+
+ SK_TO_STRING_OVERRIDE()
+
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ static SkFlattenable* DeepCreateProc(SkReadBuffer& buffer) {
+ return CreateProc(buffer);
+ }
+ virtual Factory getFactory() const SK_OVERRIDE { return DeepCreateProc; }
+#else
+ virtual Factory getFactory() const SK_OVERRIDE { return CreateProc; }
+#endif
+ static SkFlattenable* CreateProc(SkReadBuffer& buffer);
+
+protected:
+ SkLayerDrawLooper();
+
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ struct Rec {
+ Rec* fNext;
+ SkPaint fPaint;
+ LayerInfo fInfo;
+ };
+ Rec* fRecs;
+ Rec* fTopRec;
+ int fCount;
+
+ // state-machine during the init/next cycle
+ class LayerDrawLooperContext : public SkDrawLooper::Context {
+ public:
+ explicit LayerDrawLooperContext(const SkLayerDrawLooper* looper);
+
+ protected:
+ virtual bool next(SkCanvas*, SkPaint* paint) SK_OVERRIDE;
+
+ private:
+ Rec* fCurrRec;
+
+ static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&);
+ };
+
+ class MyRegistrar : public SkFlattenable::Registrar {
+ public:
+ MyRegistrar();
+ };
+
+ typedef SkDrawLooper INHERITED;
+
+public:
+ class SK_API Builder {
+ public:
+ Builder();
+ ~Builder();
+
+ /**
+ * Call for each layer you want to add (from top to bottom).
+ * This returns a paint you can modify, but that ptr is only valid until
+ * the next call made to addLayer().
+ */
+ SkPaint* addLayer(const LayerInfo&);
+
+ /**
+ * This layer will draw with the original paint, at the specified offset
+ */
+ void addLayer(SkScalar dx, SkScalar dy);
+
+ /**
+ * This layer will with the original paint and no offset.
+ */
+ void addLayer() { this->addLayer(0, 0); }
+
+ /// Similar to addLayer, but adds a layer to the top.
+ SkPaint* addLayerOnTop(const LayerInfo&);
+
+ /**
+ * Pass list of layers on to newly built looper and return it. This will
+ * also reset the builder, so it can be used to build another looper.
+ */
+ SkLayerDrawLooper* detachLooper();
+
+ private:
+ Rec* fRecs;
+ Rec* fTopRec;
+ int fCount;
+ };
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkLayerRasterizer.h b/src/third_party/skia/include/effects/SkLayerRasterizer.h
new file mode 100644
index 0000000..60b3f20
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkLayerRasterizer.h
@@ -0,0 +1,92 @@
+
+/*
+ * Copyright 2006 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 SkLayerRasterizer_DEFINED
+#define SkLayerRasterizer_DEFINED
+
+#include "SkRasterizer.h"
+#include "SkDeque.h"
+#include "SkScalar.h"
+
+class SkPaint;
+
+class SK_API SkLayerRasterizer : public SkRasterizer {
+public:
+ virtual ~SkLayerRasterizer();
+
+ class SK_API Builder {
+ public:
+ Builder();
+ ~Builder();
+
+ void addLayer(const SkPaint& paint) {
+ this->addLayer(paint, 0, 0);
+ }
+
+ /**
+ * Add a new layer (above any previous layers) to the rasterizer.
+ * The layer will extract those fields that affect the mask from
+ * the specified paint, but will not retain a reference to the paint
+ * object itself, so it may be reused without danger of side-effects.
+ */
+ void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy);
+
+ /**
+ * Pass queue of layers on to newly created layer rasterizer and return it. The builder
+ * *cannot* be used any more after calling this function. If no layers have been added,
+ * returns NULL.
+ *
+ * The caller is responsible for calling unref() on the returned object, if non NULL.
+ */
+ SkLayerRasterizer* detachRasterizer();
+
+ /**
+ * Create and return a new immutable SkLayerRasterizer that contains a shapshot of the
+ * layers that were added to the Builder, without modifying the Builder. The Builder
+ * *may* be used after calling this function. It will continue to hold any layers
+ * previously added, so consecutive calls to this function will return identical objects,
+ * and objects returned by future calls to this function contain all the layers in
+ * previously returned objects. If no layers have been added, returns NULL.
+ *
+ * Future calls to addLayer will not affect rasterizers previously returned by this call.
+ *
+ * The caller is responsible for calling unref() on the returned object, if non NULL.
+ */
+ SkLayerRasterizer* snapshotRasterizer() const;
+
+ private:
+ SkDeque* fLayers;
+ };
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer)
+
+protected:
+ SkLayerRasterizer();
+ SkLayerRasterizer(SkDeque* layers);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkLayerRasterizer(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ // override from SkRasterizer
+ virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix,
+ const SkIRect* clipBounds,
+ SkMask* mask, SkMask::CreateMode mode) const;
+
+private:
+ const SkDeque* const fLayers;
+
+ static SkDeque* ReadLayers(SkReadBuffer& buffer);
+
+ friend class LayerRasterizerTester;
+
+ typedef SkRasterizer INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkLerpXfermode.h b/src/third_party/skia/include/effects/SkLerpXfermode.h
new file mode 100644
index 0000000..d779f16
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkLerpXfermode.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkLerpXfermode_DEFINED
+#define SkLerpXfermode_DEFINED
+
+#include "SkXfermode.h"
+
+class SK_API SkLerpXfermode : public SkXfermode {
+public:
+ /**
+ * result = scale * src + (1 - scale) * dst
+ *
+ * When scale == 1, this is the same as kSrc_Mode
+ * When scale == 0, this is the same as kDst_Mode
+ */
+ static SkXfermode* Create(SkScalar scale);
+
+ // overrides from SkXfermode
+ virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
+ const SkAlpha aa[]) const SK_OVERRIDE;
+ virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
+ const SkAlpha aa[]) const SK_OVERRIDE;
+ virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
+ const SkAlpha aa[]) const SK_OVERRIDE;
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLerpXfermode)
+
+protected:
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkLerpXfermode(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkLerpXfermode(unsigned scale256);
+
+ unsigned fScale256; // 0..256
+
+ typedef SkXfermode INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkLightingImageFilter.h b/src/third_party/skia/include/effects/SkLightingImageFilter.h
new file mode 100644
index 0000000..5fb0822
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkLightingImageFilter.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2012 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 SkLightingImageFilter_DEFINED
+#define SkLightingImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkColor.h"
+
+class SK_API SkPoint3 {
+public:
+ SkPoint3() {}
+ SkPoint3(SkScalar x, SkScalar y, SkScalar z)
+ : fX(x), fY(y), fZ(z) {}
+ SkScalar dot(const SkPoint3& other) const {
+ return fX * other.fX + fY * other.fY + fZ * other.fZ;
+ }
+ SkScalar maxComponent() const {
+ return fX > fY ? (fX > fZ ? fX : fZ) : (fY > fZ ? fY : fZ);
+ }
+ void normalize() {
+ // Small epsilon is added to prevent division by 0.
+ SkScalar scale = SkScalarInvert(SkScalarSqrt(dot(*this)) + SK_ScalarNearlyZero);
+ fX = fX * scale;
+ fY = fY * scale;
+ fZ = fZ * scale;
+ }
+ SkPoint3 operator*(SkScalar scalar) const {
+ return SkPoint3(fX * scalar, fY * scalar, fZ * scalar);
+ }
+ SkPoint3 operator-(const SkPoint3& other) const {
+ return SkPoint3(fX - other.fX, fY - other.fY, fZ - other.fZ);
+ }
+ bool operator==(const SkPoint3& other) const {
+ return fX == other.fX && fY == other.fY && fZ == other.fZ;
+ }
+ SkScalar fX, fY, fZ;
+};
+
+class SkLight;
+
+class SK_API SkLightingImageFilter : public SkImageFilter {
+public:
+ static SkImageFilter* CreateDistantLitDiffuse(const SkPoint3& direction,
+ SkColor lightColor, SkScalar surfaceScale, SkScalar kd,
+ SkImageFilter* input = NULL, const CropRect* cropRect = NULL);
+ static SkImageFilter* CreatePointLitDiffuse(const SkPoint3& location,
+ SkColor lightColor, SkScalar surfaceScale, SkScalar kd,
+ SkImageFilter* input = NULL, const CropRect* cropRect = NULL);
+ static SkImageFilter* CreateSpotLitDiffuse(const SkPoint3& location,
+ const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle,
+ SkColor lightColor, SkScalar surfaceScale, SkScalar kd,
+ SkImageFilter* input = NULL, const CropRect* cropRect = NULL);
+ static SkImageFilter* CreateDistantLitSpecular(const SkPoint3& direction,
+ SkColor lightColor, SkScalar surfaceScale, SkScalar ks,
+ SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRect = NULL);
+ static SkImageFilter* CreatePointLitSpecular(const SkPoint3& location,
+ SkColor lightColor, SkScalar surfaceScale, SkScalar ks,
+ SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRect = NULL);
+ static SkImageFilter* CreateSpotLitSpecular(const SkPoint3& location,
+ const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle,
+ SkColor lightColor, SkScalar surfaceScale, SkScalar ks,
+ SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRect = NULL);
+ ~SkLightingImageFilter();
+
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
+
+protected:
+ SkLightingImageFilter(SkLight* light,
+ SkScalar surfaceScale,
+ SkImageFilter* input,
+ const CropRect* cropRect,
+ uint32_t uniqueID);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkLightingImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+ const SkLight* light() const { return fLight.get(); }
+ SkScalar surfaceScale() const { return fSurfaceScale; }
+
+private:
+ typedef SkImageFilter INHERITED;
+ SkAutoTUnref<SkLight> fLight;
+ SkScalar fSurfaceScale;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkLumaColorFilter.h b/src/third_party/skia/include/effects/SkLumaColorFilter.h
new file mode 100644
index 0000000..420999f
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkLumaColorFilter.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkLumaColorFilter_DEFINED
+#define SkLumaColorFilter_DEFINED
+
+#include "SkColorFilter.h"
+
+/**
+ * Luminance-to-alpha color filter, as defined in
+ * http://www.w3.org/TR/SVG/masking.html#Masking
+ * http://www.w3.org/TR/css-masking/#MaskValues
+ *
+ * The resulting color is black with transparency equal to the
+ * luminance value modulated by alpha:
+ *
+ * C' = [ Lum * a, 0, 0, 0 ]
+ *
+ */
+class SK_API SkLumaColorFilter : public SkColorFilter {
+public:
+ static SkColorFilter* Create();
+
+ virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const SK_OVERRIDE;
+
+#if SK_SUPPORT_GPU
+ virtual GrFragmentProcessor* asFragmentProcessor(GrContext*) const SK_OVERRIDE;
+#endif
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaColorFilter)
+
+protected:
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkLumaColorFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkLumaColorFilter();
+
+ typedef SkColorFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkMagnifierImageFilter.h b/src/third_party/skia/include/effects/SkMagnifierImageFilter.h
new file mode 100644
index 0000000..4dd47ef
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkMagnifierImageFilter.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2012 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 SkMagnifierImageFilter_DEFINED
+#define SkMagnifierImageFilter_DEFINED
+
+#include "SkRect.h"
+#include "SkImageFilter.h"
+
+class SK_API SkMagnifierImageFilter : public SkImageFilter {
+public:
+ static SkImageFilter* Create(const SkRect& src, SkScalar inset, SkImageFilter* input = NULL);
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter)
+
+protected:
+ SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset, SkImageFilter* input);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkMagnifierImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+#if SK_SUPPORT_GPU
+ virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
+ const SkIRect& bounds) const SK_OVERRIDE;
+#endif
+
+private:
+ SkRect fSrcRect;
+ SkScalar fInset;
+ typedef SkImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkMatrixConvolutionImageFilter.h b/src/third_party/skia/include/effects/SkMatrixConvolutionImageFilter.h
new file mode 100644
index 0000000..c04d7d1
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkMatrixConvolutionImageFilter.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2012 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 SkMatrixConvolutionImageFilter_DEFINED
+#define SkMatrixConvolutionImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkScalar.h"
+#include "SkSize.h"
+#include "SkPoint.h"
+
+/*! \class SkMatrixConvolutionImageFilter
+ Matrix convolution image filter. This filter applies an NxM image
+ processing kernel to a given input image. This can be used to produce
+ effects such as sharpening, blurring, edge detection, etc.
+ */
+
+class SK_API SkMatrixConvolutionImageFilter : public SkImageFilter {
+public:
+ /*! \enum TileMode */
+ enum TileMode {
+ kClamp_TileMode = 0, /*!< Clamp to the image's edge pixels. */
+ kRepeat_TileMode, /*!< Wrap around to the image's opposite edge. */
+ kClampToBlack_TileMode, /*!< Fill with transparent black. */
+ kMax_TileMode = kClampToBlack_TileMode
+ };
+
+ virtual ~SkMatrixConvolutionImageFilter();
+
+ /** Construct a matrix convolution image filter.
+ @param kernelSize The kernel size in pixels, in each dimension (N by M).
+ @param kernel The image processing kernel. Must contain N * M
+ elements, in row order.
+ @param gain A scale factor applied to each pixel after
+ convolution. This can be used to normalize the
+ kernel, if it does not sum to 1.
+ @param bias A bias factor added to each pixel after convolution.
+ @param kernelOffset An offset applied to each pixel coordinate before
+ convolution. This can be used to center the kernel
+ over the image (e.g., a 3x3 kernel should have an
+ offset of {1, 1}).
+ @param tileMode How accesses outside the image are treated. (@see
+ TileMode).
+ @param convolveAlpha If true, all channels are convolved. If false,
+ only the RGB channels are convolved, and
+ alpha is copied from the source image.
+ @param input The input image filter. If NULL, the src bitmap
+ passed to filterImage() is used instead.
+ @param cropRect The rectangle to which the output processing will be limited.
+ */
+ static SkMatrixConvolutionImageFilter* Create(const SkISize& kernelSize,
+ const SkScalar* kernel,
+ SkScalar gain,
+ SkScalar bias,
+ const SkIPoint& kernelOffset,
+ TileMode tileMode,
+ bool convolveAlpha,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL,
+ uint32_t uniqueID = 0);
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixConvolutionImageFilter)
+
+protected:
+ SkMatrixConvolutionImageFilter(const SkISize& kernelSize,
+ const SkScalar* kernel,
+ SkScalar gain,
+ SkScalar bias,
+ const SkIPoint& kernelOffset,
+ TileMode tileMode,
+ bool convolveAlpha,
+ SkImageFilter* input,
+ const CropRect* cropRect,
+ uint32_t uniqueID);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkMatrixConvolutionImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const SK_OVERRIDE;
+
+
+#if SK_SUPPORT_GPU
+ virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
+ const SkIRect& bounds) const SK_OVERRIDE;
+#endif
+
+private:
+ SkISize fKernelSize;
+ SkScalar* fKernel;
+ SkScalar fGain;
+ SkScalar fBias;
+ SkIPoint fKernelOffset;
+ TileMode fTileMode;
+ bool fConvolveAlpha;
+ typedef SkImageFilter INHERITED;
+
+ template <class PixelFetcher, bool convolveAlpha>
+ void filterPixels(const SkBitmap& src,
+ SkBitmap* result,
+ const SkIRect& rect,
+ const SkIRect& bounds) const;
+ template <class PixelFetcher>
+ void filterPixels(const SkBitmap& src,
+ SkBitmap* result,
+ const SkIRect& rect,
+ const SkIRect& bounds) const;
+ void filterInteriorPixels(const SkBitmap& src,
+ SkBitmap* result,
+ const SkIRect& rect,
+ const SkIRect& bounds) const;
+ void filterBorderPixels(const SkBitmap& src,
+ SkBitmap* result,
+ const SkIRect& rect,
+ const SkIRect& bounds) const;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkMatrixImageFilter.h b/src/third_party/skia/include/effects/SkMatrixImageFilter.h
new file mode 100644
index 0000000..ae6a0b7
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkMatrixImageFilter.h
@@ -0,0 +1,62 @@
+/*
+ * 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 SkMatrixImageFilter_DEFINED
+#define SkMatrixImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkScalar.h"
+#include "SkSize.h"
+#include "SkPoint.h"
+#include "SkPaint.h"
+
+/*! \class SkMatrixImageFilter
+ Matrix transformation image filter. This filter draws its source
+ input transformed by the given matrix.
+ */
+
+class SK_API SkMatrixImageFilter : public SkImageFilter {
+public:
+ /** 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 SkMatrixImageFilter* Create(const SkMatrix& transform,
+ SkPaint::FilterLevel,
+ SkImageFilter* input = NULL,
+ uint32_t uniqueID = 0);
+ virtual ~SkMatrixImageFilter();
+
+ virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixImageFilter)
+
+protected:
+ SkMatrixImageFilter(const SkMatrix& transform,
+ SkPaint::FilterLevel,
+ SkImageFilter* input,
+ uint32_t uniqueID);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkMatrixImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
+ SkIRect* dst) const SK_OVERRIDE;
+
+private:
+ SkMatrix fTransform;
+ SkPaint::FilterLevel fFilterLevel;
+ typedef SkImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkMergeImageFilter.h b/src/third_party/skia/include/effects/SkMergeImageFilter.h
new file mode 100644
index 0000000..5e723aa
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkMergeImageFilter.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2012 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 SkMergeImageFilter_DEFINED
+#define SkMergeImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+
+#include "SkXfermode.h"
+
+class SK_API SkMergeImageFilter : public SkImageFilter {
+public:
+ virtual ~SkMergeImageFilter();
+
+ static SkMergeImageFilter* Create(SkImageFilter* first, SkImageFilter* second,
+ SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode,
+ const CropRect* cropRect = NULL,
+ uint32_t uniqueID = 0) {
+ SkImageFilter* inputs[2] = { first, second };
+ SkXfermode::Mode modes[2] = { mode, mode };
+ return SkNEW_ARGS(SkMergeImageFilter, (inputs, 2, modes, cropRect, uniqueID));
+ }
+ static SkMergeImageFilter* Create(SkImageFilter* filters[], int count,
+ const SkXfermode::Mode modes[] = NULL,
+ const CropRect* cropRect = NULL,
+ uint32_t uniqueID = 0) {
+ return SkNEW_ARGS(SkMergeImageFilter, (filters, count, modes, cropRect, uniqueID));
+ }
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter)
+
+protected:
+ SkMergeImageFilter(SkImageFilter* filters[], int count,
+ const SkXfermode::Mode modes[],
+ const CropRect* cropRect,
+ uint32_t uniqueID);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkMergeImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+
+private:
+ uint8_t* fModes; // SkXfermode::Mode
+
+ // private storage, to avoid dynamically allocating storage for our copy
+ // of the modes (unless the count is so large we can't fit).
+ intptr_t fStorage[16];
+
+ void initAllocModes();
+ void initModes(const SkXfermode::Mode []);
+
+ typedef SkImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkMorphologyImageFilter.h b/src/third_party/skia/include/effects/SkMorphologyImageFilter.h
new file mode 100644
index 0000000..3f2be45
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkMorphologyImageFilter.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2012 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 SkMorphologyImageFilter_DEFINED
+#define SkMorphologyImageFilter_DEFINED
+
+#include "SkColor.h"
+#include "SkImageFilter.h"
+#include "SkSize.h"
+
+class SK_API SkMorphologyImageFilter : public SkImageFilter {
+public:
+ virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const SK_OVERRIDE;
+
+ /**
+ * All morphology procs have the same signature: src is the source buffer, dst the
+ * destination buffer, radius is the morphology radius, width and height are the bounds
+ * of the destination buffer (in pixels), and srcStride and dstStride are the
+ * number of pixels per row in each buffer. All buffers are 8888.
+ */
+
+ typedef void (*Proc)(const SkPMColor* src, SkPMColor* dst, int radius,
+ int width, int height, int srcStride, int dstStride);
+
+protected:
+ SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input,
+ const CropRect* cropRect, uint32_t uniqueID);
+ bool filterImageGeneric(Proc procX, Proc procY,
+ Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* offset) const;
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkMorphologyImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+#if SK_SUPPORT_GPU
+ virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
+ bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src,
+ const Context& ctm, SkBitmap* result,
+ SkIPoint* offset) const;
+#endif
+
+ SkISize radius() const { return fRadius; }
+
+private:
+ SkISize fRadius;
+ typedef SkImageFilter INHERITED;
+};
+
+class SK_API SkDilateImageFilter : public SkMorphologyImageFilter {
+public:
+ static SkDilateImageFilter* Create(int radiusX, int radiusY,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL,
+ uint32_t uniqueID = 0) {
+ if (radiusX < 0 || radiusY < 0) {
+ return NULL;
+ }
+ return SkNEW_ARGS(SkDilateImageFilter, (radiusX, radiusY, input, cropRect, uniqueID));
+ }
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+#if SK_SUPPORT_GPU
+ virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+#endif
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
+
+protected:
+ SkDilateImageFilter(int radiusX, int radiusY, SkImageFilter* input, const CropRect* cropRect, uint32_t uniqueID)
+ : INHERITED(radiusX, radiusY, input, cropRect, uniqueID) {}
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkDilateImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
+#endif
+
+private:
+ typedef SkMorphologyImageFilter INHERITED;
+};
+
+class SK_API SkErodeImageFilter : public SkMorphologyImageFilter {
+public:
+ static SkErodeImageFilter* Create(int radiusX, int radiusY,
+ SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL,
+ uint32_t uniqueID = 0) {
+ if (radiusX < 0 || radiusY < 0) {
+ return NULL;
+ }
+ return SkNEW_ARGS(SkErodeImageFilter, (radiusX, radiusY, input, cropRect, uniqueID));
+ }
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+#if SK_SUPPORT_GPU
+ virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+#endif
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)
+
+protected:
+ SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input, const CropRect* cropRect, uint32_t uniqueID)
+ : INHERITED(radiusX, radiusY, input, cropRect, uniqueID) {}
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkErodeImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
+#endif
+
+private:
+ typedef SkMorphologyImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkOffsetImageFilter.h b/src/third_party/skia/include/effects/SkOffsetImageFilter.h
new file mode 100644
index 0000000..a870c0b
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkOffsetImageFilter.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2012 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 SkOffsetImageFilter_DEFINED
+#define SkOffsetImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkPoint.h"
+
+class SK_API SkOffsetImageFilter : public SkImageFilter {
+ typedef SkImageFilter INHERITED;
+
+public:
+ static SkOffsetImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input = NULL,
+ const CropRect* cropRect = NULL,
+ uint32_t uniqueID = 0) {
+ if (!SkScalarIsFinite(dx) || !SkScalarIsFinite(dy)) {
+ return NULL;
+ }
+ return SkNEW_ARGS(SkOffsetImageFilter, (dx, dy, input, cropRect, uniqueID));
+ }
+ virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkOffsetImageFilter)
+
+protected:
+ SkOffsetImageFilter(SkScalar dx, SkScalar dy, SkImageFilter* input, const CropRect* cropRect, uint32_t uniqueID);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkOffsetImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const SK_OVERRIDE;
+
+private:
+ SkVector fOffset;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkPaintFlagsDrawFilter.h b/src/third_party/skia/include/effects/SkPaintFlagsDrawFilter.h
new file mode 100644
index 0000000..cb2a8b7
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkPaintFlagsDrawFilter.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 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 SkPaintFlagsDrawFilter_DEFINED
+#define SkPaintFlagsDrawFilter_DEFINED
+
+#include "SkDrawFilter.h"
+
+class SK_API SkPaintFlagsDrawFilter : public SkDrawFilter {
+public:
+ SkPaintFlagsDrawFilter(uint32_t clearFlags, uint32_t setFlags);
+
+ virtual bool filter(SkPaint*, Type) SK_OVERRIDE;
+
+private:
+ uint16_t fClearFlags; // user specified
+ uint16_t fSetFlags; // user specified
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkPerlinNoiseShader.h b/src/third_party/skia/include/effects/SkPerlinNoiseShader.h
new file mode 100644
index 0000000..2937926
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkPerlinNoiseShader.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPerlinNoiseShader_DEFINED
+#define SkPerlinNoiseShader_DEFINED
+
+#include "SkShader.h"
+
+/** \class SkPerlinNoiseShader
+
+ SkPerlinNoiseShader creates an image using the Perlin turbulence function.
+
+ It can produce tileable noise if asked to stitch tiles and provided a tile size.
+ In order to fill a large area with repeating noise, set the stitchTiles flag to
+ true, and render exactly a single tile of noise. Without this flag, the result
+ will contain visible seams between tiles.
+
+ The algorithm used is described here :
+ http://www.w3.org/TR/SVG/filters.html#feTurbulenceElement
+*/
+class SK_API SkPerlinNoiseShader : public SkShader {
+public:
+ struct StitchData;
+ struct PaintingData;
+
+ /**
+ * About the noise types : the difference between the 2 is just minor tweaks to the algorithm,
+ * they're not 2 entirely different noises. The output looks different, but once the noise is
+ * generated in the [1, -1] range, the output is brought back in the [0, 1] range by doing :
+ * kFractalNoise_Type : noise * 0.5 + 0.5
+ * kTurbulence_Type : abs(noise)
+ * Very little differences between the 2 types, although you can tell the difference visually.
+ */
+ enum Type {
+ kFractalNoise_Type,
+ kTurbulence_Type,
+ kFirstType = kFractalNoise_Type,
+ kLastType = kTurbulence_Type
+ };
+ /**
+ * This will construct Perlin noise of the given type (Fractal Noise or Turbulence).
+ *
+ * Both base frequencies (X and Y) have a usual range of (0..1).
+ *
+ * The number of octaves provided should be fairly small, although no limit is enforced.
+ * Each octave doubles the frequency, so 10 octaves would produce noise from
+ * baseFrequency * 1, * 2, * 4, ..., * 512, which quickly yields insignificantly small
+ * periods and resembles regular unstructured noise rather than Perlin noise.
+ *
+ * If tileSize isn't NULL or an empty size, the tileSize parameter will be used to modify
+ * the frequencies so that the noise will be tileable for the given tile size. If tileSize
+ * is NULL or an empty size, the frequencies will be used as is without modification.
+ */
+ static SkShader* CreateFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
+ int numOctaves, SkScalar seed,
+ const SkISize* tileSize = NULL);
+ static SkShader* CreateTurbulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
+ int numOctaves, SkScalar seed,
+ const SkISize* tileSize = NULL);
+ /**
+ * Create alias for CreateTurbulunce until all Skia users changed
+ * its code to use the new naming
+ */
+ static SkShader* CreateTubulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
+ int numOctaves, SkScalar seed,
+ const SkISize* tileSize = NULL) {
+ return CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, tileSize);
+ }
+
+
+ virtual size_t contextSize() const SK_OVERRIDE;
+
+ class PerlinNoiseShaderContext : public SkShader::Context {
+ public:
+ PerlinNoiseShaderContext(const SkPerlinNoiseShader& shader, const ContextRec&);
+ virtual ~PerlinNoiseShaderContext();
+
+ virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
+ virtual void shadeSpan16(int x, int y, uint16_t[], int count) SK_OVERRIDE;
+
+ private:
+ SkPMColor shade(const SkPoint& point, StitchData& stitchData) const;
+ SkScalar calculateTurbulenceValueForPoint(
+ int channel,
+ StitchData& stitchData, const SkPoint& point) const;
+ SkScalar noise2D(int channel,
+ const StitchData& stitchData, const SkPoint& noiseVector) const;
+
+ SkMatrix fMatrix;
+ PaintingData* fPaintingData;
+
+ typedef SkShader::Context INHERITED;
+ };
+
+ virtual bool asFragmentProcessor(GrContext* context, const SkPaint&, const SkMatrix*, GrColor*,
+ GrFragmentProcessor**) const SK_OVERRIDE;
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader)
+
+protected:
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkPerlinNoiseShader(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+ virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE;
+
+private:
+ SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX,
+ SkScalar baseFrequencyY, int numOctaves, SkScalar seed,
+ const SkISize* tileSize);
+ virtual ~SkPerlinNoiseShader();
+
+ // TODO (scroggo): Once all SkShaders are created from a factory, and we have removed the
+ // constructor that creates SkPerlinNoiseShader from an SkReadBuffer, several fields can
+ // be made constant.
+ /*const*/ SkPerlinNoiseShader::Type fType;
+ /*const*/ SkScalar fBaseFrequencyX;
+ /*const*/ SkScalar fBaseFrequencyY;
+ /*const*/ int fNumOctaves;
+ /*const*/ SkScalar fSeed;
+ /*const*/ SkISize fTileSize;
+ /*const*/ bool fStitchTiles;
+
+ typedef SkShader INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkPictureImageFilter.h b/src/third_party/skia/include/effects/SkPictureImageFilter.h
new file mode 100644
index 0000000..fbd04f0
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkPictureImageFilter.h
@@ -0,0 +1,58 @@
+/*
+ * 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 SkPictureImageFilter_DEFINED
+#define SkPictureImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkPicture.h"
+
+class SK_API SkPictureImageFilter : public SkImageFilter {
+public:
+ /**
+ * Refs the passed-in picture.
+ */
+ static SkPictureImageFilter* Create(const SkPicture* picture, int32_t uniqueID = 0) {
+ return SkNEW_ARGS(SkPictureImageFilter, (picture, uniqueID));
+ }
+
+ /**
+ * Refs the passed-in picture. cropRect can be used to crop or expand the destination rect when
+ * the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.)
+ */
+ static SkPictureImageFilter* Create(const SkPicture* picture, const SkRect& cropRect, uint32_t uniqueID = 0) {
+ return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect, uniqueID));
+ }
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)
+
+protected:
+ explicit SkPictureImageFilter(const SkPicture* picture, uint32_t uniqueID);
+ SkPictureImageFilter(const SkPicture* picture, const SkRect& cropRect, uint32_t uniqueID);
+ virtual ~SkPictureImageFilter();
+ /* Constructs an SkPictureImageFilter object from an SkReadBuffer.
+ * Note: If the SkPictureImageFilter object construction requires bitmap
+ * decoding, the decoder must be set on the SkReadBuffer parameter by calling
+ * SkReadBuffer::setBitmapDecoder() before calling this constructor.
+ * @param SkReadBuffer Serialized picture data.
+ */
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkPictureImageFilter(SkReadBuffer&);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
+ SkIRect* dst) const SK_OVERRIDE;
+
+private:
+ const SkPicture* fPicture;
+ SkRect fCropRect;
+ typedef SkImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkPixelXorXfermode.h b/src/third_party/skia/include/effects/SkPixelXorXfermode.h
new file mode 100644
index 0000000..eb485b4
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkPixelXorXfermode.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2007 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 SkPixelXorXfermode_DEFINED
+#define SkPixelXorXfermode_DEFINED
+
+#include "SkXfermode.h"
+
+/** SkPixelXorXfermode implements a simple pixel xor (op ^ src ^ dst).
+ This transformation does not follow premultiplied conventions, therefore
+ this proc *always* returns an opaque color (alpha == 255). Thus it is
+ not really usefull for operating on blended colors.
+*/
+class SK_API SkPixelXorXfermode : public SkXfermode {
+public:
+ static SkPixelXorXfermode* Create(SkColor opColor) {
+ return SkNEW_ARGS(SkPixelXorXfermode, (opColor));
+ }
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPixelXorXfermode)
+
+protected:
+ explicit SkPixelXorXfermode(SkColor opColor) : fOpColor(opColor) {}
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkPixelXorXfermode(SkReadBuffer& rb);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ // override from SkXfermode
+ virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const;
+
+private:
+ SkColor fOpColor;
+
+ typedef SkXfermode INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkPorterDuff.h b/src/third_party/skia/include/effects/SkPorterDuff.h
new file mode 100644
index 0000000..e984e8e
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkPorterDuff.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2006 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 SkPorterDuff_DEFINED
+#define SkPorterDuff_DEFINED
+
+#include "SkColor.h"
+#include "SkXfermode.h"
+
+class SkXfermode;
+
+class SK_API SkPorterDuff {
+public:
+ /** List of predefined xfermodes. In general, the algebra for the modes
+ uses the following symbols:
+ Sa, Sc - source alpha and color
+ Da, Dc - destination alpha and color (before compositing)
+ [a, c] - Resulting (alpha, color) values
+ For these equations, the colors are in premultiplied state.
+ If no xfermode is specified, kSrcOver is assumed.
+ */
+ enum Mode {
+ kClear_Mode, //!< [0, 0]
+ kSrc_Mode, //!< [Sa, Sc]
+ kDst_Mode, //!< [Da, Dc]
+ kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc]
+ kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc]
+ kSrcIn_Mode, //!< [Sa * Da, Sc * Da]
+ kDstIn_Mode, //!< [Sa * Da, Sa * Dc]
+ kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)]
+ kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)]
+ kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc]
+ kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)]
+ kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
+ kDarken_Mode, //!< [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)]
+ kLighten_Mode, //!< [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)]
+ kModulate_Mode, //!< [Sa * Da, Sc * Dc] multiplies all components
+ kScreen_Mode, //!< [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc]
+ kAdd_Mode, //!< Saturate(S + D)
+#ifdef SK_BUILD_FOR_ANDROID
+ kOverlay_Mode,
+#endif
+
+ kModeCount
+ };
+
+ /** Return an SkXfermode object for the specified mode.
+ */
+ static SkXfermode* CreateXfermode(Mode mode);
+
+ /** Return a function pointer to a routine that applies the specified
+ porter-duff transfer mode.
+ */
+ static SkXfermodeProc GetXfermodeProc(Mode mode);
+
+ /** Return a function pointer to a routine that applies the specified
+ porter-duff transfer mode and srcColor to a 16bit device color. Note,
+ if the mode+srcColor might return a non-opaque color, then there is not
+ 16bit proc, and this will return NULL.
+ */
+ static SkXfermodeProc16 GetXfermodeProc16(Mode mode, SkColor srcColor);
+
+ /** If the specified xfermode advertises itself as one of the porterduff
+ modes (via SkXfermode::Coeff), return true and if not null, set mode
+ to the corresponding porterduff mode. If it is not recognized as a one,
+ return false and ignore the mode parameter.
+ */
+ static bool IsMode(SkXfermode*, Mode* mode);
+
+ /** Return the corersponding SkXfermode::Mode
+ */
+ static SkXfermode::Mode ToXfermodeMode(Mode);
+} SK_ATTR_DEPRECATED("use SkXfermode::Mode");
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkRectShaderImageFilter.h b/src/third_party/skia/include/effects/SkRectShaderImageFilter.h
new file mode 100644
index 0000000..c4311db
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkRectShaderImageFilter.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkRectShaderImageFilter_DEFINED
+#define SkRectShaderImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+#include "SkRect.h"
+
+class SkShader;
+
+class SK_API SkRectShaderImageFilter : public SkImageFilter {
+public:
+ /** Create a new image filter which fills the given rectangle with pixels
+ * produced by the given SkShader. If no rectangle is specified, an output
+ * is produced with the same bounds as the input primitive (even though
+ * the input primitive's pixels are not used for processing).
+ * @param s Shader to call for processing. Cannot be NULL. Will be
+ * ref'ed by the new image filter.
+ * @param rect Rectangle of output pixels in which to apply the shader.
+ * If NULL or a given crop edge is not specified, the source
+ * primitive's bounds are used instead.
+ */
+ SK_ATTR_DEPRECATED("use Create(SkShader*, const CropRect*)")
+ static SkRectShaderImageFilter* Create(SkShader* s, const SkRect& rect);
+
+ static SkRectShaderImageFilter* Create(SkShader* s, const CropRect* rect = NULL, uint32_t uniqueID = 0);
+ virtual ~SkRectShaderImageFilter();
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRectShaderImageFilter)
+
+protected:
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkRectShaderImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+
+private:
+ SkRectShaderImageFilter(SkShader* s, const CropRect* rect, uint32_t uniqueID = 0);
+ SkShader* fShader;
+
+ typedef SkImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkTableColorFilter.h b/src/third_party/skia/include/effects/SkTableColorFilter.h
new file mode 100644
index 0000000..5714d07
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkTableColorFilter.h
@@ -0,0 +1,36 @@
+
+#ifndef SkTableColorFilter_DEFINED
+#define SkTableColorFilter_DEFINED
+
+#include "SkColorFilter.h"
+
+class SK_API SkTableColorFilter {
+public:
+ /**
+ * Create a table colorfilter, copying the table into the filter, and
+ * applying it to all 4 components.
+ * a' = table[a];
+ * r' = table[r];
+ * g' = table[g];
+ * b' = table[b];
+ * Compoents are operated on in unpremultiplied space. If the incomming
+ * colors are premultiplied, they are temporarily unpremultiplied, then
+ * the table is applied, and then the result is remultiplied.
+ */
+ static SkColorFilter* Create(const uint8_t table[256]);
+
+ /**
+ * Create a table colorfilter, with a different table for each
+ * component [A, R, G, B]. If a given table is NULL, then it is
+ * treated as identity, with the component left unchanged. If a table
+ * is not null, then its contents are copied into the filter.
+ */
+ static SkColorFilter* CreateARGB(const uint8_t tableA[256],
+ const uint8_t tableR[256],
+ const uint8_t tableG[256],
+ const uint8_t tableB[256]);
+
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkTableMaskFilter.h b/src/third_party/skia/include/effects/SkTableMaskFilter.h
new file mode 100644
index 0000000..8b94179
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkTableMaskFilter.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2006 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 SkTableMaskFilter_DEFINED
+#define SkTableMaskFilter_DEFINED
+
+#include "SkMaskFilter.h"
+#include "SkScalar.h"
+
+/** \class SkTableMaskFilter
+
+ Applies a table lookup on each of the alpha values in the mask.
+ Helper methods create some common tables (e.g. gamma, clipping)
+ */
+class SK_API SkTableMaskFilter : public SkMaskFilter {
+public:
+ virtual ~SkTableMaskFilter();
+
+ /** Utility that sets the gamma table
+ */
+ static void MakeGammaTable(uint8_t table[256], SkScalar gamma);
+
+ /** Utility that creates a clipping table: clamps values below min to 0
+ and above max to 255, and rescales the remaining into 0..255
+ */
+ static void MakeClipTable(uint8_t table[256], uint8_t min, uint8_t max);
+
+ static SkTableMaskFilter* Create(const uint8_t table[256]) {
+ return SkNEW_ARGS(SkTableMaskFilter, (table));
+ }
+
+ static SkTableMaskFilter* CreateGamma(SkScalar gamma) {
+ uint8_t table[256];
+ MakeGammaTable(table, gamma);
+ return SkNEW_ARGS(SkTableMaskFilter, (table));
+ }
+
+ static SkTableMaskFilter* CreateClip(uint8_t min, uint8_t max) {
+ uint8_t table[256];
+ MakeClipTable(table, min, max);
+ return SkNEW_ARGS(SkTableMaskFilter, (table));
+ }
+
+ virtual SkMask::Format getFormat() const SK_OVERRIDE;
+ virtual bool filterMask(SkMask*, const SkMask&, const SkMatrix&,
+ SkIPoint*) const SK_OVERRIDE;
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTableMaskFilter)
+
+protected:
+ SkTableMaskFilter();
+ explicit SkTableMaskFilter(const uint8_t table[256]);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkTableMaskFilter(SkReadBuffer& rb);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ uint8_t fTable[256];
+
+ typedef SkMaskFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkTestImageFilters.h b/src/third_party/skia/include/effects/SkTestImageFilters.h
new file mode 100644
index 0000000..a8186e0
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkTestImageFilters.h
@@ -0,0 +1,40 @@
+#ifndef _SkTestImageFilters_h
+#define _SkTestImageFilters_h
+
+#include "SkImageFilter.h"
+#include "SkPoint.h"
+
+// Fun mode that scales down (only) and then scales back up to look pixelated
+class SK_API SkDownSampleImageFilter : public SkImageFilter {
+public:
+ static SkDownSampleImageFilter* Create(SkScalar scale, SkImageFilter* input = NULL) {
+ if (!SkScalarIsFinite(scale)) {
+ return NULL;
+ }
+ // we don't support scale in this range
+ if (scale > SK_Scalar1 || scale <= 0) {
+ return NULL;
+ }
+ return SkNEW_ARGS(SkDownSampleImageFilter, (scale, input));
+ }
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter)
+
+protected:
+ SkDownSampleImageFilter(SkScalar scale, SkImageFilter* input)
+ : INHERITED(1, &input), fScale(scale) {}
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkDownSampleImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+
+private:
+ SkScalar fScale;
+
+ typedef SkImageFilter INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkTileImageFilter.h b/src/third_party/skia/include/effects/SkTileImageFilter.h
new file mode 100644
index 0000000..440337a
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkTileImageFilter.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkTileImageFilter_DEFINED
+#define SkTileImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+
+class SK_API SkTileImageFilter : public SkImageFilter {
+ typedef SkImageFilter INHERITED;
+
+public:
+ /** Create a tile image filter
+ @param srcRect Defines the pixels to tile
+ @param dstRect Defines the pixels where tiles are drawn
+ @param input Input from which the subregion defined by srcRect will be tiled
+ */
+ static SkTileImageFilter* Create(const SkRect& srcRect, const SkRect& dstRect,
+ SkImageFilter* input, uint32_t uniqueID = 0);
+
+ virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
+ SkBitmap* dst, SkIPoint* offset) const SK_OVERRIDE;
+ virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
+ SkIRect* dst) const SK_OVERRIDE;
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTileImageFilter)
+
+protected:
+ SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, SkImageFilter* input, uint32_t uniqueID)
+ : INHERITED(1, &input, NULL, uniqueID), fSrcRect(srcRect), fDstRect(dstRect) {}
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkTileImageFilter(SkReadBuffer& buffer);
+#endif
+
+ virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
+
+private:
+ SkRect fSrcRect;
+ SkRect fDstRect;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkTransparentShader.h b/src/third_party/skia/include/effects/SkTransparentShader.h
new file mode 100644
index 0000000..e23687c
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkTransparentShader.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2006 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 SkTransparentShader_DEFINED
+#define SkTransparentShader_DEFINED
+
+#include "SkShader.h"
+
+class SK_API SkTransparentShader : public SkShader {
+public:
+ SkTransparentShader() {}
+
+ virtual size_t contextSize() const SK_OVERRIDE;
+
+ class TransparentShaderContext : public SkShader::Context {
+ public:
+ TransparentShaderContext(const SkTransparentShader& shader, const ContextRec&);
+ virtual ~TransparentShaderContext();
+
+ virtual uint32_t getFlags() const SK_OVERRIDE;
+ virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
+ virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
+
+ private:
+ const SkBitmap* fDevice;
+
+ typedef SkShader::Context INHERITED;
+ };
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader)
+
+protected:
+ virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE;
+
+ // we don't need to flatten anything at all
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE {}
+
+private:
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ SkTransparentShader(SkReadBuffer& buffer) : INHERITED(buffer) {}
+#endif
+
+ typedef SkShader INHERITED;
+};
+
+#endif
diff --git a/src/third_party/skia/include/effects/SkXfermodeImageFilter.h b/src/third_party/skia/include/effects/SkXfermodeImageFilter.h
new file mode 100644
index 0000000..6736889
--- /dev/null
+++ b/src/third_party/skia/include/effects/SkXfermodeImageFilter.h
@@ -0,0 +1,60 @@
+/*
+ * 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 SkXfermodeImageFilter_DEFINED
+#define SkXfermodeImageFilter_DEFINED
+
+#include "SkImageFilter.h"
+
+class SkBitmap;
+class SkXfermode;
+
+class SK_API SkXfermodeImageFilter : public SkImageFilter {
+ /**
+ * This filter takes an xfermode, and uses it to composite the foreground
+ * over the background. If foreground or background is NULL, the input
+ * bitmap (src) is used instead.
+ */
+
+public:
+ virtual ~SkXfermodeImageFilter();
+
+ static SkXfermodeImageFilter* Create(SkXfermode* mode, SkImageFilter* background,
+ SkImageFilter* foreground = NULL,
+ const CropRect* cropRect = NULL,
+ uint32_t uniqueID = 0) {
+ SkImageFilter* inputs[2] = { background, foreground };
+ return SkNEW_ARGS(SkXfermodeImageFilter, (mode, inputs, cropRect, uniqueID));
+ }
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter)
+
+ virtual bool onFilterImage(Proxy* proxy,
+ const SkBitmap& src,
+ const Context& ctx,
+ SkBitmap* dst,
+ SkIPoint* offset) const SK_OVERRIDE;
+#if SK_SUPPORT_GPU
+ virtual bool canFilterImageGPU() const SK_OVERRIDE;
+ virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
+ SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
+#endif
+
+protected:
+ SkXfermodeImageFilter(SkXfermode* mode, SkImageFilter* inputs[2],
+ const CropRect* cropRect, uint32_t uniqueID);
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+ explicit SkXfermodeImageFilter(SkReadBuffer& buffer);
+#endif
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkXfermode* fMode;
+ typedef SkImageFilter INHERITED;
+};
+
+#endif