Merge "Store string of most recent shaped text for debugging" into tm-qpr-dev am: fee20da861
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20941593 Change-Id: I7f26faf8f3d35970360d5ae9dbda0c95299bac3c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -122,6 +122,9 @@ class TextInterpolator(
|
|||||||
shapeText(value)
|
shapeText(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var shapedText: String = ""
|
||||||
|
private set
|
||||||
|
|
||||||
init {
|
init {
|
||||||
// shapeText needs to be called after all members are initialized.
|
// shapeText needs to be called after all members are initialized.
|
||||||
shapeText(layout)
|
shapeText(layout)
|
||||||
@@ -484,10 +487,12 @@ class TextInterpolator(
|
|||||||
layout: Layout,
|
layout: Layout,
|
||||||
paint: TextPaint
|
paint: TextPaint
|
||||||
): List<List<PositionedGlyphs>> {
|
): List<List<PositionedGlyphs>> {
|
||||||
|
var text = StringBuilder()
|
||||||
val out = mutableListOf<List<PositionedGlyphs>>()
|
val out = mutableListOf<List<PositionedGlyphs>>()
|
||||||
for (lineNo in 0 until layout.lineCount) { // Shape all lines.
|
for (lineNo in 0 until layout.lineCount) { // Shape all lines.
|
||||||
val lineStart = layout.getLineStart(lineNo)
|
val lineStart = layout.getLineStart(lineNo)
|
||||||
var count = layout.getLineEnd(lineNo) - lineStart
|
val lineEnd = layout.getLineEnd(lineNo)
|
||||||
|
var count = lineEnd - lineStart
|
||||||
// Do not render the last character in the line if it's a newline and unprintable
|
// Do not render the last character in the line if it's a newline and unprintable
|
||||||
val last = lineStart + count - 1
|
val last = lineStart + count - 1
|
||||||
if (last > lineStart && last < layout.text.length && layout.text[last] == '\n') {
|
if (last > lineStart && last < layout.text.length && layout.text[last] == '\n') {
|
||||||
@@ -500,7 +505,13 @@ class TextInterpolator(
|
|||||||
runs.add(glyphs)
|
runs.add(glyphs)
|
||||||
}
|
}
|
||||||
out.add(runs)
|
out.add(runs)
|
||||||
|
|
||||||
|
if (lineNo > 0) {
|
||||||
|
text.append("\n")
|
||||||
}
|
}
|
||||||
|
text.append(layout.text.substring(lineStart, lineEnd))
|
||||||
|
}
|
||||||
|
shapedText = text.toString()
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user