Clock: TOffscreenView: small cleanup

This commit is contained in:
Ingo Weinhold
2013-06-30 13:46:56 +02:00
parent 301f4b463a
commit 2a24174d9b
+22 -36
View File
@@ -33,50 +33,36 @@ TOffscreenView::TOffscreenView(BRect frame, const char *name, short mRadius,
fShowSeconds(show) fShowSeconds(show)
{ {
status_t error; status_t error;
#ifdef __HAIKU__
BResources rsrcs; BResources rsrcs;
error = rsrcs.SetToImage(&&dummy_label); error = rsrcs.SetToImage(&&dummy_label);
dummy_label: dummy_label:
if (error == B_OK) { if (error == B_OK) {
{ for (short i = 0; i <= 8; i++)
#else fClockFace[i] = NULL;
// 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;
size_t len; size_t len;
void *picH; void *picH;
BRect theRect(0, 0, 82, 82); BRect theRect(0, 0, 82, 82);
for (short loop = 0; loop <= 8; loop++) { for (short loop = 0; loop <= 8; loop++) {
if ((picH = rsrcs.FindResource('PICT', loop + 4, &len))) { if ((picH = rsrcs.FindResource('PICT', loop + 4, &len))) {
fClockFace[loop] = new BBitmap(theRect, B_CMAP8); fClockFace[loop] = new BBitmap(theRect, B_CMAP8);
fClockFace[loop]->SetBits(picH, len, 0, 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);
free(picH); free(picH);
} }
}
theRect.Set(0,0,2,2); theRect.Set(0,0,15,15);
if ((picH = rsrcs.FindResource('PICT', 13, &len))) { if ((picH = rsrcs.FindResource(B_MINI_ICON_TYPE, "center", &len))) {
fInner = new BBitmap(theRect, B_CMAP8); fCenter = new BBitmap(theRect, B_CMAP8);
fInner->SetBits(picH, len, 0, B_CMAP8); fCenter->SetBits(picH, len, 0, B_CMAP8);
free(picH); 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);
} }
} }