Message screensaver: style fixes
Change-Id: Ifd910a517411e888eaee0efda2fa18838a1023d7 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2513 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -30,7 +30,8 @@
|
|||||||
|
|
||||||
|
|
||||||
// Double brackets to satisfy a compiler warning
|
// Double brackets to satisfy a compiler warning
|
||||||
const pattern kCheckered = { { 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0x33, 0x33 } };
|
const pattern kCheckered =
|
||||||
|
{ { 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0x33, 0x33 } };
|
||||||
|
|
||||||
// Get a clever message from fortune
|
// Get a clever message from fortune
|
||||||
BString *get_message()
|
BString *get_message()
|
||||||
@@ -201,7 +202,8 @@ Message::Draw(BView *view, int32 frame)
|
|||||||
BFont font;
|
BFont font;
|
||||||
offscreen.GetFont(&font);
|
offscreen.GetFont(&font);
|
||||||
font.SetFace(B_BOLD_FACE);
|
font.SetFace(B_BOLD_FACE);
|
||||||
font.SetFamilyAndStyle(fFontFamilies.ItemAt(rand() % fFontFamilies.CountItems())->val, NULL);
|
font.SetFamilyAndStyle(
|
||||||
|
fFontFamilies.ItemAt(rand() % fFontFamilies.CountItems())->val, NULL);
|
||||||
offscreen.SetFont(&font);
|
offscreen.SetFont(&font);
|
||||||
|
|
||||||
// Get the message
|
// Get the message
|
||||||
@@ -266,7 +268,8 @@ Message::Draw(BView *view, int32 frame)
|
|||||||
int longestLine = 0;
|
int longestLine = 0;
|
||||||
int32 count = get_lines(origMessage, lines, &longestLine);
|
int32 count = get_lines(origMessage, lines, &longestLine);
|
||||||
|
|
||||||
float stringWidth = font.StringWidth(lines.StringAt(longestLine).String());
|
float stringWidth =
|
||||||
|
font.StringWidth(lines.StringAt(longestLine).String());
|
||||||
BRect box(0, 0, stringWidth + 20, (lineHeight * count) + 20);
|
BRect box(0, 0, stringWidth + 20, (lineHeight * count) + 20);
|
||||||
box.OffsetTo((width - box.Width()) / 2, height - box.Height() - 40);
|
box.OffsetTo((width - box.Width()) / 2, height - box.Height() - 40);
|
||||||
|
|
||||||
@@ -292,4 +295,3 @@ Message::Draw(BView *view, int32 frame)
|
|||||||
view->DrawBitmap(&buffer);
|
view->DrawBitmap(&buffer);
|
||||||
buffer.RemoveChild(&offscreen);
|
buffer.RemoveChild(&offscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user