diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/GLES20Canvas.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index 700d3df..761a788 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -945,14 +945,38 @@ class GLES20Canvas extends HardwareCanvas { @Override public void drawPosText(char[] text, int index, int count, float[] pos, Paint paint) { - // TODO: Implement + if (index < 0 || index + count > text.length || count * 2 > pos.length) { + throw new IndexOutOfBoundsException(); + } + + int modifiers = setupModifiers(paint); + try { + nDrawPosText(mRenderer, text, index, count, pos, paint.mNativePaint); + } finally { + if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers); + } } + private static native void nDrawPosText(int renderer, char[] text, int index, int count, + float[] pos, int paint); + @Override public void drawPosText(String text, float[] pos, Paint paint) { - // TODO: Implement + if (text.length() * 2 > pos.length) { + throw new ArrayIndexOutOfBoundsException(); + } + + int modifiers = setupModifiers(paint); + try { + nDrawPosText(mRenderer, text, 0, text.length(), pos, paint.mNativePaint); + } finally { + if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers); + } } + private static native void nDrawPosText(int renderer, String text, int start, int end, + float[] pos, int paint); + @Override public void drawRect(float left, float top, float right, float bottom, Paint paint) { int modifiers = setupModifiers(paint); |
