From dbade9d6a075b1d5b8ebe10ee8961a5de296c93b Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Tue, 25 Aug 2009 13:20:19 -0400 Subject: [PATCH] expose runtime changes to gamma --- api/current.xml | 15 +++++++++++++ core/jni/android/graphics/Typeface.cpp | 22 +++++++++++++++++++- graphics/java/android/graphics/Typeface.java | 10 +++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/api/current.xml b/api/current.xml index 2d7ee316f753e..3c76361a9f386 100644 --- a/api/current.xml +++ b/api/current.xml @@ -60507,6 +60507,21 @@ visibility="public" > + + + + + + MAX_GAMMA) { + gamma = MAX_GAMMA; + } + return gamma; +} + +extern void skia_set_text_gamma(float, float); + +static void Typeface_setGammaForText(JNIEnv* env, jobject, jfloat blackGamma, + jfloat whiteGamma) { + // Comment this out for release builds. This is only used during development + skia_set_text_gamma(pinGamma(blackGamma), pinGamma(whiteGamma)); +} + /////////////////////////////////////////////////////////////////////////////// static JNINativeMethod gTypefaceMethods[] = { @@ -151,7 +170,8 @@ static JNINativeMethod gTypefaceMethods[] = { { "nativeCreateFromAsset", "(Landroid/content/res/AssetManager;Ljava/lang/String;)I", (void*)Typeface_createFromAsset }, { "nativeCreateFromFile", "(Ljava/lang/String;)I", - (void*)Typeface_createFromFile } + (void*)Typeface_createFromFile }, + { "setGammaForText", "(FF)V", (void*)Typeface_setGammaForText }, }; int register_android_graphics_Typeface(JNIEnv* env); diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java index e40e84af1096d..9bcab726a0210 100644 --- a/graphics/java/android/graphics/Typeface.java +++ b/graphics/java/android/graphics/Typeface.java @@ -172,4 +172,14 @@ public class Typeface { private static native int nativeGetStyle(int native_instance); private static native int nativeCreateFromAsset(AssetManager mgr, String path); private static native int nativeCreateFromFile(String path); + + /** + * Set the global gamma coefficients for black and white text. This call is + * usually a no-op in shipping products, and only exists for testing during + * development. + * + * @param blackGamma gamma coefficient for black text + * @param whiteGamma gamma coefficient for white text + */ + public static native void setGammaForText(float blackGamma, float whiteGamma); }