Merge changes I3814b491,Ic3a7f4c0 into honeycomb

* changes:
  Pass SkRegion::toString() through to java.
  Remove optimization to isInContentArea that wasn't working.
This commit is contained in:
Joe Onorato
2011-01-19 16:11:04 -08:00
committed by Android (Google) Code Review
3 changed files with 24 additions and 10 deletions

View File

@@ -154,6 +154,16 @@ static void Region_scale(JNIEnv* env, jobject region, jfloat scale, jobject dst)
scale_rgn(rgn, *rgn, scale); scale_rgn(rgn, *rgn, scale);
} }
static jstring Region_toString(JNIEnv* env, jobject clazz, SkRegion* region) {
char* str = region->toString();
if (str == NULL) {
return NULL;
}
jstring result = env->NewStringUTF(str);
free(str);
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////
static SkRegion* Region_createFromParcel(JNIEnv* env, jobject clazz, jobject parcel) static SkRegion* Region_createFromParcel(JNIEnv* env, jobject clazz, jobject parcel)
@@ -262,6 +272,7 @@ static JNINativeMethod gRegionMethods[] = {
{ "quickReject", "(Landroid/graphics/Region;)Z", (void*)Region_quickRejectRgn }, { "quickReject", "(Landroid/graphics/Region;)Z", (void*)Region_quickRejectRgn },
{ "scale", "(FLandroid/graphics/Region;)V", (void*)Region_scale }, { "scale", "(FLandroid/graphics/Region;)V", (void*)Region_scale },
{ "translate", "(IILandroid/graphics/Region;)V", (void*)Region_translate }, { "translate", "(IILandroid/graphics/Region;)V", (void*)Region_translate },
{ "nativeToString", "(I)Ljava/lang/String;", (void*)Region_toString },
// parceling methods // parceling methods
{ "nativeCreateFromParcel", "(Landroid/os/Parcel;)I", (void*)Region_createFromParcel }, { "nativeCreateFromParcel", "(Landroid/os/Parcel;)I", (void*)Region_createFromParcel },
{ "nativeWriteToParcel", "(ILandroid/os/Parcel;)Z", (void*)Region_writeToParcel }, { "nativeWriteToParcel", "(ILandroid/os/Parcel;)Z", (void*)Region_writeToParcel },

View File

@@ -287,6 +287,10 @@ public class Region implements Parcelable {
region2.mNativeRegion, op.nativeInt); region2.mNativeRegion, op.nativeInt);
} }
public String toString() {
return nativeToString(mNativeRegion);
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
public static final Parcelable.Creator<Region> CREATOR public static final Parcelable.Creator<Region> CREATOR
@@ -357,6 +361,8 @@ public class Region implements Parcelable {
return mNativeRegion; return mNativeRegion;
} }
private static native boolean nativeEquals(int native_r1, int native_r2);
private static native int nativeConstructor(); private static native int nativeConstructor();
private static native void nativeDestructor(int native_region); private static native void nativeDestructor(int native_region);
@@ -381,5 +387,5 @@ public class Region implements Parcelable {
private static native boolean nativeWriteToParcel(int native_region, private static native boolean nativeWriteToParcel(int native_region,
Parcel p); Parcel p);
private static native boolean nativeEquals(int native_r1, int native_r2); private static native String nativeToString(int native_region);
} }

View File

@@ -52,7 +52,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
View mNotificationScroller; View mNotificationScroller;
View mNotificationGlow; View mNotificationGlow;
ViewGroup mContentFrame; ViewGroup mContentFrame;
Rect mContentArea; Rect mContentArea = new Rect();
View mSettingsView; View mSettingsView;
View mScrim, mGlow; View mScrim, mGlow;
ViewGroup mContentParent; ViewGroup mContentParent;
@@ -136,7 +136,6 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
@Override @Override
public void onSizeChanged(int w, int h, int oldw, int oldh) { public void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh); super.onSizeChanged(w, h, oldw, oldh);
mContentArea = null;
} }
public void onClick(View v) { public void onClick(View v) {
@@ -165,13 +164,11 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
} }
public boolean isInContentArea(int x, int y) { public boolean isInContentArea(int x, int y) {
if (mContentArea == null) { mContentArea.left = mContentFrame.getLeft();
mContentArea = new Rect(mContentFrame.getLeft(), mContentArea.top = mTitleArea.getTop();
mTitleArea.getTop(), mContentArea.right = mContentFrame.getRight();
mContentFrame.getRight(), mContentArea.bottom = mContentFrame.getBottom();
mContentFrame.getBottom()); offsetDescendantRectToMyCoords(mContentParent, mContentArea);
offsetDescendantRectToMyCoords(mContentParent, mContentArea);
}
return mContentArea.contains(x, y); return mContentArea.contains(x, y);
} }