aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDistanceFieldGenFromVector.h
diff options
context:
space:
mode:
authorGravatar joel.liang <joel.liang@arm.com>2016-10-25 07:09:29 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-25 07:09:29 -0700
commit67c7c81a82b6351e9fbbf235084d7120162d9268 (patch)
tree9a3157acf48a096b9b58272ab8163255e9afa0d6 /src/gpu/GrDistanceFieldGenFromVector.h
parent840f12a721fe5f544e0a03ce1e4aca3ad18389f6 (diff)
Generate Signed Distance Field directly from vector path
Diffstat (limited to 'src/gpu/GrDistanceFieldGenFromVector.h')
-rw-r--r--src/gpu/GrDistanceFieldGenFromVector.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gpu/GrDistanceFieldGenFromVector.h b/src/gpu/GrDistanceFieldGenFromVector.h
new file mode 100644
index 0000000000..1d83ee28ff
--- /dev/null
+++ b/src/gpu/GrDistanceFieldGenFromVector.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2016 ARM Ltd.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrDistanceFieldGenFromVector_DEFINED
+#define GrDistanceFieldGenFromVector_DEFINED
+
+#include "SkDistanceFieldGen.h"
+#include "SkPath.h"
+#include "SkMatrix.h"
+
+/** Given a vector path, generate the associated distance field.
+
+ * @param distanceField The distance field to be generated. Should already be allocated
+ * by the client with the padding defined in "SkDistanceFieldGen.h".
+ * @param path The path we're using to generate the distance field.
+ * @param matrix Transformation matrix for path.
+ * @param width Width of the distance field.
+ * @param height Height of the distance field.
+ * @param rowBytes Size of each row in the distance field, in bytes.
+ */
+bool GrGenerateDistanceFieldFromPath(unsigned char* distanceField,
+ const SkPath& path, const SkMatrix& viewMatrix,
+ int width, int height, size_t rowBytes);
+
+inline bool IsDistanceFieldSupportedFillType(SkPath::FillType fFillType)
+{
+ return (SkPath::kEvenOdd_FillType == fFillType ||
+ SkPath::kInverseEvenOdd_FillType == fFillType);
+}
+
+#endif