Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Unified Diff: src/gpu/GrDistanceFieldGenFromVector.h

Issue 1643143002: Generate Signed Distance Field directly from vector path (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added assertion to check path bounds Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrDistanceFieldGenFromVector.h
diff --git a/src/gpu/GrDistanceFieldGenFromVector.h b/src/gpu/GrDistanceFieldGenFromVector.h
new file mode 100644
index 0000000000000000000000000000000000000000..1d83ee28ff52f0bfcccd176caec8a5781c7256b1
--- /dev/null
+++ b/src/gpu/GrDistanceFieldGenFromVector.h
@@ -0,0 +1,35 @@
+/*
jvanverth1 2017/01/04 21:12:27 Is there a reason this file is in src/gpu and not
Joel.Liang 2017/01/06 05:28:09 It's because we used the GrPathUtils::convertCubic
+ * 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"
jvanverth1 2017/01/04 21:12:27 This include could be in GrDistanceFieldGenFromVec
Joel.Liang 2017/01/06 05:28:09 Done.
+#include "SkPath.h"
+#include "SkMatrix.h"
jvanverth1 2017/01/04 21:12:27 This could be replaced by class Matrix; and pu
Joel.Liang 2017/01/06 05:28:09 Done.
+
jvanverth1 2017/01/04 21:12:27 Add #define SK_USE_LEGACY_DISTANCE_FIELDS here?
Joel.Liang 2017/01/06 05:28:09 Done. And I have added an #ifndef directive to su
+/** 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

Powered by Google App Engine
This is Rietveld 408576698