1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-22 19:03:44 +02:00

Store "bgmain" in the GMenu2X object instead of in SurfaceCollection

Since this surface is created by initBG instead of loaded from skin
search paths, it didn't really fit in SurfaceCollection. After removing
it, one of SurfaceCollection's methods could be removed as well.
This commit is contained in:
Maarten ter Huurne 2014-08-15 04:03:00 +02:00
parent ab7a4c1cf7
commit 7134eb3778
5 changed files with 8 additions and 18 deletions

View File

@ -13,10 +13,10 @@ Background::Background(GMenu2X& gmenu2x)
} }
void Background::paint(Surface& s) { void Background::paint(Surface& s) {
Font &font = *gmenu2x.font; Font& font = *gmenu2x.font;
SurfaceCollection &sc = gmenu2x.sc; OffscreenSurface& bgmain = *gmenu2x.bgmain;
sc["bgmain"]->blit(s, 0, 0); bgmain.blit(s, 0, 0);
font.write(s, clock.getTime(), font.write(s, clock.getTime(),
s.width() / 2, gmenu2x.bottomBarTextY, s.width() / 2, gmenu2x.bottomBarTextY,

View File

@ -301,8 +301,8 @@ GMenu2X::~GMenu2X() {
} }
void GMenu2X::initBG() { void GMenu2X::initBG() {
sc.del("bgmain");
bg.reset(); bg.reset();
bgmain.reset();
// Load wallpaper. // Load wallpaper.
bg = OffscreenSurface::loadImage(confStr["wallpaper"]); bg = OffscreenSurface::loadImage(confStr["wallpaper"]);
@ -313,7 +313,7 @@ void GMenu2X::initBG() {
drawTopBar(*bg); drawTopBar(*bg);
drawBottomBar(*bg); drawBottomBar(*bg);
OffscreenSurface *bgmain = sc.add(*bg, "bgmain"); bgmain.reset(new OffscreenSurface(*bg));
{ {
auto sd = OffscreenSurface::loadImage( auto sd = OffscreenSurface::loadImage(

View File

@ -161,7 +161,10 @@ public:
SurfaceCollection sc; SurfaceCollection sc;
Translator tr; Translator tr;
std::unique_ptr<OutputSurface> s; std::unique_ptr<OutputSurface> s;
/** Background with empty top and bottom bar. */
std::unique_ptr<OffscreenSurface> bg; std::unique_ptr<OffscreenSurface> bg;
/** Background with empty top bar and a partially filled bottom bar. */
std::unique_ptr<OffscreenSurface> bgmain;
std::unique_ptr<Font> font; std::unique_ptr<Font> font;
//Status functions //Status functions

View File

@ -93,13 +93,6 @@ bool SurfaceCollection::exists(const string &path) {
return surfaces.find(path) != surfaces.end(); 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) { OffscreenSurface *SurfaceCollection::add(const string &path) {
if (path.empty()) return NULL; if (path.empty()) return NULL;
if (exists(path)) del(path); if (exists(path)) del(path);

View File

@ -44,12 +44,6 @@ public:
void debug(); 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 *add(const std::string &path);
OffscreenSurface *addSkinRes(const std::string &path, bool useDefault = true); OffscreenSurface *addSkinRes(const std::string &path, bool useDefault = true);
void del(const std::string &path); void del(const std::string &path);