vfs: check userland buffers before reading them.
[haiku.git] / src / tests / servers / app / benchmark / Test.cpp
blobc090defc991bc9872bddbb002510b447346f8db7
1 /*
2 * Copyright (C) 2008 Stephan Aßmus <superstippi@gmx.de>
3 * All rights reserved. Distributed under the terms of the MIT license.
4 */
6 #include "Test.h"
8 #include <stdio.h>
10 #include <View.h>
12 #include "DrawingModeToString.h"
15 Test::Test()
20 Test::~Test()
25 void
26 Test::SetupClipping(BView* view)
28 BRect bounds = view->Bounds();
29 fClippingRegion.Set(bounds);
30 BRect grid(bounds.InsetByCopy(40, 40));
31 for (float y = grid.top; y < grid.bottom + 5; y += grid.Height() / 2) {
32 for (float x = grid.left; x < grid.right + 5;
33 x += grid.Width() / 2) {
34 BRect r(x, y, x, y);
35 r.InsetBy(-30, -30);
36 fClippingRegion.Exclude(r);
40 view->ConstrainClippingRegion(&fClippingRegion);
44 void
45 Test::PrintResults(BView* view)
47 if (fClippingRegion.CountRects() > 0)
48 printf("Clipping rects: %ld\n", fClippingRegion.CountRects());
50 const char* string;
51 if (ToString(view->DrawingMode(), string))
52 printf("Drawing mode: %s\n", string);