Support colours in shading
[ipdf/code.git] / src / view.cpp
index e0efce9..48e0a5a 100644 (file)
@@ -3,6 +3,10 @@
 #include "screen.h"
 #include "gl_core44.h"
 
+#ifndef CONTROLPANEL_DISABLED
+       #include "controlpanel.h"
+#endif //CONTROLPANEL_DISABLED
+
 using namespace IPDF;
 using namespace std;
 
@@ -16,7 +20,8 @@ using namespace std;
 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)
+               m_objbounds_vbo(), m_object_renderers(NUMBER_OF_OBJECT_TYPES), m_cpu_rendering_pixels(NULL),
+               m_show_object_bounds(false), m_perform_shading(USE_SHADING)
 {
        Debug("View Created - Bounds => {%s}", m_bounds.Str().c_str());
 
@@ -67,7 +72,22 @@ void View::Translate(Real x, Real y)
        y *= m_bounds.h;
        m_bounds.x += x;
        m_bounds.y += y;
-       Debug("View Bounds => %s", m_bounds.Str().c_str());
+       //Debug("View Bounds => %s", m_bounds.Str().c_str());
+       if (!m_use_gpu_transform)
+               m_buffer_dirty = true;
+       m_bounds_dirty = true;
+}
+
+/**
+ * Set View bounds
+ * @param bounds - New bounds
+ */
+void View::SetBounds(const Rect & bounds)
+{
+       m_bounds.x = bounds.x;
+       m_bounds.y = bounds.y;
+       m_bounds.w = bounds.w;
+       m_bounds.h = bounds.h;
        if (!m_use_gpu_transform)
                m_buffer_dirty = true;
        m_bounds_dirty = true;
@@ -239,6 +259,11 @@ void View::Render(int width, int height)
        m_cached_display.Blit(); // blit FrameBuffer to screen
        m_buffer_dirty = false;
        glPopDebugGroup();
+       
+#ifndef CONTROLPANEL_DISABLED
+       ControlPanel::Update();
+#endif //CONTROLPANEL_DISABLED
+       
 }
 
 #ifndef QUADTREE_DISABLED

UCC git Repository :: git.ucc.asn.au