Horrible debug font bufferification. (Sorry)
[ipdf/code.git] / src / view.h
1 #ifndef _VIEW_H
2 #define _VIEW_H
3
4 #include "ipdf.h"
5 #include "document.h"
6 #include "graphicsbuffer.h"
7 #include "framebuffer.h"
8
9 namespace IPDF
10 {
11         class View
12         {
13                 public:
14                         View(Document & document, const Rect & bounds = Rect(0,0,1,1), const Colour & colour = Colour(0.f,0.f,0.f,1.f)) 
15                                 : m_document(document), m_bounds(bounds), m_colour(colour), m_use_gpu_transform(false), m_bounds_dirty(true), m_buffer_dirty(true)
16                         {
17                                 Debug("View Created - Bounds => {%s}", m_bounds.Str().c_str());
18                         }
19                         virtual ~View() {}
20
21                         void Render(int width = 0, int height = 0);
22                         
23                         void Translate(Real x, Real y);
24                         void ScaleAroundPoint(Real x, Real y, Real scaleAmt);
25                         
26                         Rect TransformToViewCoords(const Rect& inp) const;
27                         
28                         const Rect& GetBounds() const { return m_bounds; }
29                         
30                         const bool UsingGPUTransform() const { return m_use_gpu_transform; }
31                         void ToggleGPUTransform() { m_use_gpu_transform = (!m_use_gpu_transform); m_bounds_dirty = true; m_buffer_dirty = true; }
32                 
33                 private:
34                         void ReRender();
35                         void DrawGrid();
36                         bool m_use_gpu_transform;
37                         bool m_bounds_dirty;
38                         bool m_buffer_dirty;
39                         GraphicsBuffer m_vertex_buffer;
40                         GraphicsBuffer m_index_buffer;
41                         FrameBuffer m_cached_display;
42                         Document & m_document;
43                         Rect m_bounds;
44                         Colour m_colour;
45                         uint32_t m_rendered_filled;
46                         uint32_t m_rendered_outline;
47         };
48 }
49
50 #endif //_VIEW_H

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