am 4defed42: Merge changes I3814b491,Ic3a7f4c0 into honeycomb

* commit '4defed42916dfe086eb450ca02d9c9a53e2018d9':
  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:14:03 -08:00
committed by Android Git Automerger
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);
}
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)
@@ -262,6 +272,7 @@ static JNINativeMethod gRegionMethods[] = {
{ "quickReject", "(Landroid/graphics/Region;)Z", (void*)Region_quickRejectRgn },
{ "scale", "(FLandroid/graphics/Region;)V", (void*)Region_scale },
{ "translate", "(IILandroid/graphics/Region;)V", (void*)Region_translate },
{ "nativeToString", "(I)Ljava/lang/String;", (void*)Region_toString },
// parceling methods
{ "nativeCreateFromParcel", "(Landroid/os/Parcel;)I", (void*)Region_createFromParcel },
{ "nativeWriteToParcel", "(ILandroid/os/Parcel;)Z", (void*)Region_writeToParcel },

View File

@@ -287,6 +287,10 @@ public class Region implements Parcelable {
region2.mNativeRegion, op.nativeInt);
}
public String toString() {
return nativeToString(mNativeRegion);
}
//////////////////////////////////////////////////////////////////////////
public static final Parcelable.Creator<Region> CREATOR
@@ -357,6 +361,8 @@ public class Region implements Parcelable {
return mNativeRegion;
}
private static native boolean nativeEquals(int native_r1, int native_r2);
private static native int nativeConstructor();
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,
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 mNotificationGlow;
ViewGroup mContentFrame;
Rect mContentArea;
Rect mContentArea = new Rect();
View mSettingsView;
View mScrim, mGlow;
ViewGroup mContentParent;
@@ -136,7 +136,6 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
@Override
public void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mContentArea = null;
}
public void onClick(View v) {
@@ -165,13 +164,11 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
}
public boolean isInContentArea(int x, int y) {
if (mContentArea == null) {
mContentArea = new Rect(mContentFrame.getLeft(),
mTitleArea.getTop(),
mContentFrame.getRight(),
mContentFrame.getBottom());
offsetDescendantRectToMyCoords(mContentParent, mContentArea);
}
mContentArea.left = mContentFrame.getLeft();
mContentArea.top = mTitleArea.getTop();
mContentArea.right = mContentFrame.getRight();
mContentArea.bottom = mContentFrame.getBottom();
offsetDescendantRectToMyCoords(mContentParent, mContentArea);
return mContentArea.contains(x, y);
}