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

Unified Diff: Source/core/rendering/svg/SVGTextLayoutEngine.cpp

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.h ('k') | Source/platform/graphics/Path.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/SVGTextLayoutEngine.cpp
diff --git a/Source/core/rendering/svg/SVGTextLayoutEngine.cpp b/Source/core/rendering/svg/SVGTextLayoutEngine.cpp
index 0d179d5efd2ba5784acb5e411bc244eb410a8eef..ba2e95f9199df70c94a448a9e01842c20d8e3039 100644
--- a/Source/core/rendering/svg/SVGTextLayoutEngine.cpp
+++ b/Source/core/rendering/svg/SVGTextLayoutEngine.cpp
@@ -47,6 +47,7 @@ SVGTextLayoutEngine::SVGTextLayoutEngine(Vector<SVGTextLayoutAttributes*>& layou
, m_dy(0)
, m_isVerticalText(false)
, m_inPathLayout(false)
+ , m_textPathCalculator(0)
, m_textPathLength(0)
, m_textPathCurrentOffset(0)
, m_textPathSpacing(0)
@@ -169,11 +170,12 @@ void SVGTextLayoutEngine::beginTextPathLayout(RenderObject* object, SVGTextLayou
m_inPathLayout = true;
RenderSVGTextPath* textPath = toRenderSVGTextPath(object);
- m_textPath = textPath->layoutPath();
- if (m_textPath.isEmpty())
+ Path path = textPath->layoutPath();
+ if (path.isEmpty())
return;
+ m_textPathCalculator = new Path::PositionCalculator(path);
m_textPathStartOffset = textPath->startOffset();
- m_textPathLength = m_textPath.length();
+ m_textPathLength = path.length();
if (m_textPathStartOffset > 0 && m_textPathStartOffset <= 1)
m_textPathStartOffset *= m_textPathLength;
@@ -225,7 +227,8 @@ void SVGTextLayoutEngine::beginTextPathLayout(RenderObject* object, SVGTextLayou
void SVGTextLayoutEngine::endTextPathLayout()
{
m_inPathLayout = false;
- m_textPath = Path();
+ delete m_textPathCalculator;
+ m_textPathCalculator = 0;
m_textPathLength = 0;
m_textPathStartOffset = 0;
m_textPathCurrentOffset = 0;
@@ -424,7 +427,7 @@ void SVGTextLayoutEngine::advanceToNextVisualCharacter(const SVGTextMetrics& vis
void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, RenderSVGInlineText* text, const RenderStyle* style)
{
- if (m_inPathLayout && m_textPath.isEmpty())
+ if (m_inPathLayout && !m_textPathCalculator)
return;
SVGElement* lengthContext = toSVGElement(text->parent()->node());
@@ -556,7 +559,7 @@ void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, Rend
break;
FloatPoint point;
- bool ok = m_textPath.pointAndNormalAtLength(textPathOffset, point, angle);
+ bool ok = m_textPathCalculator->pointAndNormalAtLength(textPathOffset, point, angle);
ASSERT_UNUSED(ok, ok);
x = point.x();
y = point.y();
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutEngine.h ('k') | Source/platform/graphics/Path.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698