Change to things to make performance testing easier
[ipdf/code.git] / src / view.cpp
index 52a4c6d..47d28c1 100644 (file)
@@ -160,7 +160,7 @@ void View::Render(int width, int height)
        }
 
        // View bounds have not changed; blit the FrameBuffer as it is
        }
 
        // View bounds have not changed; blit the FrameBuffer as it is
-       if (!m_bounds_dirty)
+       if (!m_bounds_dirty && m_lazy_rendering)
        {
                m_cached_display.UnBind();
                m_cached_display.Blit();
        {
                m_cached_display.UnBind();
                m_cached_display.Blit();
@@ -171,7 +171,7 @@ void View::Render(int width, int height)
        m_cached_display.Clear();
 
 #ifndef QUADTREE_DISABLED
        m_cached_display.Clear();
 
 #ifndef QUADTREE_DISABLED
-       if (m_bounds_dirty)
+       if (m_bounds_dirty || !m_lazy_rendering)
        {
                if ( false &&  (m_bounds.x > 1.0 || m_bounds.x < 0.0 || m_bounds.y > 1.0 || m_bounds.y < 0.0 || m_bounds.w > 1.0 || m_bounds.h > 1.0))
                {
        {
                if ( false &&  (m_bounds.x > 1.0 || m_bounds.x < 0.0 || m_bounds.y > 1.0 || m_bounds.y < 0.0 || m_bounds.w > 1.0 || m_bounds.h > 1.0))
                {
@@ -363,7 +363,7 @@ void View::RenderRange(int width, int height, unsigned first_obj, unsigned last_
        if (m_render_dirty) // document has changed
                PrepareRender();
 
        if (m_render_dirty) // document has changed
                PrepareRender();
 
-       if (m_buffer_dirty || m_bounds_dirty) // object bounds have changed
+       if (m_buffer_dirty || m_bounds_dirty || !m_lazy_rendering) // object bounds have changed
                UpdateObjBoundsVBO(first_obj, last_obj);
 
        if (m_use_gpu_transform)
                UpdateObjBoundsVBO(first_obj, last_obj);
 
        if (m_use_gpu_transform)
@@ -498,3 +498,12 @@ void View::PrepareRender()
        dynamic_cast<BezierRenderer*>(m_object_renderers[BEZIER])->PrepareBezierGPUBuffer(m_document.m_objects);
        m_render_dirty = false;
 }
        dynamic_cast<BezierRenderer*>(m_object_renderers[BEZIER])->PrepareBezierGPUBuffer(m_document.m_objects);
        m_render_dirty = false;
 }
+
+void View::SaveCPUBMP(const char * filename)
+{
+       bool prev = UsingGPURendering();
+       SetGPURendering(false);
+       Render(800, 600);
+       ObjectRenderer::SaveBMP({m_cpu_rendering_pixels, 800, 600}, filename);
+       SetGPURendering(prev);
+}

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