From 630e0d5f82c050c71cd66d7c0b8ddcd4624f3dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 6 May 2006 10:04:05 +0000 Subject: [PATCH] Looks like there is an ancient bitmap archiving format that doesn't know about bytes per row or flags. This fixes bug #518. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17346 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Bitmap.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/kits/interface/Bitmap.cpp b/src/kits/interface/Bitmap.cpp index 5d6caba257..799eec5fdb 100644 --- a/src/kits/interface/Bitmap.cpp +++ b/src/kits/interface/Bitmap.cpp @@ -240,15 +240,30 @@ BBitmap::BBitmap(BMessage *data) fFlags(0), fInitError(B_NO_INIT) { + int32 flags; + if (data->FindInt32("_bmflags", &flags) != B_OK) { + // this bitmap is archived in some archaic format + flags = 0; + + bool acceptsViews; + if (data->FindBool("_view_ok", &acceptsViews) == B_OK && acceptsViews) + flags |= B_BITMAP_ACCEPTS_VIEWS; + + bool contiguous; + if (data->FindBool("_contiguous", &contiguous) == B_OK && contiguous) + flags |= B_BITMAP_IS_CONTIGUOUS; + } + + int32 rowBytes; + if (data->FindInt32("_rowbytes", &rowBytes) != B_OK) { + rowBytes = -1; + // bytes per row are computed in InitObject(), then + } + BRect bounds; color_space cspace; - int32 flags; - int32 rowBytes; if (data->FindRect("_frame", &bounds) == B_OK - && data->FindInt32("_cspace", (int32*)&cspace) == B_OK - && data->FindInt32("_bmflags", &flags) == B_OK - && data->FindInt32("_rowbytes", &rowBytes) == B_OK) { - + && data->FindInt32("_cspace", (int32*)&cspace) == B_OK) { _InitObject(bounds, cspace, flags, rowBytes, B_MAIN_SCREEN_ID); }