summaryrefslogtreecommitdiff
path: root/libs/hwui/VectorDrawable.cpp
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2016-03-15 17:01:55 -0700
committerDoris Liu <tianliu@google.com>2016-03-15 17:01:55 -0700
commit24ba1251583dc637ff1699550aa99811e886b4cf (patch)
tree12488a36100e2f8ca6797cdb28ca087be167ca7c /libs/hwui/VectorDrawable.cpp
parenta0021cbb7fe9b1f97c0a31bd0681eb6c0f7f34a9 (diff)
Workaround for PathMeasure.getSegment() behavior change
SkPathMeasure::getSegment(SkScalar startD, SkScalar stopD, SkPath* dst, bool startWithMoveTo) in SkPathMeasure used to ignore the case when startD == stopD in MNC release. In NYC, the same paramaters would yield a tiny segment, which leaves undesirable artifacts as shown in the bug below. Bug: 27665826 Change-Id: I8289dc32773fd55d686458183af44ff072866c6e
Diffstat (limited to 'libs/hwui/VectorDrawable.cpp')
-rw-r--r--libs/hwui/VectorDrawable.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/libs/hwui/VectorDrawable.cpp b/libs/hwui/VectorDrawable.cpp
index 2e3856fafb60..f7b38e33cae7 100644
--- a/libs/hwui/VectorDrawable.cpp
+++ b/libs/hwui/VectorDrawable.cpp
@@ -229,19 +229,25 @@ void FullPath::applyTrim() {
// No trimming necessary.
return;
}
+ mTrimDirty = false;
+ mTrimmedSkPath.reset();
+ if (mProperties.trimPathStart == mProperties.trimPathEnd) {
+ // Trimmed path should be empty.
+ return;
+ }
SkPathMeasure measure(mSkPath, false);
float len = SkScalarToFloat(measure.getLength());
float start = len * fmod((mProperties.trimPathStart + mProperties.trimPathOffset), 1.0f);
float end = len * fmod((mProperties.trimPathEnd + mProperties.trimPathOffset), 1.0f);
- mTrimmedSkPath.reset();
if (start > end) {
measure.getSegment(start, len, &mTrimmedSkPath, true);
- measure.getSegment(0, end, &mTrimmedSkPath, true);
+ if (end > 0) {
+ measure.getSegment(0, end, &mTrimmedSkPath, true);
+ }
} else {
measure.getSegment(start, end, &mTrimmedSkPath, true);
}
- mTrimDirty = false;
}
REQUIRE_COMPATIBLE_LAYOUT(FullPath::Properties);