int converterCount = converters.size();
int startingPoint = 0;
if (cache != null) {
for (int i = converterCount - 1; i >= 0; i--) {
ImageConverter converter = getConverter(i);
ImageFlavor flavor = converter.getTargetFlavor();
img = cache.getImage(info, flavor);
if (img != null) {
startingPoint = i + 1;
break;
}
}
if (img == null && loader != null) {
//try target flavor of loader from cache
ImageFlavor flavor = loader.getTargetFlavor();
img = cache.getImage(info, flavor);
}
}
if (img == null && originalImage != null) {
img = originalImage;
}
boolean entirelyInCache = true;
long duration;
if (img == null && loader != null) {
//Load image
img = loader.loadImage(info, hints, context);
if (log.isTraceEnabled()) {
duration = System.currentTimeMillis() - start;
log.trace("Image loading using " + loader + " took " + duration + " ms.");
}
//Caching
entirelyInCache = false;
if (img.isCacheable()) {
lastCacheableImage = img;
}
}
if (img == null) {
throw new ImageException(
"Pipeline fails. No ImageLoader and no original Image available.");
}
if (converterCount > 0) {
for (int i = startingPoint; i < converterCount; i++) {
ImageConverter converter = getConverter(i);
start = System.currentTimeMillis();
img = converter.convert(img, hints);
if (log.isTraceEnabled()) {
duration = System.currentTimeMillis() - start;
log.trace("Image conversion using " + converter + " took " + duration + " ms.");
}