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

Unified Diff: Source/platform/graphics/Path.h

Issue 140053006: Optimize glyph positioning for SVG <textPath> layout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: This is why I used an OwnPtr... Created 6 years, 10 months 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
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutEngine.cpp ('k') | Source/platform/graphics/Path.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/Path.h
diff --git a/Source/platform/graphics/Path.h b/Source/platform/graphics/Path.h
index 1970b97d500acbfe4b0dda535631c36f5c7d9ac0..3ed72b952d0c53303bade41e88e09209bdebf42e 100644
--- a/Source/platform/graphics/Path.h
+++ b/Source/platform/graphics/Path.h
@@ -33,6 +33,7 @@
#include "platform/geometry/RoundedRect.h"
#include "platform/graphics/WindRule.h"
#include "third_party/skia/include/core/SkPath.h"
+#include "third_party/skia/include/core/SkPathMeasure.h"
#include "wtf/FastAllocBase.h"
#include "wtf/Forward.h"
@@ -85,6 +86,25 @@ public:
float normalAngleAtLength(float length, bool& ok) const;
bool pointAndNormalAtLength(float length, FloatPoint&, float&) const;
+ // Helper for computing a sequence of positions and normals (normal angles) on a path.
+ // The best possible access pattern will be one where the |length| value is
+ // strictly increasing.
+ // For other access patterns, performance will vary depending on curvature
+ // and number of segments, but should never be worse than that of the
+ // state-less method on Path.
+ class PLATFORM_EXPORT PositionCalculator {
+ WTF_MAKE_NONCOPYABLE(PositionCalculator);
+ public:
+ explicit PositionCalculator(const Path&);
+
+ bool pointAndNormalAtLength(float length, FloatPoint&, float&);
+
+ private:
+ SkPath m_path;
+ SkPathMeasure m_pathMeasure;
+ SkScalar m_accumulatedLength;
+ };
+
void clear();
bool isEmpty() const;
// Gets the current point of the current path, which is conceptually the final point reached by the path so far.
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutEngine.cpp ('k') | Source/platform/graphics/Path.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698