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 <View.h> 9 10 11 Test::Test() 12 { 13 } 14 15 16 Test::~Test() 17 { 18 } 19 20 21 void 22 Test::SetupClipping(BView* view) 23 { 24 BRect bounds = view->Bounds(); 25 fClippingRegion.Set(bounds); 26 BRect grid(bounds.InsetByCopy(40, 40)); 27 for (float y = grid.top; y < grid.bottom + 5; y += grid.Height() / 2) { 28 for (float x = grid.left; x < grid.right + 5; 29 x += grid.Width() / 2) { 30 BRect r(x, y, x, y); 31 r.InsetBy(-30, -30); 32 fClippingRegion.Exclude(r); 33 } 34 } 35 36 view->ConstrainClippingRegion(&fClippingRegion); 37 } 38