PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/lllocalcliprect.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 63 lines | 26 code | 7 blank | 30 comment | 0 complexity | 1e225f2e3efd7afad30b1fb46e1c2bfc MD5 | raw file
 1/** 
 2* @file lllocalcliprect.h
 3*
 4* $LicenseInfo:firstyear=2009&license=viewerlgpl$
 5* Second Life Viewer Source Code
 6* Copyright (C) 2010, Linden Research, Inc.
 7* 
 8* This library is free software; you can redistribute it and/or
 9* modify it under the terms of the GNU Lesser General Public
10* License as published by the Free Software Foundation;
11* version 2.1 of the License only.
12* 
13* This library is distributed in the hope that it will be useful,
14* but WITHOUT ANY WARRANTY; without even the implied warranty of
15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16* Lesser General Public License for more details.
17* 
18* You should have received a copy of the GNU Lesser General Public
19* License along with this library; if not, write to the Free Software
20* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21* 
22* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
23* $/LicenseInfo$
24*/
25#ifndef LLLOCALCLIPRECT_H
26#define LLLOCALCLIPRECT_H
27
28#include "llgl.h"
29#include "llrect.h"		// can't forward declare, it's templated
30#include <stack>
31
32// Clip rendering to a specific rectangle using GL scissor
33// Just create one of these on the stack:
34// {
35//     LLLocalClipRect(rect);
36//     draw();
37// }
38class LLScreenClipRect
39{
40public:
41	LLScreenClipRect(const LLRect& rect, BOOL enabled = TRUE);
42	virtual ~LLScreenClipRect();
43
44private:
45	static void pushClipRect(const LLRect& rect);
46	static void popClipRect();
47	static void updateScissorRegion();
48
49private:
50	LLGLState		mScissorState;
51	BOOL			mEnabled;
52
53	static std::stack<LLRect> sClipRectStack;
54};
55
56class LLLocalClipRect : public LLScreenClipRect
57{
58public:
59	LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE);
60	~LLLocalClipRect();
61};
62
63#endif