HaikuDepot: Fix Image Rendering

Resolve an issue with rendering package
icons when "Disable user addons" is
turned off.

Relates to #17862

Change-Id: Ic2d17626c40a97598613b8f21218d6829de97bbf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5556
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jacob Secunda <secundaja@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Andrew Lindesay 2022-08-14 20:33:59 +12:00 committed by waddlesplash
parent 8045bb174e
commit 8d18358cdf
2 changed files with 21 additions and 13 deletions

View File

@ -428,9 +428,12 @@ public:
BRect targetRect = BRect(inset, y + inset, SIZE_ICON + inset,
y + SIZE_ICON + inset);
const BBitmap* bitmap = icon->Bitmap(BITMAP_SIZE_64);
SetDrawingMode(B_OP_ALPHA);
DrawBitmap(bitmap, bitmap->Bounds(), targetRect,
B_FILTER_BITMAP_BILINEAR);
if (bitmap != NULL && bitmap->IsValid()) {
SetDrawingMode(B_OP_ALPHA);
DrawBitmap(bitmap, bitmap->Bounds(), targetRect,
B_FILTER_BITMAP_BILINEAR);
}
}
}
}
@ -461,12 +464,15 @@ public:
if (pkg->State() == ACTIVATED) {
const BBitmap* bitmap = sInstalledIcon->Bitmap(
BITMAP_SIZE_16);
float stringWidth = StringWidth(pkg->Title());
float offsetX = pt.x + stringWidth + PADDING;
BRect targetRect(offsetX, pt.y - 16, offsetX + 16, pt.y);
SetDrawingMode(B_OP_ALPHA);
DrawBitmap(bitmap, bitmap->Bounds(), targetRect,
B_FILTER_BITMAP_BILINEAR);
if (bitmap != NULL && bitmap->IsValid()) {
float stringWidth = StringWidth(pkg->Title());
float offsetX = pt.x + stringWidth + PADDING;
BRect targetRect(offsetX, pt.y - 16,
offsetX + 16, pt.y);
SetDrawingMode(B_OP_ALPHA);
DrawBitmap(bitmap, bitmap->Bounds(), targetRect,
B_FILTER_BITMAP_BILINEAR);
}
}
}

View File

@ -428,10 +428,12 @@ PackageColumn::DrawField(BField* field, BRect rect, BView* parent)
if (bitmapResult == B_OK) {
if (bitmapRef.IsSet()) {
const BBitmap* bitmap = bitmapRef->Bitmap(BITMAP_SIZE_16);
parent->SetDrawingMode(B_OP_ALPHA);
BRect viewRect(x, y, x + 15, y + 15);
parent->DrawBitmap(bitmap, bitmap->Bounds(), viewRect);
parent->SetDrawingMode(B_OP_OVER);
if (bitmap != NULL && bitmap->IsValid()) {
parent->SetDrawingMode(B_OP_ALPHA);
BRect viewRect(x, y, x + 15, y + 15);
parent->DrawBitmap(bitmap, bitmap->Bounds(), viewRect);
parent->SetDrawingMode(B_OP_OVER);
}
}
}