About to break everything with a merge
[ipdf/code.git] / src / view.h
index 6be1ebf..05be33e 100644 (file)
@@ -5,15 +5,21 @@
 #include "document.h"
 #include "framebuffer.h"
 #include "objectrenderer.h"
+#include "path.h"
+#include "transformationtype.h"
 
-#define USE_GPU_TRANSFORM tru
+#define USE_GPU_TRANSFORM fals
 #define USE_GPU_RENDERING true
 #define USE_SHADING !(USE_GPU_RENDERING) && true
 
-#define TRANSFORM_OBJECTS_NOT_VIEW
+
+#include "gmprat.h"
+
 
 namespace IPDF
 {
+       typedef TRect<VReal> VRect;
+       
        class Screen;
        /**
         * The View class manages a rectangular view into the document.
@@ -23,7 +29,7 @@ namespace IPDF
        class View
        {
                public:
-                       View(Document & document, Screen & screen, const Rect & bounds = Rect(0,0,1,1), const Colour & colour = Colour(0.f,0.f,0.f,1.f));
+                       View(Document & document, Screen & screen, const VRect & bounds = VRect(0,0,1,1), const Colour & colour = Colour(0.f,0.f,0.f,1.f));
                        virtual ~View();
 
                        void Render(int width = 0, int height = 0);
@@ -34,7 +40,7 @@ namespace IPDF
                        
                        Rect TransformToViewCoords(const Rect& inp) const;
                        
-                       const Rect& GetBounds() const { return m_bounds; }
+                       const VRect& GetBounds() const { return m_bounds; }
                        
                        
                        const bool UsingGPUTransform() const { return m_use_gpu_transform; } // whether view transform calculated on CPU or GPU
@@ -61,6 +67,8 @@ namespace IPDF
                        void ForceBufferDirty() {m_buffer_dirty = true;}                
                        void ForceRenderDirty() {m_render_dirty = true;}
                        
+                       void QueryGPUBounds(const char * filename, const char * mode="r");
+                       
                        void SetLazyRendering(bool state = true) {m_lazy_rendering = state;}
                        bool UsingLazyRendering() const {return m_lazy_rendering;}
                        
@@ -69,12 +77,16 @@ namespace IPDF
                        void SaveCPUBMP(const char * filename);
                        void SaveGPUBMP(const char * filename);
 
+                       Document & Doc() {return m_document;}
+
                private:
                        struct GPUObjBounds
                        {
                                float x0, y0;
                                float x1, y1;
                        } __attribute__((packed));
+                       
+                       
 
                        void PrepareRender(); // call when m_render_dirty is true
                        void UpdateObjBoundsVBO(unsigned first_obj, unsigned last_obj); // call when m_buffer_dirty is true
@@ -89,7 +101,7 @@ namespace IPDF
                        Document & m_document;
                        Screen & m_screen;
                        FrameBuffer m_cached_display;
-                       Rect m_bounds;
+                       VRect m_bounds;
                        Colour m_colour;
 
                        // Stores the view bounds.
@@ -113,6 +125,8 @@ namespace IPDF
                        bool m_show_fill_bounds;
                        
                        bool m_lazy_rendering;// don't redraw frames unless we need to
+                       
+                       FILE * m_query_gpu_bounds_on_next_frame;
 
 
 #ifndef QUADTREE_DISABLED

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