PageRenderTime 25ms CodeModel.GetById 11ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #include "llgl.h"
  28. #include "llrect.h" // can't forward declare, it's templated
  29. #include <stack>
  30. // Clip rendering to a specific rectangle using GL scissor
  31. // Just create one of these on the stack:
  32. // {
  33. // LLLocalClipRect(rect);
  34. // draw();
  35. // }
  36. class LLScreenClipRect
  37. {
  38. public:
  39. LLScreenClipRect(const LLRect& rect, BOOL enabled = TRUE);
  40. virtual ~LLScreenClipRect();
  41. private:
  42. static void pushClipRect(const LLRect& rect);
  43. static void popClipRect();
  44. static void updateScissorRegion();
  45. private:
  46. LLGLState mScissorState;
  47. BOOL mEnabled;
  48. static std::stack<LLRect> sClipRectStack;
  49. };
  50. class LLLocalClipRect : public LLScreenClipRect
  51. {
  52. public:
  53. LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE);
  54. ~LLLocalClipRect();
  55. };
  56. #endif