1package com.bumptech.glide.load.resource; 2 3import com.bumptech.glide.load.Transformation; 4import com.bumptech.glide.load.engine.Resource; 5 6/** 7 * A noop Transformation that simply returns the given resource. 8 * 9 * @param <T> The type of the resource that will always be returned unmodified. 10 */ 11public class UnitTransformation<T> implements Transformation<T> { 12 private static final Transformation<?> TRANSFORMATION = new UnitTransformation<Object>(); 13 14 /** 15 * Returns a UnitTransformation for the given type. 16 * 17 * @param <T> The type of the resource to be transformed. 18 */ 19 @SuppressWarnings("unchecked") 20 public static <T> UnitTransformation<T> get() { 21 return (UnitTransformation<T>) TRANSFORMATION; 22 } 23 24 @Override 25 public Resource<T> transform(Resource<T> resource, int outWidth, int outHeight) { 26 return resource; 27 } 28 29 @Override 30 public String getId() { 31 return ""; 32 } 33} 34