Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: sky/engine/platform/graphics/GraphicsContextCullSaver.h

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « sky/engine/platform/graphics/GraphicsContext.cpp ('k') | sky/engine/platform/graphics/GraphicsContextRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698