From 3644b442faae0ee89674c0be970c44cc27dc9445 Mon Sep 17 00:00:00 2001 From: Zardshard <0azrune6@zard.anonaddy.com> Date: Tue, 23 Jul 2024 23:29:30 -0400 Subject: [PATCH] Do not clear a BBitmap with B_BITMAP_ACCEPTS_VIEWS Unless, of course, it has the B_BITMAP_CLEAR_TO_WHITE flag as well. From my testing, not clearing the BBitmap matches BeOS's behaviour more closely (if not exactly) compared to clearing the BBitmap. My test program created the BBitmap and BView, drew a diagonal red line across it, and saved the result to a file. The results: * BeOS - transparent background; red line with no anti-aliasing * Haiku, current behaviour - white background; red line * Haiku, new behaviour - transparent background; red line with black pixels as artifacts of the anti-aliasing process. The anti-aliasing artifacts, as PulkoMandy pointed out, are simply a result of not using the B_OP_ALPHA and an appropriate blending mode, and would happen on BeOS as well if the line had some transparency, such as through anti-aliasing. Change-Id: I09ac054eb0ce79e697b78ea48d1db4a15041e600 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7899 Haiku-Format: Haiku-format Bot Tested-by: Commit checker robot Reviewed-by: waddlesplash Reviewed-by: Adrien Destugues --- src/kits/interface/Bitmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/interface/Bitmap.cpp b/src/kits/interface/Bitmap.cpp index 8f826daa9f..ca484ae152 100644 --- a/src/kits/interface/Bitmap.cpp +++ b/src/kits/interface/Bitmap.cpp @@ -1210,7 +1210,7 @@ BBitmap::_InitObject(BRect bounds, color_space colorSpace, uint32 flags, if (fInitError == B_OK) { // clear to white if the flags say so. - if (flags & (B_BITMAP_CLEAR_TO_WHITE | B_BITMAP_ACCEPTS_VIEWS)) { + if (flags & B_BITMAP_CLEAR_TO_WHITE) { if (fColorSpace == B_CMAP8) { // "255" is the "transparent magic" index for B_CMAP8 bitmaps // use the correct index for "white"