diff options
Diffstat (limited to 'shadows/framework/src/main/java/org/robolectric/shadows/ShadowLegacyBitmap.java')
-rw-r--r-- | shadows/framework/src/main/java/org/robolectric/shadows/ShadowLegacyBitmap.java | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowLegacyBitmap.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowLegacyBitmap.java index d345491dc..715bc87a0 100644 --- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowLegacyBitmap.java +++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowLegacyBitmap.java @@ -1,7 +1,5 @@ package org.robolectric.shadows; -import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1; -import static android.os.Build.VERSION_CODES.KITKAT; import static android.os.Build.VERSION_CODES.M; import static android.os.Build.VERSION_CODES.O; import static android.os.Build.VERSION_CODES.Q; @@ -39,7 +37,6 @@ import java.util.Arrays; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Implementation; import org.robolectric.annotation.Implements; -import org.robolectric.annotation.RealObject; import org.robolectric.shadow.api.Shadow; import org.robolectric.util.ReflectionHelpers; import org.robolectric.versioning.AndroidVersions.U; @@ -55,7 +52,6 @@ public class ShadowLegacyBitmap extends ShadowBitmap { InputStream createdFromStream; FileDescriptor createdFromFileDescriptor; byte[] createdFromBytes; - @RealObject private Bitmap realBitmap; private Bitmap createdFromBitmap; private Bitmap scaledFromBitmap; private int createdFromX = -1; @@ -83,13 +79,13 @@ public class ShadowLegacyBitmap extends ShadowBitmap { return createBitmap((DisplayMetrics) null, width, height, config); } - @Implementation(minSdk = JELLY_BEAN_MR1) + @Implementation protected static Bitmap createBitmap( DisplayMetrics displayMetrics, int width, int height, Bitmap.Config config) { return createBitmap(displayMetrics, width, height, config, true); } - @Implementation(minSdk = JELLY_BEAN_MR1) + @Implementation protected static Bitmap createBitmap( DisplayMetrics displayMetrics, int width, @@ -199,7 +195,7 @@ public class ShadowLegacyBitmap extends ShadowBitmap { return createBitmap(null, colors, offset, stride, width, height, config); } - @Implementation(minSdk = JELLY_BEAN_MR1) + @Implementation protected static Bitmap createBitmap( DisplayMetrics displayMetrics, int[] colors, @@ -557,7 +553,7 @@ public class ShadowLegacyBitmap extends ShadowBitmap { return newBitmap; } - @Implementation(minSdk = KITKAT) + @Implementation protected final int getAllocationByteCount() { return getRowBytes() * getHeight(); } @@ -567,7 +563,7 @@ public class ShadowLegacyBitmap extends ShadowBitmap { return config; } - @Implementation(minSdk = KITKAT) + @Implementation protected void setConfig(Bitmap.Config config) { this.config = config; } @@ -624,12 +620,12 @@ public class ShadowLegacyBitmap extends ShadowBitmap { return extractAlpha(); } - @Implementation(minSdk = JELLY_BEAN_MR1) + @Implementation protected final boolean hasMipMap() { return hasMipMap; } - @Implementation(minSdk = JELLY_BEAN_MR1) + @Implementation protected final void setHasMipMap(boolean hasMipMap) { this.hasMipMap = hasMipMap; } @@ -639,7 +635,7 @@ public class ShadowLegacyBitmap extends ShadowBitmap { return width; } - @Implementation(minSdk = KITKAT) + @Implementation protected void setWidth(int width) { this.width = width; } @@ -649,7 +645,7 @@ public class ShadowLegacyBitmap extends ShadowBitmap { return height; } - @Implementation(minSdk = KITKAT) + @Implementation protected void setHeight(int height) { this.height = height; } @@ -761,7 +757,7 @@ public class ShadowLegacyBitmap extends ShadowBitmap { } } - @Implementation(minSdk = KITKAT) + @Implementation protected void reconfigure(int width, int height, Bitmap.Config config) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && this.config == Bitmap.Config.HARDWARE) { throw new IllegalStateException("native-backed bitmaps may not be reconfigured"); @@ -777,12 +773,12 @@ public class ShadowLegacyBitmap extends ShadowBitmap { bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); } - @Implementation(minSdk = KITKAT) + @Implementation protected boolean isPremultiplied() { return requestPremultiplied && hasAlpha(); } - @Implementation(minSdk = KITKAT) + @Implementation protected void setPremultiplied(boolean isPremultiplied) { this.requestPremultiplied = isPremultiplied; } |