| OLD | NEW |
| (Empty) |
| 1 #ifndef GraphicsContextCullSaver_h | |
| 2 #define GraphicsContextCullSaver_h | |
| 3 | |
| 4 #include "sky/engine/platform/graphics/GraphicsContext.h" | |
| 5 | |
| 6 namespace blink { | |
| 7 | |
| 8 class FloatRect; | |
| 9 | |
| 10 class GraphicsContextCullSaver { | |
| 11 WTF_MAKE_FAST_ALLOCATED; | |
| 12 public: | |
| 13 GraphicsContextCullSaver(GraphicsContext& context) | |
| 14 : m_context(context) | |
| 15 , m_cullApplied(false) | |
| 16 { | |
| 17 } | |
| 18 | |
| 19 GraphicsContextCullSaver(GraphicsContext& context, const FloatRect& rect) | |
| 20 : m_context(context) | |
| 21 , m_cullApplied(true) | |
| 22 { | |
| 23 context.beginCull(rect); | |
| 24 } | |
| 25 | |
| 26 ~GraphicsContextCullSaver() | |
| 27 { | |
| 28 if (m_cullApplied) | |
| 29 m_context.endCull(); | |
| 30 } | |
| 31 | |
| 32 void cull(const FloatRect& rect) | |
| 33 { | |
| 34 ASSERT(!m_cullApplied); | |
| 35 m_context.beginCull(rect); | |
| 36 m_cullApplied = true; | |
| 37 } | |
| 38 | |
| 39 private: | |
| 40 GraphicsContext& m_context; | |
| 41 bool m_cullApplied; | |
| 42 }; | |
| 43 | |
| 44 } // namespace blink | |
| 45 | |
| 46 #endif // GraphicsContextCullSaver_h | |
| OLD | NEW |