Loading core/jni/android/graphics/Bitmap.cpp +6 −7 Original line number Diff line number Diff line Loading @@ -1190,8 +1190,7 @@ static void Bitmap_copyPixelsFromBuffer(JNIEnv* env, jobject, } } static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, jlong bm1Handle) { static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, jlong bm1Handle) { SkBitmap bm0; SkBitmap bm1; Loading @@ -1207,11 +1206,11 @@ static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, bitmap0->bitmap().getSkBitmap(&bm0); bitmap1->bitmap().getSkBitmap(&bm1); if (bm0.width() != bm1.width() || bm0.height() != bm1.height() || bm0.colorType() != bm1.colorType() || bm0.alphaType() != bm1.alphaType() || bm0.colorSpace() != bm1.colorSpace()) { if (bm0.width() != bm1.width() || bm0.height() != bm1.height() || bm0.colorType() != bm1.colorType() || bm0.alphaType() != bm1.alphaType() || !SkColorSpace::Equals(bm0.colorSpace(), bm1.colorSpace())) { return JNI_FALSE; } Loading core/tests/coretests/src/android/view/ViewCaptureTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view; import static org.junit.Assert.assertTrue; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; Loading @@ -32,8 +34,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.assertTrue; @RunWith(AndroidJUnit4.class) public class ViewCaptureTest { Loading Loading @@ -70,6 +70,7 @@ public class ViewCaptureTest { private void testCreateSnapshot(boolean skipChildren, int goldenResId) { Bitmap result = mViewToCapture.createSnapshot(Bitmap.Config.ARGB_8888, 0, skipChildren); result.setHasAlpha(false); // resource will have no alpha, since content is opaque Bitmap golden = BitmapFactory.decodeResource(mActivity.getResources(), goldenResId); assertTrue(golden.sameAs(result)); } Loading Loading
core/jni/android/graphics/Bitmap.cpp +6 −7 Original line number Diff line number Diff line Loading @@ -1190,8 +1190,7 @@ static void Bitmap_copyPixelsFromBuffer(JNIEnv* env, jobject, } } static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, jlong bm1Handle) { static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, jlong bm1Handle) { SkBitmap bm0; SkBitmap bm1; Loading @@ -1207,11 +1206,11 @@ static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle, bitmap0->bitmap().getSkBitmap(&bm0); bitmap1->bitmap().getSkBitmap(&bm1); if (bm0.width() != bm1.width() || bm0.height() != bm1.height() || bm0.colorType() != bm1.colorType() || bm0.alphaType() != bm1.alphaType() || bm0.colorSpace() != bm1.colorSpace()) { if (bm0.width() != bm1.width() || bm0.height() != bm1.height() || bm0.colorType() != bm1.colorType() || bm0.alphaType() != bm1.alphaType() || !SkColorSpace::Equals(bm0.colorSpace(), bm1.colorSpace())) { return JNI_FALSE; } Loading
core/tests/coretests/src/android/view/ViewCaptureTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view; import static org.junit.Assert.assertTrue; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; Loading @@ -32,8 +34,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.assertTrue; @RunWith(AndroidJUnit4.class) public class ViewCaptureTest { Loading Loading @@ -70,6 +70,7 @@ public class ViewCaptureTest { private void testCreateSnapshot(boolean skipChildren, int goldenResId) { Bitmap result = mViewToCapture.createSnapshot(Bitmap.Config.ARGB_8888, 0, skipChildren); result.setHasAlpha(false); // resource will have no alpha, since content is opaque Bitmap golden = BitmapFactory.decodeResource(mActivity.getResources(), goldenResId); assertTrue(golden.sameAs(result)); } Loading