summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2012-09-26 17:37:04 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2012-09-26 17:37:04 +0800
commit492db87e9e60e46ead7cec50da0873965173c051 (patch)
treec0681fe6178faacbb6d907b005764fcdf7cdfe61
parent6a09a0a6ffd94334e0b0ad2594b5eeb98a35296c (diff)
downloadbase-492db87e9e60e46ead7cec50da0873965173c051.tar.gz
frameworks/base:(Hack)Print the content displayed with Canvas.drawText
This hack allows us to print content that displayed with the drawText method of Canvas.java when ro.debug.drawtext is set to true. This allows us to capture the contents on the screeen which will help us capture benchmark results for thirdparty apps which use drawText of Canvas to display results. Change-Id: Ic114fbe8d469ff27df57c585d3af322c703b4b83 Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--graphics/java/android/graphics/Canvas.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 3949afdd4a2a..d085c5e8054d 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -16,10 +16,12 @@
package android.graphics;
+import android.os.SystemProperties;
import android.text.GraphicsOperations;
import android.text.SpannableString;
import android.text.SpannedString;
import android.text.TextUtils;
+import android.util.Log;
import javax.microedition.khronos.opengles.GL;
@@ -37,6 +39,9 @@ import javax.microedition.khronos.opengles.GL;
* Canvas and Drawables</a> developer guide.</p></div>
*/
public class Canvas {
+
+ static final String LOG_TAG = "Canvas";
+
// assigned in constructors, freed in finalizer
final int mNativeCanvas;
@@ -1342,6 +1347,9 @@ public class Canvas {
* @param paint The paint used for the text (e.g. color, size, style)
*/
public void drawText(String text, float x, float y, Paint paint) {
+ if (SystemProperties.getBoolean("ro.debug.drawtext", false)) {
+ Log.d(LOG_TAG, text);
+ }
native_drawText(mNativeCanvas, text, 0, text.length(), x, y, paint.mBidiFlags,
paint.mNativePaint);
}