Clock: TOffscreenView: small cleanup
This commit is contained in:
+22
-36
@@ -33,50 +33,36 @@ TOffscreenView::TOffscreenView(BRect frame, const char *name, short mRadius,
|
||||
fShowSeconds(show)
|
||||
{
|
||||
status_t error;
|
||||
#ifdef __HAIKU__
|
||||
BResources rsrcs;
|
||||
error = rsrcs.SetToImage(&&dummy_label);
|
||||
dummy_label:
|
||||
if (error == B_OK) {
|
||||
{
|
||||
#else
|
||||
// Note: Since we can be run as replicant, we get our
|
||||
// resources this way, not via be_app->AppResources().
|
||||
entry_ref ref;
|
||||
error = be_roster->FindApp(kAppSignature, &ref);
|
||||
if (error == B_NO_ERROR) {
|
||||
BFile file(&ref, O_RDONLY);
|
||||
error = file.InitCheck();
|
||||
if (error == B_NO_ERROR) {
|
||||
BResources rsrcs(&file);
|
||||
#endif
|
||||
for (short i = 0; i <= 8; i++)
|
||||
fClockFace[i] = NULL;
|
||||
for (short i = 0; i <= 8; i++)
|
||||
fClockFace[i] = NULL;
|
||||
|
||||
size_t len;
|
||||
void *picH;
|
||||
BRect theRect(0, 0, 82, 82);
|
||||
for (short loop = 0; loop <= 8; loop++) {
|
||||
if ((picH = rsrcs.FindResource('PICT', loop + 4, &len))) {
|
||||
fClockFace[loop] = new BBitmap(theRect, B_CMAP8);
|
||||
fClockFace[loop]->SetBits(picH, len, 0, B_CMAP8);
|
||||
free(picH);
|
||||
}
|
||||
}
|
||||
|
||||
theRect.Set(0,0,15,15);
|
||||
if ((picH = rsrcs.FindResource(B_MINI_ICON_TYPE, "center", &len))) {
|
||||
fCenter = new BBitmap(theRect, B_CMAP8);
|
||||
fCenter->SetBits(picH, len, 0, B_CMAP8);
|
||||
size_t len;
|
||||
void *picH;
|
||||
BRect theRect(0, 0, 82, 82);
|
||||
for (short loop = 0; loop <= 8; loop++) {
|
||||
if ((picH = rsrcs.FindResource('PICT', loop + 4, &len))) {
|
||||
fClockFace[loop] = new BBitmap(theRect, B_CMAP8);
|
||||
fClockFace[loop]->SetBits(picH, len, 0, B_CMAP8);
|
||||
free(picH);
|
||||
}
|
||||
}
|
||||
|
||||
theRect.Set(0,0,2,2);
|
||||
if ((picH = rsrcs.FindResource('PICT', 13, &len))) {
|
||||
fInner = new BBitmap(theRect, B_CMAP8);
|
||||
fInner->SetBits(picH, len, 0, B_CMAP8);
|
||||
free(picH);
|
||||
}
|
||||
theRect.Set(0,0,15,15);
|
||||
if ((picH = rsrcs.FindResource(B_MINI_ICON_TYPE, "center", &len))) {
|
||||
fCenter = new BBitmap(theRect, B_CMAP8);
|
||||
fCenter->SetBits(picH, len, 0, B_CMAP8);
|
||||
free(picH);
|
||||
}
|
||||
|
||||
theRect.Set(0,0,2,2);
|
||||
if ((picH = rsrcs.FindResource('PICT', 13, &len))) {
|
||||
fInner = new BBitmap(theRect, B_CMAP8);
|
||||
fInner->SetBits(picH, len, 0, B_CMAP8);
|
||||
free(picH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user