From e18f9c5e678b56a4dbefa50d8c3fb3405d00e375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 30 Mar 2005 22:05:22 +0000 Subject: [PATCH] with the optimization for solid horizontal and vertical one pixel wide lines, and for solid rectangles, the performs gap between Painter and original BView closes, with BView being 0.12 times faster drawing lines and 1.4 times faster drawing rectangles... into a BBitmap git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12169 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/servers/app/painter/main.cpp | 35 ++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/tests/servers/app/painter/main.cpp b/src/tests/servers/app/painter/main.cpp index 05edc2c8b1..e760fca91f 100644 --- a/src/tests/servers/app/painter/main.cpp +++ b/src/tests/servers/app/painter/main.cpp @@ -45,6 +45,35 @@ test_straight_lines(Surface& s, uint32 width, uint32 height) return system_time() - now; } +// test_fill_rect +template +bigtime_t +test_fill_rect(Surface& s, uint32 width, uint32 height) +{ + bigtime_t now = system_time(); + + s.SetPenSize(1.0); + s.SetDrawingMode(B_OP_COPY); + s.SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); + + s.SetHighColor(0, 0, 0, 255); + s.SetLowColor(130, 0, 20, 255); + + const pattern pat = B_SOLID_HIGH; + + BRect r; + for (uint32 y = 10; y <= height; y += 20) { + for (uint32 x = 10; x <= width; x += 20) { + r.Set(x - 9, y - 9, x + 9, y + 9); + s.FillRect(r, pat); + } + } + + s.Sync(); + + return system_time() - now; +} + // test_ellipses template bigtime_t @@ -315,9 +344,10 @@ main(int argc, char **argv) // reset bitmap contents memset(bitmap->Bits(), 255, bitmap->BitsLength()); // run test - painterNow += test(painter, width, height, testBitmap); +// painterNow += test(painter, width, height, testBitmap); // painterNow += test_lines(painter, width, height); // painterNow += test_straight_lines(painter, width, height); + painterNow += test_fill_rect(painter, width, height); // painterNow += test_ellipses(painter, width, height); } @@ -341,9 +371,10 @@ fprintf(stdout, " %lld µsecs\n", painterNow / iterations); // reset bitmap contents memset(bitmap->Bits(), 255, bitmap->BitsLength()); // run test - viewNow += test(*view, width, height, testBitmap); +// viewNow += test(*view, width, height, testBitmap); // viewNow += test_lines(*view, width, height); // viewNow += test_straight_lines(*view, width, height); + viewNow += test_fill_rect(*view, width, height); // viewNow += test_ellipses(*view, width, height); }