Search in sources :

Example 1 with NamedStream

use of org.robolectric.util.NamedStream in project robolectric by robolectric.

the class ShadowBitmapFactory method decodeStream.

@Implementation
public static Bitmap decodeStream(InputStream is, Rect outPadding, BitmapFactory.Options opts) {
    String name = is instanceof NamedStream ? is.toString().replace("stream for ", "") : null;
    Point imageSize = is instanceof NamedStream ? null : ImageUtil.getImageSizeFromStream(is);
    Bitmap bitmap = create(name, opts, imageSize);
    ShadowBitmap shadowBitmap = Shadows.shadowOf(bitmap);
    shadowBitmap.createdFromStream = is;
    return bitmap;
}
Also used : Bitmap(android.graphics.Bitmap) Point(android.graphics.Point) NamedStream(org.robolectric.util.NamedStream) Implementation(org.robolectric.annotation.Implementation)

Aggregations

Bitmap (android.graphics.Bitmap)1 Point (android.graphics.Point)1 Implementation (org.robolectric.annotation.Implementation)1 NamedStream (org.robolectric.util.NamedStream)1