Loading core/java/android/view/RecordingCanvas.java +21 −10 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.TemporaryBuffer; import android.text.GraphicsOperations; import android.text.MeasuredParagraph; import android.text.PrecomputedText; import android.text.SpannableString; import android.text.SpannedString; Loading Loading @@ -500,21 +501,31 @@ public class RecordingCanvas extends Canvas { ((GraphicsOperations) text).drawTextRun(this, start, end, contextStart, contextEnd, x, y, isRtl, paint); } else { int contextLen = contextEnd - contextStart; int len = end - start; char[] buf = TemporaryBuffer.obtain(contextLen); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); long measuredTextPtr = 0; if (text instanceof PrecomputedText) { PrecomputedText mt = (PrecomputedText) text; int paraIndex = mt.findParaIndex(start); if (end <= mt.getParagraphEnd(paraIndex)) { final PrecomputedText pt = (PrecomputedText) text; final int paraIndex = pt.findParaIndex(start); if (end <= pt.getParagraphEnd(paraIndex)) { final int paraStart = pt.getParagraphStart(paraIndex); final MeasuredParagraph mp = pt.getMeasuredParagraph(paraIndex); // Only support if the target is in the same paragraph. measuredTextPtr = mt.getMeasuredParagraph(paraIndex).getNativePtr(); nDrawTextRun(mNativeCanvasWrapper, mp.getChars(), start - paraStart, end - start, contextStart - paraStart, contextEnd - contextStart, x, y, isRtl, paint.getNativeInstance(), mp.getNativePtr()); return; } } int contextLen = contextEnd - contextStart; int len = end - start; char[] buf = TemporaryBuffer.obtain(contextLen); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); nDrawTextRun(mNativeCanvasWrapper, buf, start - contextStart, len, 0, contextLen, x, y, isRtl, paint.getNativeInstance(), measuredTextPtr); 0, contextLen, x, y, isRtl, paint.getNativeInstance(), 0 /* measured paragraph pointer */); TemporaryBuffer.recycle(buf); } } Loading graphics/java/android/graphics/BaseCanvas.java +21 −10 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.annotation.Nullable; import android.annotation.Size; import android.graphics.Canvas.VertexMode; import android.text.GraphicsOperations; import android.text.MeasuredParagraph; import android.text.PrecomputedText; import android.text.SpannableString; import android.text.SpannedString; Loading Loading @@ -486,21 +487,31 @@ public abstract class BaseCanvas { ((GraphicsOperations) text).drawTextRun(this, start, end, contextStart, contextEnd, x, y, isRtl, paint); } else { if (text instanceof PrecomputedText) { final PrecomputedText pt = (PrecomputedText) text; final int paraIndex = pt.findParaIndex(start); if (end <= pt.getParagraphEnd(paraIndex)) { final int paraStart = pt.getParagraphStart(paraIndex); final MeasuredParagraph mp = pt.getMeasuredParagraph(paraIndex); // Only support the text in the same paragraph. nDrawTextRun(mNativeCanvasWrapper, mp.getChars(), start - paraStart, end - start, contextStart - paraStart, contextEnd - contextStart, x, y, isRtl, paint.getNativeInstance(), mp.getNativePtr()); return; } } int contextLen = contextEnd - contextStart; int len = end - start; char[] buf = TemporaryBuffer.obtain(contextLen); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); long measuredTextPtr = 0; if (text instanceof PrecomputedText) { PrecomputedText mt = (PrecomputedText) text; int paraIndex = mt.findParaIndex(start); if (end <= mt.getParagraphEnd(paraIndex)) { // Only suppor the text in the same paragraph. measuredTextPtr = mt.getMeasuredParagraph(paraIndex).getNativePtr(); } } nDrawTextRun(mNativeCanvasWrapper, buf, start - contextStart, len, 0, contextLen, x, y, isRtl, paint.getNativeInstance(), measuredTextPtr); 0, contextLen, x, y, isRtl, paint.getNativeInstance(), 0 /* measured paragraph pointer */); TemporaryBuffer.recycle(buf); } } Loading Loading
core/java/android/view/RecordingCanvas.java +21 −10 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.TemporaryBuffer; import android.text.GraphicsOperations; import android.text.MeasuredParagraph; import android.text.PrecomputedText; import android.text.SpannableString; import android.text.SpannedString; Loading Loading @@ -500,21 +501,31 @@ public class RecordingCanvas extends Canvas { ((GraphicsOperations) text).drawTextRun(this, start, end, contextStart, contextEnd, x, y, isRtl, paint); } else { int contextLen = contextEnd - contextStart; int len = end - start; char[] buf = TemporaryBuffer.obtain(contextLen); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); long measuredTextPtr = 0; if (text instanceof PrecomputedText) { PrecomputedText mt = (PrecomputedText) text; int paraIndex = mt.findParaIndex(start); if (end <= mt.getParagraphEnd(paraIndex)) { final PrecomputedText pt = (PrecomputedText) text; final int paraIndex = pt.findParaIndex(start); if (end <= pt.getParagraphEnd(paraIndex)) { final int paraStart = pt.getParagraphStart(paraIndex); final MeasuredParagraph mp = pt.getMeasuredParagraph(paraIndex); // Only support if the target is in the same paragraph. measuredTextPtr = mt.getMeasuredParagraph(paraIndex).getNativePtr(); nDrawTextRun(mNativeCanvasWrapper, mp.getChars(), start - paraStart, end - start, contextStart - paraStart, contextEnd - contextStart, x, y, isRtl, paint.getNativeInstance(), mp.getNativePtr()); return; } } int contextLen = contextEnd - contextStart; int len = end - start; char[] buf = TemporaryBuffer.obtain(contextLen); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); nDrawTextRun(mNativeCanvasWrapper, buf, start - contextStart, len, 0, contextLen, x, y, isRtl, paint.getNativeInstance(), measuredTextPtr); 0, contextLen, x, y, isRtl, paint.getNativeInstance(), 0 /* measured paragraph pointer */); TemporaryBuffer.recycle(buf); } } Loading
graphics/java/android/graphics/BaseCanvas.java +21 −10 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.annotation.Nullable; import android.annotation.Size; import android.graphics.Canvas.VertexMode; import android.text.GraphicsOperations; import android.text.MeasuredParagraph; import android.text.PrecomputedText; import android.text.SpannableString; import android.text.SpannedString; Loading Loading @@ -486,21 +487,31 @@ public abstract class BaseCanvas { ((GraphicsOperations) text).drawTextRun(this, start, end, contextStart, contextEnd, x, y, isRtl, paint); } else { if (text instanceof PrecomputedText) { final PrecomputedText pt = (PrecomputedText) text; final int paraIndex = pt.findParaIndex(start); if (end <= pt.getParagraphEnd(paraIndex)) { final int paraStart = pt.getParagraphStart(paraIndex); final MeasuredParagraph mp = pt.getMeasuredParagraph(paraIndex); // Only support the text in the same paragraph. nDrawTextRun(mNativeCanvasWrapper, mp.getChars(), start - paraStart, end - start, contextStart - paraStart, contextEnd - contextStart, x, y, isRtl, paint.getNativeInstance(), mp.getNativePtr()); return; } } int contextLen = contextEnd - contextStart; int len = end - start; char[] buf = TemporaryBuffer.obtain(contextLen); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); long measuredTextPtr = 0; if (text instanceof PrecomputedText) { PrecomputedText mt = (PrecomputedText) text; int paraIndex = mt.findParaIndex(start); if (end <= mt.getParagraphEnd(paraIndex)) { // Only suppor the text in the same paragraph. measuredTextPtr = mt.getMeasuredParagraph(paraIndex).getNativePtr(); } } nDrawTextRun(mNativeCanvasWrapper, buf, start - contextStart, len, 0, contextLen, x, y, isRtl, paint.getNativeInstance(), measuredTextPtr); 0, contextLen, x, y, isRtl, paint.getNativeInstance(), 0 /* measured paragraph pointer */); TemporaryBuffer.recycle(buf); } } Loading