Skip to content

Commit dad9c67

Browse files
Gilles DebunneAndroid (Google) Code Review
authored andcommitted
Merge "Bug 5250788: Fix memory consumption issues in TextPaint."
2 parents e3238c9 + 63c885f commit dad9c67

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/java/android/text/TextPaint.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,15 @@ public void set(TextPaint tp) {
7272
linkColor = tp.linkColor;
7373
drawableState = tp.drawableState;
7474
density = tp.density;
75-
underlineColors = tp.underlineColors;
76-
underlineThicknesses = tp.underlineThicknesses;
75+
76+
if (tp.underlineColors != null) {
77+
if (underlineColors == null || underlineColors.length < tp.underlineCount) {
78+
underlineColors = new int[tp.underlineCount];
79+
underlineThicknesses = new float[tp.underlineCount];
80+
}
81+
System.arraycopy(tp.underlineColors, 0, underlineColors, 0, tp.underlineCount);
82+
System.arraycopy(tp.underlineThicknesses, 0, underlineThicknesses, 0, tp.underlineCount);
83+
}
7784
underlineCount = tp.underlineCount;
7885
}
7986

0 commit comments

Comments
 (0)