Go nuts with Qt
[ipdf/code.git] / src / view.h
index 5bfced8..fe93e6c 100644 (file)
@@ -27,26 +27,36 @@ namespace IPDF
                        
                        void Translate(Real x, Real y);
                        void ScaleAroundPoint(Real x, Real y, Real scale_amount);
+                       void SetBounds(const Rect & new_bounds);
                        
                        Rect TransformToViewCoords(const Rect& inp) const;
                        
                        const Rect& GetBounds() const { return m_bounds; }
                        
+                       
                        const bool UsingGPUTransform() const { return m_use_gpu_transform; } // whether view transform calculated on CPU or GPU
                        const bool UsingGPURendering() const { return m_use_gpu_rendering; } // whether GPU shaders are used or CPU rendering
                        void ToggleGPUTransform() { m_use_gpu_transform = (!m_use_gpu_transform); m_bounds_dirty = true; m_buffer_dirty = true; }
                        void ToggleGPURendering() { m_use_gpu_rendering = (!m_use_gpu_rendering); m_bounds_dirty = true; m_buffer_dirty = true; }
+                       
+                       void SetGPURendering(bool state) {m_use_gpu_rendering = state; m_bounds_dirty = true; m_buffer_dirty = true;}
+
+
+                       void ForceBoundsDirty() {m_bounds_dirty = true;}                
+                       void ForceBufferDirty() {m_buffer_dirty = true;}                
+                       void ForceRenderDirty() {m_render_dirty = true;}
 
-               
                private:
                        struct GPUObjBounds
                        {
                                float x0, y0;
                                float x1, y1;
-                       };
+                       } __attribute__((packed));
 
                        void PrepareRender(); // call when m_render_dirty is true
-                       void UpdateObjBoundsVBO(); // call when m_buffer_dirty is true
+                       void UpdateObjBoundsVBO(unsigned first_obj, unsigned last_obj); // call when m_buffer_dirty is true
+
+                       void RenderRange(int width, int height, unsigned first_obj, unsigned last_obj);
 
                        bool m_use_gpu_transform;
                        bool m_use_gpu_rendering;
@@ -68,6 +78,13 @@ namespace IPDF
                        // Trust me it will be easier to generalise things this way. Even though there are pointers.
                        std::vector<ObjectRenderer*> m_object_renderers; 
                        uint8_t * m_cpu_rendering_pixels; // pixels to be used for CPU rendering
+
+#ifndef QUADTREE_DISABLED
+                       QuadTreeIndex m_current_quadtree_node;  // The highest node we will traverse.
+                       int m_quadtree_max_depth;               // The maximum quadtree depth.
+                       void RenderQuadtreeNode(int width, int height, QuadTreeIndex node, int remaining_depth);
+
+#endif
        };
 }
 

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