List images = new ArrayList(genericVariants);
int maxWidth = -1;
int deviceWidth = device.getPixelsX();
EncodingCollection supportedEncodings =
device.getSupportedImageEncodings();
// Check each image is supported by the requesting device. If not then
// we can discard the image from our selection. Also remove any images that
// are wider than the width of the device.
// for (int i = 0; i < images.length; i++) {
for (Iterator i = images.iterator(); i.hasNext();) {
Variant variant = (Variant) i.next();
ImageMetaData image = (ImageMetaData) variant.getMetaData();
ImageEncoding encoding = image.getImageEncoding();
if (!supportedEncodings.contains(encoding)) {
if (logger.isDebugEnabled()) {
logger.debug("Discarding variant " + variant +
" as device does not support encoding.");
}
i.remove();