Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d9fe5bd authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Clean Paint.mBidiFlags as it is no longer used

See bug #7623824

Change-Id: Ie2f9422821f6dcc73c99e8695f448e966b587b1d
parent 981e60ed
Loading
Loading
Loading
Loading
+3 −10
Original line number Original line Diff line number Diff line
@@ -38,7 +38,7 @@ extends CharSequence
     * {@hide}
     * {@hide}
     */
     */
    void drawTextRun(Canvas c, int start, int end, int contextStart, int contextEnd,
    void drawTextRun(Canvas c, int start, int end, int contextStart, int contextEnd,
            float x, float y, int flags, Paint p);
            float x, float y, Paint p);


   /**
   /**
     * Just like {@link Paint#measureText}.
     * Just like {@link Paint#measureText}.
@@ -55,19 +55,12 @@ extends CharSequence
     * @hide
     * @hide
     */
     */
    float getTextRunAdvances(int start, int end, int contextStart, int contextEnd,
    float getTextRunAdvances(int start, int end, int contextStart, int contextEnd,
            int flags, float[] advances, int advancesIndex, Paint paint);
            float[] advances, int advancesIndex, Paint paint);

    /**
     * Just like {@link Paint#getTextRunAdvances}.
     * @hide
     */
    float getTextRunAdvances(int start, int end, int contextStart, int contextEnd,
            int flags, float[] advances, int advancesIndex, Paint paint, int reserved);


    /**
    /**
     * Just like {@link Paint#getTextRunCursor}.
     * Just like {@link Paint#getTextRunCursor}.
     * @hide
     * @hide
     */
     */
    int getTextRunCursor(int contextStart, int contextEnd, int flags, int offset,
    int getTextRunCursor(int contextStart, int contextEnd, int offset,
            int cursorOpt, Paint p);
            int cursorOpt, Paint p);
}
}
+2 −5
Original line number Original line Diff line number Diff line
@@ -159,18 +159,15 @@ class MeasuredText {
        mPos = p + len;
        mPos = p + len;


        if (mEasy) {
        if (mEasy) {
            int flags = mDir == Layout.DIR_LEFT_TO_RIGHT
            return paint.getTextRunAdvances(mChars, p, len, p, len, mWidths, p);
                ? Canvas.DIRECTION_LTR : Canvas.DIRECTION_RTL;
            return paint.getTextRunAdvances(mChars, p, len, p, len, flags, mWidths, p);
        }
        }


        float totalAdvance = 0;
        float totalAdvance = 0;
        int level = mLevels[p];
        int level = mLevels[p];
        for (int q = p, i = p + 1, e = p + len;; ++i) {
        for (int q = p, i = p + 1, e = p + len;; ++i) {
            if (i == e || mLevels[i] != level) {
            if (i == e || mLevels[i] != level) {
                int flags = (level & 0x1) == 0 ? Canvas.DIRECTION_LTR : Canvas.DIRECTION_RTL;
                totalAdvance +=
                totalAdvance +=
                        paint.getTextRunAdvances(mChars, q, i - q, q, i - q, flags, mWidths, q);
                        paint.getTextRunAdvances(mChars, q, i - q, q, i - q, mWidths, q);
                if (i == e) {
                if (i == e) {
                    break;
                    break;
                }
                }
+21 −42
Original line number Original line Diff line number Diff line
@@ -1130,20 +1130,20 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
     * {@hide}
     * {@hide}
     */
     */
    public void drawTextRun(Canvas c, int start, int end, int contextStart, int contextEnd,
    public void drawTextRun(Canvas c, int start, int end, int contextStart, int contextEnd,
            float x, float y, int flags, Paint p) {
            float x, float y, Paint p) {
        checkRange("drawTextRun", start, end);
        checkRange("drawTextRun", start, end);


        int contextLen = contextEnd - contextStart;
        int contextLen = contextEnd - contextStart;
        int len = end - start;
        int len = end - start;
        if (contextEnd <= mGapStart) {
        if (contextEnd <= mGapStart) {
            c.drawTextRun(mText, start, len, contextStart, contextLen, x, y, flags, p);
            c.drawTextRun(mText, start, len, contextStart, contextLen, x, y, p);
        } else if (contextStart >= mGapStart) {
        } else if (contextStart >= mGapStart) {
            c.drawTextRun(mText, start + mGapLength, len, contextStart + mGapLength,
            c.drawTextRun(mText, start + mGapLength, len, contextStart + mGapLength,
                    contextLen, x, y, flags, p);
                    contextLen, x, y, p);
        } else {
        } else {
            char[] buf = TextUtils.obtain(contextLen);
            char[] buf = TextUtils.obtain(contextLen);
            getChars(contextStart, contextEnd, buf, 0);
            getChars(contextStart, contextEnd, buf, 0);
            c.drawTextRun(buf, start - contextStart, len, 0, contextLen, x, y, flags, p);
            c.drawTextRun(buf, start - contextStart, len, 0, contextLen, x, y, p);
            TextUtils.recycle(buf);
            TextUtils.recycle(buf);
        }
        }
    }
    }
@@ -1200,7 +1200,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
     * Don't call this yourself -- exists for Paint to use internally.
     * Don't call this yourself -- exists for Paint to use internally.
     * {@hide}
     * {@hide}
     */
     */
    public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd, int flags,
    public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd,
            float[] advances, int advancesPos, Paint p) {
            float[] advances, int advancesPos, Paint p) {


        float ret;
        float ret;
@@ -1210,44 +1210,15 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable


        if (end <= mGapStart) {
        if (end <= mGapStart) {
            ret = p.getTextRunAdvances(mText, start, len, contextStart, contextLen,
            ret = p.getTextRunAdvances(mText, start, len, contextStart, contextLen,
                    flags, advances, advancesPos);
                    advances, advancesPos);
        } else if (start >= mGapStart) {
        } else if (start >= mGapStart) {
            ret = p.getTextRunAdvances(mText, start + mGapLength, len,
            ret = p.getTextRunAdvances(mText, start + mGapLength, len,
                    contextStart + mGapLength, contextLen, flags, advances, advancesPos);
                    contextStart + mGapLength, contextLen, advances, advancesPos);
        } else {
        } else {
            char[] buf = TextUtils.obtain(contextLen);
            char[] buf = TextUtils.obtain(contextLen);
            getChars(contextStart, contextEnd, buf, 0);
            getChars(contextStart, contextEnd, buf, 0);
            ret = p.getTextRunAdvances(buf, start - contextStart, len,
            ret = p.getTextRunAdvances(buf, start - contextStart, len,
                    0, contextLen, flags, advances, advancesPos);
                    0, contextLen, advances, advancesPos);
            TextUtils.recycle(buf);
        }

        return ret;
    }

    /**
     * Don't call this yourself -- exists for Paint to use internally.
     * {@hide}
     */
    public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd, int flags,
            float[] advances, int advancesPos, Paint p, int reserved) {

        float ret;

        int contextLen = contextEnd - contextStart;
        int len = end - start;

        if (end <= mGapStart) {
            ret = p.getTextRunAdvances(mText, start, len, contextStart, contextLen,
                    flags, advances, advancesPos, reserved);
        } else if (start >= mGapStart) {
            ret = p.getTextRunAdvances(mText, start + mGapLength, len,
                    contextStart + mGapLength, contextLen, flags, advances, advancesPos, reserved);
        } else {
            char[] buf = TextUtils.obtain(contextLen);
            getChars(contextStart, contextEnd, buf, 0);
            ret = p.getTextRunAdvances(buf, start - contextStart, len,
                    0, contextLen, flags, advances, advancesPos, reserved);
            TextUtils.recycle(buf);
            TextUtils.recycle(buf);
        }
        }


@@ -1270,7 +1241,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
     *
     *
     * @param contextStart the start index of the context
     * @param contextStart the start index of the context
     * @param contextEnd the (non-inclusive) end index of the context
     * @param contextEnd the (non-inclusive) end index of the context
     * @param flags either DIRECTION_RTL or DIRECTION_LTR
     * @param flags reserved
     * @param offset the cursor position to move from
     * @param offset the cursor position to move from
     * @param cursorOpt how to move the cursor, one of CURSOR_AFTER,
     * @param cursorOpt how to move the cursor, one of CURSOR_AFTER,
     * CURSOR_AT_OR_AFTER, CURSOR_BEFORE,
     * CURSOR_AT_OR_AFTER, CURSOR_BEFORE,
@@ -1282,21 +1253,29 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
    @Deprecated
    @Deprecated
    public int getTextRunCursor(int contextStart, int contextEnd, int flags, int offset,
    public int getTextRunCursor(int contextStart, int contextEnd, int flags, int offset,
                                int cursorOpt, Paint p) {
                                int cursorOpt, Paint p) {
        return getTextRunCursor(contextStart, contextEnd, offset, cursorOpt, p);
    }

    /**
     * @hide
     */
    public int getTextRunCursor(int contextStart, int contextEnd, int offset,
                                int cursorOpt, Paint p) {


        int ret;
        int ret;


        int contextLen = contextEnd - contextStart;
        int contextLen = contextEnd - contextStart;
        if (contextEnd <= mGapStart) {
        if (contextEnd <= mGapStart) {
            ret = p.getTextRunCursor(mText, contextStart, contextLen,
            ret = p.getTextRunCursor(mText, contextStart, contextLen,
                    flags, offset, cursorOpt);
                    offset, cursorOpt);
        } else if (contextStart >= mGapStart) {
        } else if (contextStart >= mGapStart) {
            ret = p.getTextRunCursor(mText, contextStart + mGapLength, contextLen,
            ret = p.getTextRunCursor(mText, contextStart + mGapLength, contextLen,
                    flags, offset + mGapLength, cursorOpt) - mGapLength;
                    offset + mGapLength, cursorOpt) - mGapLength;
        } else {
        } else {
            char[] buf = TextUtils.obtain(contextLen);
            char[] buf = TextUtils.obtain(contextLen);
            getChars(contextStart, contextEnd, buf, 0);
            getChars(contextStart, contextEnd, buf, 0);
            ret = p.getTextRunCursor(buf, 0, contextLen,
            ret = p.getTextRunCursor(buf, 0, contextLen,
                    flags, offset - contextStart, cursorOpt) + contextStart;
                    offset - contextStart, cursorOpt) + contextStart;
            TextUtils.recycle(buf);
            TextUtils.recycle(buf);
        }
        }


+9 −15
Original line number Original line Diff line number Diff line
@@ -664,14 +664,13 @@ class TextLine {
            }
            }
        }
        }


        int flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;
        int cursorOpt = after ? Paint.CURSOR_AFTER : Paint.CURSOR_BEFORE;
        int cursorOpt = after ? Paint.CURSOR_AFTER : Paint.CURSOR_BEFORE;
        if (mCharsValid) {
        if (mCharsValid) {
            return wp.getTextRunCursor(mChars, spanStart, spanLimit - spanStart,
            return wp.getTextRunCursor(mChars, spanStart, spanLimit - spanStart,
                    flags, offset, cursorOpt);
                    offset, cursorOpt);
        } else {
        } else {
            return wp.getTextRunCursor(mText, mStart + spanStart,
            return wp.getTextRunCursor(mText, mStart + spanStart,
                    mStart + spanLimit, flags, mStart + offset, cursorOpt) - mStart;
                    mStart + spanLimit, mStart + offset, cursorOpt) - mStart;
        }
        }
    }
    }


@@ -738,15 +737,13 @@ class TextLine {


        int contextLen = contextEnd - contextStart;
        int contextLen = contextEnd - contextStart;
        if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) {
        if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) {
            int flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;
            if (mCharsValid) {
            if (mCharsValid) {
                ret = wp.getTextRunAdvances(mChars, start, runLen,
                ret = wp.getTextRunAdvances(mChars, start, runLen,
                        contextStart, contextLen, flags, null, 0);
                        contextStart, contextLen, null, 0);
            } else {
            } else {
                int delta = mStart;
                int delta = mStart;
                ret = wp.getTextRunAdvances(mText, delta + start,
                ret = wp.getTextRunAdvances(mText, delta + start, delta + end,
                        delta + end, delta + contextStart, delta + contextEnd,
                        delta + contextStart, delta + contextEnd, null, 0);
                        flags, null, 0);
            }
            }
        }
        }


@@ -786,8 +783,7 @@ class TextLine {
                wp.setAntiAlias(previousAntiAlias);
                wp.setAntiAlias(previousAntiAlias);
            }
            }


            drawTextRun(c, wp, start, end, contextStart, contextEnd, runIsRtl,
            drawTextRun(c, wp, start, end, contextStart, contextEnd, x, y + wp.baselineShift);
                    x, y + wp.baselineShift);
        }
        }


        return runIsRtl ? -ret : ret;
        return runIsRtl ? -ret : ret;
@@ -970,23 +966,21 @@ class TextLine {
     * @param end the end of the run
     * @param end the end of the run
     * @param contextStart the start of context for the run
     * @param contextStart the start of context for the run
     * @param contextEnd the end of the context for the run
     * @param contextEnd the end of the context for the run
     * @param runIsRtl true if the run is right-to-left
     * @param x the x position of the left edge of the run
     * @param x the x position of the left edge of the run
     * @param y the baseline of the run
     * @param y the baseline of the run
     */
     */
    private void drawTextRun(Canvas c, TextPaint wp, int start, int end,
    private void drawTextRun(Canvas c, TextPaint wp, int start, int end,
            int contextStart, int contextEnd, boolean runIsRtl, float x, int y) {
            int contextStart, int contextEnd, float x, int y) {


        int flags = runIsRtl ? Canvas.DIRECTION_RTL : Canvas.DIRECTION_LTR;
        if (mCharsValid) {
        if (mCharsValid) {
            int count = end - start;
            int count = end - start;
            int contextCount = contextEnd - contextStart;
            int contextCount = contextEnd - contextStart;
            c.drawTextRun(mChars, start, count, contextStart, contextCount,
            c.drawTextRun(mChars, start, count, contextStart, contextCount,
                    x, y, flags, wp);
                    x, y, wp);
        } else {
        } else {
            int delta = mStart;
            int delta = mStart;
            c.drawTextRun(mText, delta + start, delta + end,
            c.drawTextRun(mText, delta + start, delta + end,
                    delta + contextStart, delta + contextEnd, x, y, flags, wp);
                    delta + contextStart, delta + contextEnd, x, y, wp);
        }
        }
    }
    }


+19 −26
Original line number Original line Diff line number Diff line
@@ -1176,14 +1176,14 @@ class GLES20Canvas extends HardwareCanvas {


        int modifiers = setupModifiers(paint);
        int modifiers = setupModifiers(paint);
        try {
        try {
            nDrawText(mRenderer, text, index, count, x, y, paint.mBidiFlags, paint.mNativePaint);
            nDrawText(mRenderer, text, index, count, x, y, paint.mNativePaint);
        } finally {
        } finally {
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
        }
        }
    }
    }
    
    
    private static native void nDrawText(int renderer, char[] text, int index, int count,
    private static native void nDrawText(int renderer, char[] text, int index, int count,
            float x, float y, int bidiFlags, int paint);
            float x, float y, int paint);


    @Override
    @Override
    public void drawText(CharSequence text, int start, int end, float x, float y, Paint paint) {
    public void drawText(CharSequence text, int start, int end, float x, float y, Paint paint) {
@@ -1191,16 +1191,14 @@ class GLES20Canvas extends HardwareCanvas {
        try {
        try {
            if (text instanceof String || text instanceof SpannedString ||
            if (text instanceof String || text instanceof SpannedString ||
                    text instanceof SpannableString) {
                    text instanceof SpannableString) {
                nDrawText(mRenderer, text.toString(), start, end, x, y, paint.mBidiFlags,
                nDrawText(mRenderer, text.toString(), start, end, x, y, paint.mNativePaint);
                        paint.mNativePaint);
            } else if (text instanceof GraphicsOperations) {
            } else if (text instanceof GraphicsOperations) {
                ((GraphicsOperations) text).drawText(this, start, end, x, y,
                ((GraphicsOperations) text).drawText(this, start, end, x, y,
                                                         paint);
                                                         paint);
            } else {
            } else {
                char[] buf = TemporaryBuffer.obtain(end - start);
                char[] buf = TemporaryBuffer.obtain(end - start);
                TextUtils.getChars(text, start, end, buf, 0);
                TextUtils.getChars(text, start, end, buf, 0);
                nDrawText(mRenderer, buf, 0, end - start, x, y,
                nDrawText(mRenderer, buf, 0, end - start, x, y, paint.mNativePaint);
                        paint.mBidiFlags, paint.mNativePaint);
                TemporaryBuffer.recycle(buf);
                TemporaryBuffer.recycle(buf);
            }
            }
        } finally {
        } finally {
@@ -1216,21 +1214,20 @@ class GLES20Canvas extends HardwareCanvas {


        int modifiers = setupModifiers(paint);
        int modifiers = setupModifiers(paint);
        try {
        try {
            nDrawText(mRenderer, text, start, end, x, y, paint.mBidiFlags, paint.mNativePaint);
            nDrawText(mRenderer, text, start, end, x, y, paint.mNativePaint);
        } finally {
        } finally {
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
        }
        }
    }
    }


    private static native void nDrawText(int renderer, String text, int start, int end,
    private static native void nDrawText(int renderer, String text, int start, int end,
            float x, float y, int bidiFlags, int paint);
            float x, float y, int paint);


    @Override
    @Override
    public void drawText(String text, float x, float y, Paint paint) {
    public void drawText(String text, float x, float y, Paint paint) {
        int modifiers = setupModifiers(paint);
        int modifiers = setupModifiers(paint);
        try {
        try {
            nDrawText(mRenderer, text, 0, text.length(), x, y, paint.mBidiFlags,
            nDrawText(mRenderer, text, 0, text.length(), x, y, paint.mNativePaint);
                    paint.mNativePaint);
        } finally {
        } finally {
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
        }
        }
@@ -1246,14 +1243,14 @@ class GLES20Canvas extends HardwareCanvas {
        int modifiers = setupModifiers(paint);
        int modifiers = setupModifiers(paint);
        try {
        try {
            nDrawTextOnPath(mRenderer, text, index, count, path.mNativePath, hOffset, vOffset,
            nDrawTextOnPath(mRenderer, text, index, count, path.mNativePath, hOffset, vOffset,
                    paint.mBidiFlags, paint.mNativePaint);
                    paint.mNativePaint);
        } finally {
        } finally {
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
        }
        }
    }
    }


    private static native void nDrawTextOnPath(int renderer, char[] text, int index, int count,
    private static native void nDrawTextOnPath(int renderer, char[] text, int index, int count,
            int path, float hOffset, float vOffset, int bidiFlags, int nativePaint);
            int path, float hOffset, float vOffset, int nativePaint);


    @Override
    @Override
    public void drawTextOnPath(String text, Path path, float hOffset, float vOffset, Paint paint) {
    public void drawTextOnPath(String text, Path path, float hOffset, float vOffset, Paint paint) {
@@ -1262,28 +1259,25 @@ class GLES20Canvas extends HardwareCanvas {
        int modifiers = setupModifiers(paint);
        int modifiers = setupModifiers(paint);
        try {
        try {
            nDrawTextOnPath(mRenderer, text, 0, text.length(), path.mNativePath, hOffset, vOffset,
            nDrawTextOnPath(mRenderer, text, 0, text.length(), path.mNativePath, hOffset, vOffset,
                    paint.mBidiFlags, paint.mNativePaint);
                    paint.mNativePaint);
        } finally {
        } finally {
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
        }
        }
    }
    }


    private static native void nDrawTextOnPath(int renderer, String text, int start, int end,
    private static native void nDrawTextOnPath(int renderer, String text, int start, int end,
            int path, float hOffset, float vOffset, int bidiFlags, int nativePaint);
            int path, float hOffset, float vOffset, int nativePaint);


    @Override
    @Override
    public void drawTextRun(char[] text, int index, int count, int contextIndex, int contextCount,
    public void drawTextRun(char[] text, int index, int count, int contextIndex, int contextCount,
            float x, float y, int dir, Paint paint) {
            float x, float y, Paint paint) {
        if ((index | count | text.length - index - count) < 0) {
        if ((index | count | text.length - index - count) < 0) {
            throw new IndexOutOfBoundsException();
            throw new IndexOutOfBoundsException();
        }
        }
        if (dir != DIRECTION_LTR && dir != DIRECTION_RTL) {
            throw new IllegalArgumentException("Unknown direction: " + dir);
        }


        int modifiers = setupModifiers(paint);
        int modifiers = setupModifiers(paint);
        try {
        try {
            nDrawTextRun(mRenderer, text, index, count, contextIndex, contextCount, x, y, dir,
            nDrawTextRun(mRenderer, text, index, count, contextIndex, contextCount, x, y,
                    paint.mNativePaint);
                    paint.mNativePaint);
        } finally {
        } finally {
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
@@ -1291,32 +1285,31 @@ class GLES20Canvas extends HardwareCanvas {
    }
    }


    private static native void nDrawTextRun(int renderer, char[] text, int index, int count,
    private static native void nDrawTextRun(int renderer, char[] text, int index, int count,
            int contextIndex, int contextCount, float x, float y, int dir, int nativePaint);
            int contextIndex, int contextCount, float x, float y, int nativePaint);


    @Override
    @Override
    public void drawTextRun(CharSequence text, int start, int end, int contextStart, int contextEnd,
    public void drawTextRun(CharSequence text, int start, int end, int contextStart, int contextEnd,
            float x, float y, int dir, Paint paint) {
            float x, float y, Paint paint) {
        if ((start | end | end - start | text.length() - end) < 0) {
        if ((start | end | end - start | text.length() - end) < 0) {
            throw new IndexOutOfBoundsException();
            throw new IndexOutOfBoundsException();
        }
        }


        int modifiers = setupModifiers(paint);
        int modifiers = setupModifiers(paint);
        try {
        try {
            int flags = dir == 0 ? 0 : 1;
            if (text instanceof String || text instanceof SpannedString ||
            if (text instanceof String || text instanceof SpannedString ||
                    text instanceof SpannableString) {
                    text instanceof SpannableString) {
                nDrawTextRun(mRenderer, text.toString(), start, end, contextStart,
                nDrawTextRun(mRenderer, text.toString(), start, end, contextStart,
                        contextEnd, x, y, flags, paint.mNativePaint);
                        contextEnd, x, y, paint.mNativePaint);
            } else if (text instanceof GraphicsOperations) {
            } else if (text instanceof GraphicsOperations) {
                ((GraphicsOperations) text).drawTextRun(this, start, end,
                ((GraphicsOperations) text).drawTextRun(this, start, end,
                        contextStart, contextEnd, x, y, flags, paint);
                        contextStart, contextEnd, x, y, paint);
            } else {
            } else {
                int contextLen = contextEnd - contextStart;
                int contextLen = contextEnd - contextStart;
                int len = end - start;
                int len = end - start;
                char[] buf = TemporaryBuffer.obtain(contextLen);
                char[] buf = TemporaryBuffer.obtain(contextLen);
                TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
                TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
                nDrawTextRun(mRenderer, buf, start - contextStart, len, 0, contextLen,
                nDrawTextRun(mRenderer, buf, start - contextStart, len, 0, contextLen,
                        x, y, flags, paint.mNativePaint);
                        x, y, paint.mNativePaint);
                TemporaryBuffer.recycle(buf);
                TemporaryBuffer.recycle(buf);
            }
            }
        } finally {
        } finally {
@@ -1325,7 +1318,7 @@ class GLES20Canvas extends HardwareCanvas {
    }
    }


    private static native void nDrawTextRun(int renderer, String text, int start, int end,
    private static native void nDrawTextRun(int renderer, String text, int start, int end,
            int contextStart, int contextEnd, float x, float y, int flags, int nativePaint);
            int contextStart, int contextEnd, float x, float y, int nativePaint);


    @Override
    @Override
    public void drawVertices(VertexMode mode, int vertexCount, float[] verts, int vertOffset,
    public void drawVertices(VertexMode mode, int vertexCount, float[] verts, int vertOffset,
Loading