Loading graphics/java/android/graphics/Bitmap.java +6 −2 Original line number Diff line number Diff line Loading @@ -755,6 +755,9 @@ public final class Bitmap implements Parcelable { if (b != null) { b.setPremultiplied(mRequestPremultiplied); b.mDensity = mDensity; if (hasGainmap()) { b.setGainmap(getGainmap().asShared()); } } return b; } Loading @@ -767,7 +770,8 @@ public final class Bitmap implements Parcelable { */ @NonNull public Bitmap asShared() { if (nativeIsBackedByAshmem(mNativePtr) && nativeIsImmutable(mNativePtr)) { if (nativeIsBackedByAshmem(mNativePtr) && nativeIsImmutable(mNativePtr) && (!hasGainmap() || getGainmap().asShared() == getGainmap())) { return this; } Bitmap shared = createAshmemBitmap(); Loading Loading @@ -2091,7 +2095,7 @@ public final class Bitmap implements Parcelable { */ public void setGainmap(@Nullable Gainmap gainmap) { checkRecycled("Bitmap is recycled"); mGainmap = null; mGainmap = gainmap; nativeSetGainmap(mNativePtr, gainmap == null ? 0 : gainmap.mNativePtr); } Loading graphics/java/android/graphics/Gainmap.java +12 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,18 @@ public final class Gainmap implements Parcelable { this(gainmapContents, nCreateCopy(gainmap.mNativePtr)); } /** * @hide */ public Gainmap asShared() { final Bitmap sharedContents = mGainmapContents.asShared(); if (sharedContents == mGainmapContents) { return this; } else { return new Gainmap(sharedContents, nCreateCopy(mNativePtr)); } } /** * @return Returns the image data of the gainmap represented as a Bitmap. This is represented * as a Bitmap for broad API compatibility, however certain aspects of the Bitmap are ignored Loading Loading
graphics/java/android/graphics/Bitmap.java +6 −2 Original line number Diff line number Diff line Loading @@ -755,6 +755,9 @@ public final class Bitmap implements Parcelable { if (b != null) { b.setPremultiplied(mRequestPremultiplied); b.mDensity = mDensity; if (hasGainmap()) { b.setGainmap(getGainmap().asShared()); } } return b; } Loading @@ -767,7 +770,8 @@ public final class Bitmap implements Parcelable { */ @NonNull public Bitmap asShared() { if (nativeIsBackedByAshmem(mNativePtr) && nativeIsImmutable(mNativePtr)) { if (nativeIsBackedByAshmem(mNativePtr) && nativeIsImmutable(mNativePtr) && (!hasGainmap() || getGainmap().asShared() == getGainmap())) { return this; } Bitmap shared = createAshmemBitmap(); Loading Loading @@ -2091,7 +2095,7 @@ public final class Bitmap implements Parcelable { */ public void setGainmap(@Nullable Gainmap gainmap) { checkRecycled("Bitmap is recycled"); mGainmap = null; mGainmap = gainmap; nativeSetGainmap(mNativePtr, gainmap == null ? 0 : gainmap.mNativePtr); } Loading
graphics/java/android/graphics/Gainmap.java +12 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,18 @@ public final class Gainmap implements Parcelable { this(gainmapContents, nCreateCopy(gainmap.mNativePtr)); } /** * @hide */ public Gainmap asShared() { final Bitmap sharedContents = mGainmapContents.asShared(); if (sharedContents == mGainmapContents) { return this; } else { return new Gainmap(sharedContents, nCreateCopy(mNativePtr)); } } /** * @return Returns the image data of the gainmap represented as a Bitmap. This is represented * as a Bitmap for broad API compatibility, however certain aspects of the Bitmap are ignored Loading