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