+/**
+ * Constructs a view
+ * Allocates memory for ObjectRenderers
+ * @param document - The document to associate the View with
+ * @param bounds - Initial bounds of the View
+ * @param colour - Colour to use for rendering this view. TODO: Make sure this actually works, or just remove it
+ */
+View::View(Document & document, Screen & screen, const Rect & bounds, const Colour & colour)
+ : m_use_gpu_transform(USE_GPU_TRANSFORM), m_use_gpu_rendering(USE_GPU_RENDERING), m_bounds_dirty(true), m_buffer_dirty(true),
+ m_render_dirty(true), m_document(document), m_screen(screen), m_cached_display(), m_bounds(bounds), m_colour(colour), m_bounds_ubo(),
+ m_objbounds_vbo(), m_object_renderers(NUMBER_OF_OBJECT_TYPES), m_cpu_rendering_pixels(NULL)
+{
+ Debug("View Created - Bounds => {%s}", m_bounds.Str().c_str());
+
+ // Create ObjectRenderers - new's match delete's in View::~View
+ //TODO: Don't forget to put new renderers here or things will be segfaultastic
+ m_object_renderers[RECT_FILLED] = new RectFilledRenderer();
+ m_object_renderers[RECT_OUTLINE] = new RectOutlineRenderer();
+ m_object_renderers[CIRCLE_FILLED] = new CircleFilledRenderer();
+ m_object_renderers[BEZIER] = new BezierRenderer();
+
+ // To add rendering for a new type of object;
+ // 1. Add enum to ObjectType in ipdf.h
+ // 2. Implement class inheriting from ObjectRenderer using that type in objectrenderer.h and objectrenderer.cpp
+ // 3. Add it here
+ // 4. Profit
+
+
+#ifndef QUADTREE_DISABLED
+ m_quadtree_max_depth = 1;
+ m_current_quadtree_node = document.GetQuadTree().root_id;
+#endif
+}
+
+/**
+ * Destroy a view
+ * Frees memory used by ObjectRenderers
+ */
+View::~View()
+{
+ for (unsigned i = 0; i < m_object_renderers.size(); ++i)
+ {
+ delete m_object_renderers[i]; // delete's match new's in constructor
+ }
+ m_object_renderers.clear();
+ delete [] m_cpu_rendering_pixels;
+}
+
+/**
+ * Translate the view
+ * @param x, y - Amount to translate
+ */