Image ImageCache::getFromFile (const File& file) { const int64 hashCode = file.hashCode64(); Image image (getFromHashCode (hashCode)); if (image.isNull()) { image = ImageFileFormat::loadFrom (file); addImageToCache (image, hashCode); } return image; }
Image ImageCache::getFromMemory (const void* imageData, const int dataSize) { const int64 hashCode = (int64) (pointer_sized_int) imageData; Image image (getFromHashCode (hashCode)); if (image.isNull()) { image = ImageFileFormat::loadFrom (imageData, (size_t) dataSize); addImageToCache (image, hashCode); } return image; }
void RivenGraphics::beginCredits() { // Clear the old cache clearCache(); // Now cache all the credits images for (uint16 i = 302; i <= 320; i++) { MohawkSurface *surface = _bitmapDecoder->decodeImage(_vm->getExtrasResource(ID_TBMP, i)); surface->convertToTrueColor(); addImageToCache(i, surface); } // And clear our screen too clearMainScreen(); }