diff --git a/src/apps/showimage/ShowImageView.cpp b/src/apps/showimage/ShowImageView.cpp index 3279972f5a..d450ebf8f8 100644 --- a/src/apps/showimage/ShowImageView.cpp +++ b/src/apps/showimage/ShowImageView.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -133,7 +134,7 @@ compose_checker_background(const BBitmap* bitmap) blend_colors(p, kAlphaLow.red, kAlphaLow.green, kAlphaLow.blue, alpha); else blend_colors(p, kAlphaHigh.red, kAlphaHigh.green, kAlphaHigh.blue, alpha); - + } else { if (i % 10 >= 5) blend_colors(p, kAlphaHigh.red, kAlphaHigh.green, kAlphaHigh.blue, alpha); @@ -1105,7 +1106,7 @@ ShowImageView::MouseDown(BPoint position) // Using clickCount >= 2 and the modulo 2 accounts for quickly repeated // double-clicks - if (buttons == B_PRIMARY_MOUSE_BUTTON && clickCount >= 2 && + if (buttons == B_PRIMARY_MOUSE_BUTTON && clickCount >= 2 && clickCount % 2 == 0) { Window()->PostMessage(MSG_FULL_SCREEN); return; @@ -1752,15 +1753,7 @@ ShowImageView::ResizeImage(int w, int h) void ShowImageView::_SetIcon(bool clear, icon_size which) { - int32 size; - switch (which) { - case B_MINI_ICON: size = 16; - break; - case B_LARGE_ICON: size = 32; - break; - default: - return; - } + const int32 size = be_control_look->ComposeIconSize(which).IntegerWidth() + 1; BRect rect(fBitmap->Bounds()); float s; diff --git a/src/apps/showimage/ToolBarIcons.cpp b/src/apps/showimage/ToolBarIcons.cpp index 475f5bd0aa..c164de8708 100644 --- a/src/apps/showimage/ToolBarIcons.cpp +++ b/src/apps/showimage/ToolBarIcons.cpp @@ -15,6 +15,7 @@ #include #include +#include #include @@ -622,10 +623,10 @@ static IconData kIcons[] = { status_t init_tool_bar_icons() { - const int32 toolBarIconsSize = 22; - const int32 iconRenderSize = max_c(toolBarIconsSize, 32); + const BSize toolBarIconsSize = be_control_look->ComposeIconSize(22); + const BSize iconRenderSize = be_control_look->ComposeIconSize(32); - BBitmap bitmap(BRect(0, 0, iconRenderSize - 1, iconRenderSize - 1), + BBitmap bitmap(BRect(BPoint(0, 0), iconRenderSize), B_BITMAP_NO_SERVER_LINK, B_RGBA32); for (uint32 i = 0; i < sizeof(kIcons) / sizeof(IconData); i++) { @@ -633,22 +634,16 @@ init_tool_bar_icons() kIcons[i].size, &bitmap); if (ret != B_OK) return ret; - kIcons[i].bitmap = new(std::nothrow) BBitmap(BRect(0, 0, - toolBarIconsSize - 1, toolBarIconsSize - 1), 0, B_RGBA32); + kIcons[i].bitmap = new(std::nothrow) BBitmap(BRect(BPoint(0, 0), + toolBarIconsSize), 0, B_RGBA32); if (kIcons[i].bitmap == NULL) return B_NO_MEMORY; ret = kIcons[i].bitmap->InitCheck(); if (ret != B_OK) return ret; - uint8* src = reinterpret_cast(bitmap.Bits()); - uint32 srcBPR = bitmap.BytesPerRow(); - uint8* dst = reinterpret_cast(kIcons[i].bitmap->Bits()); - uint32 dstBPR = kIcons[i].bitmap->BytesPerRow(); - for (int32 y = 0; y < toolBarIconsSize; y++) { - memcpy(dst, src, 4 * toolBarIconsSize); - src += srcBPR; - dst += dstBPR; - } + + kIcons[i].bitmap->ImportBits(&bitmap, BPoint(0, 0), BPoint(0, 0), + toolBarIconsSize); } // Initializing 14 icons on startup takes about 10ms on a Core2Duo @ 2GHz.