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

Unified Diff: third_party/WebKit/Source/core/svg/SVGPathSegList.cpp

Issue 1408143004: Use PathSegmentData+SVGPath{Consumer,Source} in PathSVGInterpolation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: InterpolatedPathSource Created 5 years, 2 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 | « third_party/WebKit/Source/core/svg/SVGPathSegList.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/SVGPathSegList.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGPathSegList.cpp b/third_party/WebKit/Source/core/svg/SVGPathSegList.cpp
index 9fecc71a725286e4747eb382c9f3e0a21dcd0875..71f2420f3e247d6420cabd0d91d1c25293d58b31 100644
--- a/third_party/WebKit/Source/core/svg/SVGPathSegList.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGPathSegList.cpp
@@ -63,7 +63,7 @@ DEFINE_TRACE(SVGPathSegList)
PassRefPtrWillBeRawPtr<SVGPathSegList> SVGPathSegList::clone()
{
- RefPtrWillBeRawPtr<SVGPathSegList> svgPathSegList = adoptRefWillBeNoop(new SVGPathSegList(m_contextElement, byteStream()->copy()));
+ RefPtrWillBeRawPtr<SVGPathSegList> svgPathSegList = adoptRefWillBeNoop(new SVGPathSegList(m_contextElement, byteStream().copy()));
svgPathSegList->invalidateList();
return svgPathSegList.release();
}
@@ -75,7 +75,7 @@ PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGPathSegList::cloneForAnimation(const
return svgPathSegList;
}
-const SVGPathByteStream* SVGPathSegList::byteStream() const
+const SVGPathByteStream& SVGPathSegList::byteStream() const
{
if (!m_byteStream) {
m_byteStream = SVGPathByteStream::create();
@@ -88,7 +88,15 @@ const SVGPathByteStream* SVGPathSegList::byteStream() const
}
}
- return m_byteStream.get();
+ return *m_byteStream.get();
+}
+
+SVGPathByteStream& SVGPathSegList::mutableByteStream()
+{
+ ASSERT(Base::isEmpty());
+ if (!m_byteStream)
+ m_byteStream = SVGPathByteStream::create();
+ return *m_byteStream.get();
}
void SVGPathSegList::updateListFromByteStream()
@@ -132,7 +140,7 @@ PassRefPtrWillBeRawPtr<SVGPathSeg> SVGPathSegList::appendItem(PassRefPtrWillBeRa
String SVGPathSegList::valueAsString() const
{
String string;
- buildStringFromByteStream(*byteStream(), string, UnalteredParsing);
+ buildStringFromByteStream(byteStream(), string, UnalteredParsing);
return string;
}
@@ -152,7 +160,7 @@ void SVGPathSegList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGEleme
return;
byteStream(); // create |m_byteStream| if it does not exist.
- addToSVGPathByteStream(*m_byteStream, *otherList->byteStream());
+ addToSVGPathByteStream(*m_byteStream, otherList->byteStream());
invalidateList();
}
@@ -167,28 +175,28 @@ void SVGPathSegList::calculateAnimatedValue(SVGAnimationElement* animationElemen
const RefPtrWillBeRawPtr<SVGPathSegList> to = toSVGPathSegList(toValue);
const RefPtrWillBeRawPtr<SVGPathSegList> toAtEndOfDuration = toSVGPathSegList(toAtEndOfDurationValue);
- const SVGPathByteStream* toStream = to->byteStream();
- const SVGPathByteStream* fromStream = from->byteStream();
+ const SVGPathByteStream& toStream = to->byteStream();
+ const SVGPathByteStream* fromStream = &from->byteStream();
OwnPtr<SVGPathByteStream> copy;
// If no 'to' value is given, nothing to animate.
- if (!toStream->size())
+ if (!toStream.size())
return;
if (isToAnimation) {
- copy = byteStream()->copy();
+ copy = byteStream().copy();
fromStream = copy.get();
}
// If the 'from' value is given and it's length doesn't match the 'to' value list length, fallback to a discrete animation.
- if (fromStream->size() != toStream->size() && fromStream->size()) {
+ if (fromStream->size() != toStream.size() && fromStream->size()) {
if (percentage < 0.5) {
if (!isToAnimation) {
m_byteStream = fromStream->copy();
return;
}
} else {
- m_byteStream = toStream->copy();
+ m_byteStream = toStream.copy();
return;
}
}
@@ -199,7 +207,7 @@ void SVGPathSegList::calculateAnimatedValue(SVGAnimationElement* animationElemen
SVGPathByteStreamBuilder builder(*m_byteStream);
SVGPathByteStreamSource fromSource(*fromStream);
- SVGPathByteStreamSource toSource(*toStream);
+ SVGPathByteStreamSource toSource(toStream);
SVGPathBlender blender(&fromSource, &toSource, &builder);
blender.blendAnimatedPath(percentage);
@@ -209,10 +217,8 @@ void SVGPathSegList::calculateAnimatedValue(SVGAnimationElement* animationElemen
addToSVGPathByteStream(*m_byteStream, *lastAnimatedStream);
// Handle accumulate='sum'.
- if (animationElement->isAccumulated() && repeatCount) {
- const SVGPathByteStream* toAtEndOfDurationStream = toAtEndOfDuration->byteStream();
- addToSVGPathByteStream(*m_byteStream, *toAtEndOfDurationStream, repeatCount);
- }
+ if (animationElement->isAccumulated() && repeatCount)
+ addToSVGPathByteStream(*m_byteStream, toAtEndOfDuration->byteStream(), repeatCount);
}
float SVGPathSegList::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGElement*)
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathSegList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698