Fixed gcc4 warnings and some style violations.
This commit is contained in:
parent
4412809657
commit
90a68e6002
|
@ -29,7 +29,8 @@ ReadNodeIcon(const char* name, icon_size size, bool followSymlink)
|
|||
|
||||
BNode node(BPath(&ref).Path());
|
||||
|
||||
BBitmap* ret = new BBitmap(BRect(0, 0, (float)size - 1, (float)size - 1), B_RGBA32);
|
||||
BBitmap* ret = new BBitmap(BRect(0, 0, (float)size - 1, (float)size - 1),
|
||||
B_RGBA32);
|
||||
if (BIconUtils::GetIcon(&node, BEOS_ICON_ATTRIBUTE, BEOS_MINI_ICON_ATTRIBUTE,
|
||||
BEOS_LARGE_ICON_ATTRIBUTE, size, ret) != B_OK) {
|
||||
delete ret;
|
||||
|
@ -72,7 +73,8 @@ BBitmap* IconFromResources(BResources* res, int32 num, icon_size size)
|
|||
cspace = B_CMAP8;
|
||||
}
|
||||
|
||||
BBitmap* icon = new BBitmap(BRect(0, 0, size - 1, size - 1), cspace);
|
||||
BBitmap* icon = new BBitmap(BRect(0, 0, (float)size - 1, (float)size - 1),
|
||||
cspace);
|
||||
if (icon->InitCheck() != B_OK)
|
||||
return NULL;
|
||||
|
||||
|
@ -103,28 +105,29 @@ RescaleBitmap(const BBitmap* src, int32 width, int32 height)
|
|||
|
||||
if (height < 0) {
|
||||
float srcProp = srcSize.Height() / srcSize.Width();
|
||||
height = (int32)(width * srcProp);
|
||||
height = (width * (int32)srcProp);
|
||||
}
|
||||
|
||||
BBitmap* res = new BBitmap(BRect(0, 0, width, height), src->ColorSpace());
|
||||
BBitmap* res = new BBitmap(BRect(0, 0, (float)width, (float)height),
|
||||
src->ColorSpace());
|
||||
|
||||
float dx = (srcSize.Width() + 1) / (width + 1);
|
||||
float dy = (srcSize.Height() + 1) / (height + 1);
|
||||
uint8 bpp = (uint8)(src->BytesPerRow() / srcSize.Width());
|
||||
float dx = (srcSize.Width() + 1) / ((float)width + 1);
|
||||
float dy = (srcSize.Height() + 1) / ((float)height + 1);
|
||||
uint8 bpp = (uint8)(src->BytesPerRow() / (int32)srcSize.Width());
|
||||
|
||||
int srcYOff = src->BytesPerRow();
|
||||
int dstYOff = res->BytesPerRow();
|
||||
int32 srcYOff = src->BytesPerRow();
|
||||
int32 dstYOff = res->BytesPerRow();
|
||||
|
||||
void* dstData = res->Bits();
|
||||
void* srcData = src->Bits();
|
||||
|
||||
for (int32 y = 0; y <= height; y++) {
|
||||
void* dstRow = (void *)((uint32)dstData + (uint32)(y * dstYOff));
|
||||
void* srcRow = (void *)((uint32)srcData + ((uint32)(y * dy) * srcYOff));
|
||||
void* dstRow = (void*)((uint32)dstData + (uint32)(y * dstYOff));
|
||||
void* srcRow = (void*)((uint32)srcData + ((uint32)(y * (int32)dy) * srcYOff));
|
||||
|
||||
for (int32 x = 0; x <= width; x++)
|
||||
memcpy((void*)((uint32)dstRow + (x * bpp)), (void*)((uint32)srcRow +
|
||||
((uint32)(x * dx) * bpp)), bpp);
|
||||
((uint32)(x * (int32)dx) * bpp)), bpp);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
|
@ -24,18 +24,20 @@
|
|||
const float kPopUpMarkerSize = 5.0f;
|
||||
const float kPopUpMarkerTop = 0.5f;
|
||||
const float kPopUpMarkerRect = (kPopUpMarkerSize * 2) + 2;
|
||||
const uint32 kToolbarIconSize = 16; // this should go on BControlLook
|
||||
const uint32 kToolbarIconSize = 16;
|
||||
// this should go on BControlLook
|
||||
|
||||
|
||||
ToolButton::ToolButton(const char* name, const char* label, BMessage* message,
|
||||
uint32 flags)
|
||||
: BControl(name, label, message,
|
||||
:
|
||||
BControl(name, label, message,
|
||||
flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
|
||||
fBitmap(NULL),
|
||||
fMenu(NULL),
|
||||
fPreferredSize(-1, -1)
|
||||
{
|
||||
SetFontSize(be_plain_font->Size() * 0.85);
|
||||
SetFontSize(be_plain_font->Size() * 0.85f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,7 +48,7 @@ ToolButton::ToolButton(const char* label, BMessage* message)
|
|||
fMenu(NULL),
|
||||
fPreferredSize(-1, -1)
|
||||
{
|
||||
SetFontSize(be_plain_font->Size() * 0.85);
|
||||
SetFontSize(be_plain_font->Size() * 0.85f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,7 +58,7 @@ ToolButton::ToolButton(BMessage* archive)
|
|||
fMenu(NULL),
|
||||
fPreferredSize(-1, -1)
|
||||
{
|
||||
SetFontSize(be_plain_font->Size() * 0.85);
|
||||
SetFontSize(be_plain_font->Size() * 0.85f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,7 +119,7 @@ ToolButton::Draw(BRect updateRect)
|
|||
uint32 flags = be_control_look->Flags(this);
|
||||
|
||||
// Draw background and borders
|
||||
rgb_color button = IsEnabled() ? tint_color(base, 1.07) : base;
|
||||
rgb_color button = IsEnabled() ? tint_color(base, 1.07f) : base;
|
||||
be_control_look->DrawButtonBackground(this, bounds, updateRect,
|
||||
button, flags, 0);
|
||||
be_control_look->DrawBorder(this, bounds, updateRect,
|
||||
|
@ -160,9 +162,11 @@ ToolButton::Draw(BRect updateRect)
|
|||
float tint = IsEnabled() ? B_DARKEN_4_TINT : B_DARKEN_1_TINT;
|
||||
BPoint center(_Center(bounds));
|
||||
BPoint triangle[3];
|
||||
triangle[0] = center + BPoint(-(kPopUpMarkerSize / 2.0), -kPopUpMarkerTop);
|
||||
triangle[0] = center + BPoint(-(kPopUpMarkerSize / 2.0),
|
||||
-kPopUpMarkerTop);
|
||||
triangle[1] = center + BPoint(kPopUpMarkerSize, -kPopUpMarkerTop);
|
||||
triangle[2] = center + BPoint(0.0, (kPopUpMarkerSize / 2.0f) - kPopUpMarkerTop);
|
||||
triangle[2] = center + BPoint(0.0, (kPopUpMarkerSize / 2.0f)
|
||||
- kPopUpMarkerTop);
|
||||
|
||||
uint32 origFlags = Flags();
|
||||
SetFlags(origFlags | B_SUBPIXEL_PRECISE);
|
||||
|
@ -375,8 +379,8 @@ ToolButton::SetMenu(BPopUpMenu* menu)
|
|||
BPoint
|
||||
ToolButton::_Center(BRect rect)
|
||||
{
|
||||
BPoint center(roundf((rect.left + rect.right) / 2.0),
|
||||
roundf((rect.top + rect.bottom) / 2.0));
|
||||
BPoint center(roundf((rect.left + rect.right) / 2.0f),
|
||||
roundf((rect.top + rect.bottom) / 2.0f));
|
||||
return center;
|
||||
}
|
||||
|
||||
|
@ -409,7 +413,7 @@ ToolButton::_ValidatePreferredSize()
|
|||
GetFontHeight(&fontHeight);
|
||||
|
||||
fPreferredSize.height
|
||||
+= ceilf((fontHeight.ascent + fontHeight.descent) * 1.5);
|
||||
+= ceilf((fontHeight.ascent + fontHeight.descent) * 1.5f);
|
||||
}
|
||||
|
||||
if (Bitmap())
|
||||
|
|
|
@ -16,7 +16,8 @@ public:
|
|||
BMessage* message,
|
||||
uint32 flags = B_WILL_DRAW | B_NAVIGABLE
|
||||
| B_FULL_UPDATE_ON_RESIZE);
|
||||
ToolButton(const char* label, BMessage* message = NULL);
|
||||
ToolButton(const char* label,
|
||||
BMessage* message = NULL);
|
||||
ToolButton(BMessage* archive);
|
||||
|
||||
virtual ~ToolButton();
|
||||
|
|
Ŝarĝante…
Reference in New Issue