The ClippedLineTest now runs for 5 seconds max (should change the other tests
accordingly and refactor a bit). It also prints the number of clipping rects. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26685 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -22,7 +22,7 @@ ClippedLineTest::ClippedLineTest()
|
|||||||
fLinesPerIteration(20),
|
fLinesPerIteration(20),
|
||||||
|
|
||||||
fIterations(0),
|
fIterations(0),
|
||||||
fMaxIterations(100),
|
fMaxTestDuration(5000000),
|
||||||
|
|
||||||
fViewBounds(0, 0, -1, -1)
|
fViewBounds(0, 0, -1, -1)
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ ClippedLineTest::RunIteration(BView* view)
|
|||||||
fTestDuration += system_time() - now;
|
fTestDuration += system_time() - now;
|
||||||
fIterations++;
|
fIterations++;
|
||||||
|
|
||||||
return fIterations < fMaxIterations;
|
return system_time() - fTestStart < fMaxTestDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -87,6 +87,8 @@ ClippedLineTest::PrintResults()
|
|||||||
}
|
}
|
||||||
bigtime_t timeLeak = system_time() - fTestStart - fTestDuration;
|
bigtime_t timeLeak = system_time() - fTestStart - fTestDuration;
|
||||||
printf("Lines per iteration: %lu\n", fLinesPerIteration);
|
printf("Lines per iteration: %lu\n", fLinesPerIteration);
|
||||||
|
printf("Clipping rects: %ld\n", fClippingRegion.CountRects());
|
||||||
|
printf("Total lines rendered: %llu\n", fLinesRendered);
|
||||||
printf("Lines per second: %.3f\n",
|
printf("Lines per second: %.3f\n",
|
||||||
fLinesRendered * 1000000.0 / fTestDuration);
|
fLinesRendered * 1000000.0 / fTestDuration);
|
||||||
printf("Average time between iterations: %.4f seconds.\n",
|
printf("Average time between iterations: %.4f seconds.\n",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ private:
|
|||||||
uint32 fLinesPerIteration;
|
uint32 fLinesPerIteration;
|
||||||
|
|
||||||
uint32 fIterations;
|
uint32 fIterations;
|
||||||
uint32 fMaxIterations;
|
bigtime_t fMaxTestDuration;
|
||||||
|
|
||||||
BRect fViewBounds;
|
BRect fViewBounds;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "Test.h"
|
#include "Test.h"
|
||||||
|
|
||||||
#include <Region.h>
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -23,16 +22,16 @@ void
|
|||||||
Test::SetupClipping(BView* view)
|
Test::SetupClipping(BView* view)
|
||||||
{
|
{
|
||||||
BRect bounds = view->Bounds();
|
BRect bounds = view->Bounds();
|
||||||
BRegion clipping(bounds);
|
fClippingRegion.Set(bounds);
|
||||||
BRect grid(bounds.InsetByCopy(10, 10));
|
BRect grid(bounds.InsetByCopy(40, 40));
|
||||||
for (float y = grid.top; y < grid.bottom - 5; y += grid.Height() / 20) {
|
for (float y = grid.top; y < grid.bottom + 5; y += grid.Height() / 2) {
|
||||||
for (float x = grid.left; x < grid.right - 5;
|
for (float x = grid.left; x < grid.right + 5;
|
||||||
x += grid.Width() / 20) {
|
x += grid.Width() / 2) {
|
||||||
BRect r(x, y, x, y);
|
BRect r(x, y, x, y);
|
||||||
r.InsetBy(-5, -5);
|
r.InsetBy(-30, -30);
|
||||||
clipping.Exclude(r);
|
fClippingRegion.Exclude(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
view->ConstrainClippingRegion(&clipping);
|
view->ConstrainClippingRegion(&fClippingRegion);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
#ifndef TEST_H
|
#ifndef TEST_H
|
||||||
#define TEST_H
|
#define TEST_H
|
||||||
|
|
||||||
|
#include <Region.h>
|
||||||
|
|
||||||
class BView;
|
class BView;
|
||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
@@ -17,6 +19,9 @@ public:
|
|||||||
virtual void PrintResults() = 0;
|
virtual void PrintResults() = 0;
|
||||||
|
|
||||||
void SetupClipping(BView* view);
|
void SetupClipping(BView* view);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BRegion fClippingRegion;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TEST_H
|
#endif // TEST_H
|
||||||
|
|||||||
Reference in New Issue
Block a user