Icons Screensaver: Style fixes only

This commit is contained in:
John Scipione 2014-01-22 20:39:37 -05:00
parent 05cf63e3a7
commit 3cbb1132f8
3 changed files with 27 additions and 17 deletions

View File

@ -10,6 +10,7 @@
#ifndef ICON_DISPLAY_H #ifndef ICON_DISPLAY_H
#define ICON_DISPLAY_H #define ICON_DISPLAY_H
#include <Rect.h> #include <Rect.h>
#include <View.h> #include <View.h>
@ -35,14 +36,15 @@ public:
void DrawOn(BView* view, uint32 delta); void DrawOn(BView* view, uint32 delta);
private: private:
bool fIsRunning; bool fIsRunning;
uint8 fState; uint8 fState;
int32 fTicks; int32 fTicks;
int32 fDelay; int32 fDelay;
BBitmap* fBitmap; BBitmap* fBitmap;
BRect fFrame; BRect fFrame;
}; };
#endif
#endif // ICON_DISPLAY_H

View File

@ -23,6 +23,7 @@
#include "IconDisplay.h" #include "IconDisplay.h"
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Screensaver Icons" #define B_TRANSLATION_CONTEXT "Screensaver Icons"
@ -36,16 +37,19 @@
const rgb_color kBackgroundColor = ui_color(B_DESKTOP_COLOR); const rgb_color kBackgroundColor = ui_color(B_DESKTOP_COLOR);
BScreenSaver* instantiate_screen_saver(BMessage* msg, image_id image) BScreenSaver* instantiate_screen_saver(BMessage* msg, image_id image)
{ {
return new IconsSaver(msg, image); return new IconsSaver(msg, image);
} }
IconsSaver::IconsSaver(BMessage* msg, image_id image) // #pragma mark - IconsSaver
IconsSaver::IconsSaver(BMessage* archive, image_id image)
: :
BScreenSaver(msg, image), BScreenSaver(archive, image),
fVectorIconsCount(0),
fIcons(NULL), fIcons(NULL),
fBackBitmap(NULL), fBackBitmap(NULL),
fBackView(NULL), fBackView(NULL),
@ -61,7 +65,7 @@ IconsSaver::~IconsSaver()
status_t status_t
IconsSaver::StartSaver(BView *view, bool /*preview*/) IconsSaver::StartSaver(BView* view, bool /*preview*/)
{ {
if (fVectorIconsCount <= 0) { if (fVectorIconsCount <= 0) {
// Load the vector icons from the MIME types // Load the vector icons from the MIME types
@ -138,11 +142,11 @@ IconsSaver::StopSaver()
void void
IconsSaver::Draw(BView *view, int32 frame) IconsSaver::Draw(BView* view, int32 frame)
{ {
static int32 previousFrame = 0; static int32 previousFrame = 0;
// Update drawing // update drawing
if (fBackBitmap->Lock()) { if (fBackBitmap->Lock()) {
for (uint8 i = 0 ; i < MAX_ICONS ; i++) { for (uint8 i = 0 ; i < MAX_ICONS ; i++) {
fIcons[i].ClearOn(fBackView); fIcons[i].ClearOn(fBackView);
@ -157,7 +161,7 @@ IconsSaver::Draw(BView *view, int32 frame)
fBackBitmap->Unlock(); fBackBitmap->Unlock();
} }
// Sync the view with the back buffer // sync the view with the back buffer
view->DrawBitmap(fBackBitmap); view->DrawBitmap(fBackBitmap);
previousFrame = frame; previousFrame = frame;

View File

@ -10,6 +10,7 @@
#ifndef ICONS_SAVER_H #ifndef ICONS_SAVER_H
#define ICONS_SAVER_H #define ICONS_SAVER_H
#include <List.h> #include <List.h>
#include <ScreenSaver.h> #include <ScreenSaver.h>
@ -37,7 +38,10 @@ private:
BBitmap* fBackBitmap; BBitmap* fBackBitmap;
BView* fBackView; BView* fBackView;
uint16 fMinSize, fMaxSize;
uint16 fMinSize;
uint16 fMaxSize;
}; };
#endif
#endif // ICONS_SAVER_H