Ticket #4103: gui_bitmap_v1.patch

File gui_bitmap_v1.patch, 1.5 KB (added by lordhoto, 16 years ago)

Correct patch file this time. (again trunk r35998).

  • ThemeEngine.cpp

     
    397397                }
    398398        }
    399399       
     400        _bitmapFormat = _system->getOverlayFormat();
    400401        // Load the theme
    401402        // We pass the theme file here by default, so the user will
    402403        // have a descriptive error message. The only exception will
     
    414415}
    415416
    416417void ThemeEngine::refresh() {
     418        Graphics::PixelFormat fmt = _system->getOverlayFormat();
     419        if (fmt != _bitmapFormat) {
     420                for (ImagesMap::iterator i = _bitmaps.begin(); i != _bitmaps.end(); ++i) {
     421                        if (!i->_value)
     422                                continue;
     423
     424                        i->_value->free();
     425                        delete i->_value;
     426                        Graphics::Surface *surf = Graphics::ImageDecoder::loadFile(i->_key);
     427                        if (!surf && _themeArchive) {
     428                                Common::SeekableReadStream *stream = _themeArchive->openFile(i->_key);
     429                                if (stream) {
     430                                        surf = Graphics::ImageDecoder::loadFile(*stream);
     431                                        delete stream;
     432                                }
     433                        }
     434
     435                        i->_value = surf;
     436                }
     437
     438                _bitmapFormat = fmt;
     439        }
     440
    417441        init();
     442
    418443        if (_enabled) {
    419444                _system->showOverlay();
    420445
  • ThemeEngine.h

     
    583583        /** Array of all the text fonts that can be drawn. */
    584584        TextDrawData *_texts[kTextDataMAX];
    585585
     586        Graphics::PixelFormat _bitmapFormat;
    586587        ImagesMap _bitmaps;
    587588
    588589        /** List of all the dirty screens that must be blitted to the overlay. */