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

Unified Diff: Source/platform/graphics/GraphicsContextCullSaver.h

Issue 204093002: GraphicsContext culling support. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Drop GC cull stack, misc fixes. Created 6 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/GraphicsContext.cpp ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/GraphicsContextCullSaver.h
diff --git a/Source/platform/graphics/GraphicsContextCullSaver.h b/Source/platform/graphics/GraphicsContextCullSaver.h
new file mode 100644
index 0000000000000000000000000000000000000000..ce85198b3ba1a4610f34fa9739336614a4ef450e
--- /dev/null
+++ b/Source/platform/graphics/GraphicsContextCullSaver.h
@@ -0,0 +1,47 @@
+#ifndef GraphicsContextCullSaver_h
+#define GraphicsContextCullSaver_h
+
+#include "platform/PlatformExport.h"
+#include "platform/graphics/GraphicsContext.h"
+
+namespace WebCore {
+
+class FloatRect;
+
+class PLATFORM_EXPORT GraphicsContextCullSaver {
Stephen Chennney 2014/03/21 19:44:20 You don't need this for a fully inlined class.
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ GraphicsContextCullSaver(GraphicsContext& context)
+ : m_context(context)
+ , m_cullApplied(false)
+ {
+ }
+
+ GraphicsContextCullSaver(GraphicsContext& context, const FloatRect& rect)
+ : m_context(context)
+ , m_cullApplied(true)
+ {
+ context.beginCull(rect);
+ }
+
+ ~GraphicsContextCullSaver()
+ {
+ if (m_cullApplied)
+ m_context.endCull();
+ }
+
+ void cull(const FloatRect& rect)
+ {
+ ASSERT(!m_cullApplied);
+ m_context.beginCull(rect);
+ m_cullApplied = true;
+ }
+
+private:
+ GraphicsContext& m_context;
+ bool m_cullApplied;
+};
+
+} // namespace WebCore
+
+#endif // GraphicsContextCullSaver_h
« no previous file with comments | « Source/platform/graphics/GraphicsContext.cpp ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698