diff --git a/src/background.cpp b/src/background.cpp index 7b4d169..bfec8ea 100644 --- a/src/background.cpp +++ b/src/background.cpp @@ -13,10 +13,10 @@ Background::Background(GMenu2X& gmenu2x) } void Background::paint(Surface& s) { - Font &font = *gmenu2x.font; - SurfaceCollection &sc = gmenu2x.sc; + Font& font = *gmenu2x.font; + OffscreenSurface& bgmain = *gmenu2x.bgmain; - sc["bgmain"]->blit(s, 0, 0); + bgmain.blit(s, 0, 0); font.write(s, clock.getTime(), s.width() / 2, gmenu2x.bottomBarTextY, diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index b84a239..bc12074 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -301,8 +301,8 @@ GMenu2X::~GMenu2X() { } void GMenu2X::initBG() { - sc.del("bgmain"); bg.reset(); + bgmain.reset(); // Load wallpaper. bg = OffscreenSurface::loadImage(confStr["wallpaper"]); @@ -313,7 +313,7 @@ void GMenu2X::initBG() { drawTopBar(*bg); drawBottomBar(*bg); - OffscreenSurface *bgmain = sc.add(*bg, "bgmain"); + bgmain.reset(new OffscreenSurface(*bg)); { auto sd = OffscreenSurface::loadImage( diff --git a/src/gmenu2x.h b/src/gmenu2x.h index ce6b25b..6218691 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -161,7 +161,10 @@ public: SurfaceCollection sc; Translator tr; std::unique_ptr s; + /** Background with empty top and bottom bar. */ std::unique_ptr bg; + /** Background with empty top bar and a partially filled bottom bar. */ + std::unique_ptr bgmain; std::unique_ptr font; //Status functions diff --git a/src/surfacecollection.cpp b/src/surfacecollection.cpp index a549bf4..7774b59 100644 --- a/src/surfacecollection.cpp +++ b/src/surfacecollection.cpp @@ -93,13 +93,6 @@ bool SurfaceCollection::exists(const string &path) { return surfaces.find(path) != surfaces.end(); } -OffscreenSurface *SurfaceCollection::add(Surface const& s, std::string const& path) { - if (exists(path)) del(path); - auto copy = new OffscreenSurface(s); - surfaces[path] = copy; - return copy; -} - OffscreenSurface *SurfaceCollection::add(const string &path) { if (path.empty()) return NULL; if (exists(path)) del(path); diff --git a/src/surfacecollection.h b/src/surfacecollection.h index 7e1b6e2..12a434d 100644 --- a/src/surfacecollection.h +++ b/src/surfacecollection.h @@ -44,12 +44,6 @@ public: void debug(); - /** - * Adds a copy of the given surface to this collection under the given - * path. Returns the copy. - */ - OffscreenSurface *add(Surface const& s, std::string const& path); - OffscreenSurface *add(const std::string &path); OffscreenSurface *addSkinRes(const std::string &path, bool useDefault = true); void del(const std::string &path);