Loading core/jni/android/graphics/Canvas.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -820,7 +820,12 @@ public: posPtr[indx].fX = SkFloatToScalar(posArray[indx << 1]); posPtr[indx].fY = SkFloatToScalar(posArray[(indx << 1) + 1]); } SkPaint::TextEncoding encoding = paint->getTextEncoding(); paint->setTextEncoding(SkPaint::kUTF16_TextEncoding); canvas->drawPosText(textArray + index, count << 1, posPtr, *paint); paint->setTextEncoding(encoding); if (text) { env->ReleaseCharArrayElements(text, textArray, 0); } Loading @@ -844,7 +849,12 @@ public: posPtr[indx].fX = SkFloatToScalar(posArray[indx << 1]); posPtr[indx].fY = SkFloatToScalar(posArray[(indx << 1) + 1]); } SkPaint::TextEncoding encoding = paint->getTextEncoding(); paint->setTextEncoding(SkPaint::kUTF16_TextEncoding); canvas->drawPosText(text_, byteLength << 1, posPtr, *paint); paint->setTextEncoding(encoding); if (text) { env->ReleaseStringChars(text, (const jchar*) text_); } Loading graphics/java/android/graphics/Canvas.java +6 −0 Original line number Diff line number Diff line Loading @@ -1517,6 +1517,9 @@ public class Canvas { * Draw the text in the array, with each character's origin specified by * the pos array. * * This method does not support glyph composition and decomposition and * should therefore not be used to render complex scripts. * * @param text The text to be drawn * @param index The index of the first character to draw * @param count The number of characters to draw, starting from index. Loading @@ -1537,6 +1540,9 @@ public class Canvas { * Draw the text in the array, with each character's origin specified by * the pos array. * * This method does not support glyph composition and decomposition and * should therefore not be used to render complex scripts. * * @param text The text to be drawn * @param pos Array of [x,y] positions, used to position each character * @param paint The paint used for the text (e.g. color, size, style) Loading tests/HwAccelerationTest/AndroidManifest.xml +10 −0 Original line number Diff line number Diff line Loading @@ -465,6 +465,16 @@ </intent-filter> </activity> <activity android:name="PosTextActivity" android:label="_PosText" android:theme="@android:style/Theme.NoTitleBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="ListActivity" android:label="__List"> Loading tests/HwAccelerationTest/res/values/strings.xml 0 → 100644 +19 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources> <string name="complex_string">"ตำแหน่งของตัวชี้"</string> </resources> tests/HwAccelerationTest/src/com/android/test/hwui/PosTextActivity.java 0 → 100644 +66 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.test.hwui; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.os.Bundle; import android.view.View; @SuppressWarnings({"UnusedDeclaration"}) public class PosTextActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new CustomTextView(this)); } static class CustomTextView extends View { private final Paint mLargePaint; private final String mText; private final float[] mPos; CustomTextView(Context c) { super(c); mText = c.getResources().getString(R.string.complex_string); mPos = new float[mText.length() * 2]; for (int i = 0; i < mPos.length; i += 2) { mPos[i] = i * 30.0f; mPos[i + 1] = i * 10.0f; } mLargePaint = new Paint(); mLargePaint.setAntiAlias(true); mLargePaint.setTextSize(36.0f); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawRGB(255, 255, 255); canvas.save(); canvas.translate(100.0f, 100.0f); canvas.drawPosText(mText, mPos, mLargePaint); canvas.restore(); } } } Loading
core/jni/android/graphics/Canvas.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -820,7 +820,12 @@ public: posPtr[indx].fX = SkFloatToScalar(posArray[indx << 1]); posPtr[indx].fY = SkFloatToScalar(posArray[(indx << 1) + 1]); } SkPaint::TextEncoding encoding = paint->getTextEncoding(); paint->setTextEncoding(SkPaint::kUTF16_TextEncoding); canvas->drawPosText(textArray + index, count << 1, posPtr, *paint); paint->setTextEncoding(encoding); if (text) { env->ReleaseCharArrayElements(text, textArray, 0); } Loading @@ -844,7 +849,12 @@ public: posPtr[indx].fX = SkFloatToScalar(posArray[indx << 1]); posPtr[indx].fY = SkFloatToScalar(posArray[(indx << 1) + 1]); } SkPaint::TextEncoding encoding = paint->getTextEncoding(); paint->setTextEncoding(SkPaint::kUTF16_TextEncoding); canvas->drawPosText(text_, byteLength << 1, posPtr, *paint); paint->setTextEncoding(encoding); if (text) { env->ReleaseStringChars(text, (const jchar*) text_); } Loading
graphics/java/android/graphics/Canvas.java +6 −0 Original line number Diff line number Diff line Loading @@ -1517,6 +1517,9 @@ public class Canvas { * Draw the text in the array, with each character's origin specified by * the pos array. * * This method does not support glyph composition and decomposition and * should therefore not be used to render complex scripts. * * @param text The text to be drawn * @param index The index of the first character to draw * @param count The number of characters to draw, starting from index. Loading @@ -1537,6 +1540,9 @@ public class Canvas { * Draw the text in the array, with each character's origin specified by * the pos array. * * This method does not support glyph composition and decomposition and * should therefore not be used to render complex scripts. * * @param text The text to be drawn * @param pos Array of [x,y] positions, used to position each character * @param paint The paint used for the text (e.g. color, size, style) Loading
tests/HwAccelerationTest/AndroidManifest.xml +10 −0 Original line number Diff line number Diff line Loading @@ -465,6 +465,16 @@ </intent-filter> </activity> <activity android:name="PosTextActivity" android:label="_PosText" android:theme="@android:style/Theme.NoTitleBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="ListActivity" android:label="__List"> Loading
tests/HwAccelerationTest/res/values/strings.xml 0 → 100644 +19 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources> <string name="complex_string">"ตำแหน่งของตัวชี้"</string> </resources>
tests/HwAccelerationTest/src/com/android/test/hwui/PosTextActivity.java 0 → 100644 +66 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.test.hwui; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.os.Bundle; import android.view.View; @SuppressWarnings({"UnusedDeclaration"}) public class PosTextActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new CustomTextView(this)); } static class CustomTextView extends View { private final Paint mLargePaint; private final String mText; private final float[] mPos; CustomTextView(Context c) { super(c); mText = c.getResources().getString(R.string.complex_string); mPos = new float[mText.length() * 2]; for (int i = 0; i < mPos.length; i += 2) { mPos[i] = i * 30.0f; mPos[i + 1] = i * 10.0f; } mLargePaint = new Paint(); mLargePaint.setAntiAlias(true); mLargePaint.setTextSize(36.0f); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawRGB(255, 255, 255); canvas.save(); canvas.translate(100.0f, 100.0f); canvas.drawPosText(mText, mPos, mLargePaint); canvas.restore(); } } }