1/*
2 * Copyright (C) 2008 Stephan A��mus <superstippi@gmx.de>
3 * All rights reserved. Distributed under the terms of the MIT license.
4 */
5
6#include "Test.h"
7
8#include <stdio.h>
9
10#include <View.h>
11
12#include "DrawingModeToString.h"
13
14
15Test::Test()
16{
17}
18
19
20Test::~Test()
21{
22}
23
24
25void
26Test::SetupClipping(BView* view)
27{
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);
37		}
38	}
39
40	view->ConstrainClippingRegion(&fClippingRegion);
41}
42
43
44void
45Test::PrintResults(BView* view)
46{
47	if (fClippingRegion.CountRects() > 0)
48		printf("Clipping rects: %ld\n", fClippingRegion.CountRects());
49
50	const char* string;
51	if (ToString(view->DrawingMode(), string))
52		printf("Drawing mode: %s\n", string);
53}
54
55
56