summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2012-09-26 17:37:04 +0800
committerAmit Pundir <amit.pundir@linaro.org>2013-02-13 17:08:26 +0530
commit3a331957f0d0e2916578e93749a2d89dcac9b711 (patch)
tree0445c6c944a79bdd38cf7da4b215c3806ca74774
parent6fedfaac3b72beddfe88943bba75e3d67621f445 (diff)
downloadbase-3a331957f0d0e2916578e93749a2d89dcac9b711.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);
}