mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-25 20:49:44 +02:00
Surface: Made "raw" field private.
I cheated a bit by declaring ASFont as friend, but all other outside access now happens via methods. I removed the "saveScreenshot" method since the code calling it is commented out and I never heard anyone complain about missing this feature.
This commit is contained in:
parent
25e8e62622
commit
7861e07eb0
@ -1441,24 +1441,6 @@ void GMenu2X::changeWallpaper() {
|
||||
}
|
||||
}
|
||||
|
||||
void GMenu2X::saveScreenshot() {
|
||||
ledOn();
|
||||
uint x = 0;
|
||||
stringstream ss;
|
||||
string fname;
|
||||
do {
|
||||
x++;
|
||||
fname = "";
|
||||
ss.clear();
|
||||
ss << x;
|
||||
ss >> fname;
|
||||
fname = "screen"+fname+".bmp";
|
||||
} while (fileExists(fname));
|
||||
SDL_SaveBMP(s->raw,fname.c_str());
|
||||
sync();
|
||||
ledOff();
|
||||
}
|
||||
|
||||
void GMenu2X::addLink() {
|
||||
FileDialog fd(this,tr["Select an application"]);
|
||||
if (fd.exec()) {
|
||||
@ -1994,7 +1976,7 @@ int GMenu2X::drawButton(Surface *s, const string &btn, const string &text, int x
|
||||
SDL_Rect re = {x, y-7, 0, 16};
|
||||
if (sc.skinRes("imgs/buttons/"+btn+".png") != NULL) {
|
||||
sc["imgs/buttons/"+btn+".png"]->blit(s, x, y-7);
|
||||
re.w = sc["imgs/buttons/"+btn+".png"]->raw->w+3;
|
||||
re.w = sc["imgs/buttons/"+btn+".png"]->width() + 3;
|
||||
s->write(font, text, x+re.w, y, ASFont::HAlignLeft, ASFont::VAlignMiddle);
|
||||
re.w += font->getTextWidth(text);
|
||||
}
|
||||
@ -2046,7 +2028,7 @@ void GMenu2X::drawBottomBar(Surface *s) {
|
||||
|
||||
Surface *bar = sc.skinRes("imgs/bottombar.png");
|
||||
if (bar != NULL)
|
||||
bar->blit(s, 0, resY-bar->raw->h);
|
||||
bar->blit(s, 0, resY-bar->height());
|
||||
else
|
||||
s->box(0, resY-20, resX, 20, skinConfColors[COLOR_BOTTOM_BAR_BG]);
|
||||
}
|
||||
|
@ -210,7 +210,6 @@ public:
|
||||
void viewLog();
|
||||
void contextMenu();
|
||||
void changeWallpaper();
|
||||
void saveScreenshot();
|
||||
|
||||
void applyRamTimings();
|
||||
void applyDefaultTimings();
|
||||
|
@ -52,8 +52,8 @@ void IconButton::recalcSize() {
|
||||
margin = 0;
|
||||
|
||||
if (iconSurface != NULL) {
|
||||
w += iconSurface->raw->w;
|
||||
h += iconSurface->raw->h;
|
||||
w += iconSurface->width();
|
||||
h += iconSurface->height();
|
||||
iconRect.w = w;
|
||||
iconRect.h = h;
|
||||
iconRect.x = rect.x;
|
||||
|
@ -310,7 +310,7 @@ void LinkApp::showManual() {
|
||||
string pageStatus;
|
||||
|
||||
bool close = false, repaint = true;
|
||||
int page=0, pagecount=pngman->raw->w/320;
|
||||
int page = 0, pagecount = pngman->width() / 320;
|
||||
|
||||
ss << pagecount;
|
||||
string spagecount;
|
||||
|
@ -45,7 +45,8 @@ public:
|
||||
Surface(Surface *s);
|
||||
~Surface();
|
||||
|
||||
SDL_Surface *raw;
|
||||
int width() { return raw->w; }
|
||||
int height() { return raw->h; }
|
||||
|
||||
void flip();
|
||||
|
||||
@ -77,8 +78,12 @@ private:
|
||||
bool blitCenter(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
|
||||
bool blitRight(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
|
||||
|
||||
SDL_Surface *raw;
|
||||
bool freeWhenDone;
|
||||
int halfW, halfH;
|
||||
|
||||
// For direct access to "raw".
|
||||
friend class ASFont;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user