From 8359877941f34059cc2cbad37bb1002601c22403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 3 Jun 2005 19:26:26 +0000 Subject: [PATCH] reflects my tests with bitmaps in colorspaces other than B_RGB32, which do work btw git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12941 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/servers/app/bitmap_drawing/Jamfile | 2 +- src/tests/servers/app/bitmap_drawing/main.cpp | 35 +++++++++++++++---- src/tests/servers/app/bitmap_drawing/run | 2 +- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/tests/servers/app/bitmap_drawing/Jamfile b/src/tests/servers/app/bitmap_drawing/Jamfile index 6f15ee8910..d801e4e9be 100644 --- a/src/tests/servers/app/bitmap_drawing/Jamfile +++ b/src/tests/servers/app/bitmap_drawing/Jamfile @@ -3,7 +3,7 @@ SubDir OBOS_TOP src tests servers app bitmap_drawing ; UseHeaders [ FDirName os app ] ; UseHeaders [ FDirName os interface ] ; -SimpleTest BitmapDrawing : +App BitmapDrawing : main.cpp ; diff --git a/src/tests/servers/app/bitmap_drawing/main.cpp b/src/tests/servers/app/bitmap_drawing/main.cpp index 098aee3806..08440286f2 100644 --- a/src/tests/servers/app/bitmap_drawing/main.cpp +++ b/src/tests/servers/app/bitmap_drawing/main.cpp @@ -22,16 +22,37 @@ class TestView : public BView { TestView(BRect frame, const char* name, uint32 resizeFlags, uint32 flags) : BView(frame, name, resizeFlags, flags), - fBitmap(new BBitmap(BRect(0, 0, kBitmapWidth - 1, kBitmapHeight -1), - 0, kBitmapFormat)), +// fBitmap(new BBitmap(BRect(0, 0, kBitmapWidth - 1, kBitmapHeight -1), +// 0, kBitmapFormat)), + fBitmap(new BBitmap(BRect(0, 0, 32 - 1, 8 - 1), + 0, B_CMAP8)), +// fBitmap(new BBitmap(BRect(0, 0, 32 - 1, 8 - 1), +// 0, B_GRAY8)), fBitmapRect(), fTracking(TRACKING_NONE), fLastMousePos(-1.0, -1.0) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ViewColor()); - uint32 size = min_c((uint32)fBitmap->BitsLength(), sizeof(kBitmapBits)); - memcpy(fBitmap->Bits(), kBitmapBits, size); +// uint32 size = min_c((uint32)fBitmap->BitsLength(), sizeof(kBitmapBits)); +// memcpy(fBitmap->Bits(), kBitmapBits, size); + uint8* bits = (uint8*)fBitmap->Bits(); + uint32 width = fBitmap->Bounds().IntegerWidth() + 1; + uint32 height = fBitmap->Bounds().IntegerHeight() + 1; + uint32 bpr = fBitmap->BytesPerRow(); +printf("width: %ld, height: %ld, bpr: %ld\n", width, height, bpr); + int32 index = 0; + for (uint32 y = 0; y < height; y++) { + uint8* h = bits; + for (uint32 x = 0; x < width; x++) { + *h = index++; + h++; + } + bits += bpr; + } +BRect a(0.0, 10.0, 20.0, 10.0); +BRect b(0.0, 10.0, 10.0, 30.0); +printf("Intersects: %d\n", a.Intersects(b)); _ResetRect(); } @@ -112,7 +133,7 @@ bool hit_test(BPoint where, BPoint p) { BRect r(p, p); - r.InsetBy(-7.0, -7.0); + r.InsetBy(-5.0, -5.0); return r.Contains(where); } @@ -121,9 +142,9 @@ hit_test(BPoint where, BPoint a, BPoint b) { BRect r(a, b); if (a.x == b.x) - r.InsetBy(-7.0, 0.0); + r.InsetBy(-3.0, 0.0); else - r.InsetBy(0.0, -7.0); + r.InsetBy(0.0, -3.0); return r.Contains(where); } diff --git a/src/tests/servers/app/bitmap_drawing/run b/src/tests/servers/app/bitmap_drawing/run index c9d0beff82..b2f4674678 100755 --- a/src/tests/servers/app/bitmap_drawing/run +++ b/src/tests/servers/app/bitmap_drawing/run @@ -4,4 +4,4 @@ sleep 1s ../../../../../distro/x86.R1/beos/system/servers/obos_registrar & sleep 1s -../../../../../tests/servers/app/bitmap_drawing/BitmapDrawing +../../../../../distro/x86.R1/beos/apps/BitmapDrawing