X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fview.cpp;h=8f4a8a4d9fd25f3dd12b885a530caecc06d1932e;hp=e0efce949b3f0473bdd256be1015617bd083596c;hb=3172dd5af487e0f8a6e5cd5439dea594b9cbd7c9;hpb=53579b1a949fa3e4e193f8dfba2064edbb123f57 diff --git a/src/view.cpp b/src/view.cpp index e0efce9..8f4a8a4 100644 --- a/src/view.cpp +++ b/src/view.cpp @@ -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()); @@ -28,7 +33,7 @@ View::View(Document & document, Screen & screen, const Rect & bounds, const Colo m_object_renderers[RECT_OUTLINE] = new RectOutlineRenderer(); m_object_renderers[CIRCLE_FILLED] = new CircleFilledRenderer(); m_object_renderers[BEZIER] = new BezierRenderer(); - m_object_renderers[GROUP] = new GroupRenderer(); + m_object_renderers[PATH] = new PathRenderer(); // To add rendering for a new type of object; // 1. Add enum to ObjectType in ipdf.h @@ -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