-#define RECT_FILLED_GEOM \
- "#version 150\n"\
- "\n"\
- "layout(lines) in;\n"\
- "layout(triangle_strip, max_vertices = 4) out;\n"\
- "\n"\
- "void main()\n"\
- "{\n"\
- "\tgl_Position = gl_in[0].gl_Position;\n"\
- "\tEmitVertex();\n"\
- "\tgl_Position = vec4(gl_in[0].gl_Position.x, gl_in[1].gl_Position.y, 0.0, 1.0);\n"\
- "\tEmitVertex();\n"\
- "\tgl_Position = vec4(gl_in[1].gl_Position.x, gl_in[0].gl_Position.y, 0.0, 1.0);\n"\
- "\tEmitVertex();\n"\
- "\tgl_Position = gl_in[1].gl_Position;\n"\
- "\tEmitVertex();\n"\
- "\tEndPrimitive();\n"\
- "}\n"
-
-#define CIRCLE_FILLED_GEOM \
- "#version 150\n"\
- "\n"\
- "layout(lines) in;\n"\
- "layout(triangle_strip, max_vertices = 4) out;\n"\
- "out vec2 objcoords;\n"\
- "\n"\
- "void main()\n"\
- "{\n"\
- "\tgl_Position = gl_in[0].gl_Position;\n"\
- "\tobjcoords = vec2(-1.0, -1.0);\n"\
- "\tEmitVertex();\n"\
- "\tgl_Position = vec4(gl_in[0].gl_Position.x, gl_in[1].gl_Position.y, 0.0, 1.0);\n"\
- "\tobjcoords = vec2(-1.0, 1.0);\n"\
- "\tEmitVertex();\n"\
- "\tgl_Position = vec4(gl_in[1].gl_Position.x, gl_in[0].gl_Position.y, 0.0, 1.0);\n"\
- "\tobjcoords = vec2(1.0, -1.0);\n"\
- "\tEmitVertex();\n"\
- "\tgl_Position = gl_in[1].gl_Position;\n"\
- "\tobjcoords = vec2(1.0, 1.0);\n"\
- "\tEmitVertex();\n"\
- "\tEndPrimitive();\n"\
- "}\n"
+/**
+ * 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
+}