Image ProjectExporter::getBestIconForSize (int size, bool returnNullIfNothingBigEnough) const { Image im; const Image im1 (getSmallIcon()); const Image im2 (getBigIcon()); if (im1.isValid() && im2.isValid()) { if (im1.getWidth() >= size && im2.getWidth() >= size) im = im1.getWidth() < im2.getWidth() ? im1 : im2; else if (im1.getWidth() >= size) im = im1; else if (im2.getWidth() >= size) im = im2; else return Image::null; } else { im = im1.isValid() ? im1 : im2; } if (returnNullIfNothingBigEnough && im.getWidth() < size && im.getHeight() < size) return Image::null; return rescaleImageForIcon (im, size); }
Image ProjectExporter::getBestIconForSize (int size, bool returnNullIfNothingBigEnough) const { Drawable* im = nullptr; ScopedPointer<Drawable> im1 (getSmallIcon()); ScopedPointer<Drawable> im2 (getBigIcon()); if (im1 != nullptr && im2 != nullptr) { if (im1->getWidth() >= size && im2->getWidth() >= size) im = im1->getWidth() < im2->getWidth() ? im1 : im2; else if (im1->getWidth() >= size) im = im1; else if (im2->getWidth() >= size) im = im2; } else { im = im1 != nullptr ? im1 : im2; } if (im == nullptr) return Image(); if (returnNullIfNothingBigEnough && im->getWidth() < size && im->getHeight() < size) return Image(); return rescaleImageForIcon (*im, size); }