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 <[email protected]> Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user