X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fview.h;h=172b5e7727cad2b0273a4f3be60f8ef3171338be;hp=24ae6d92c6789e7c7cc32d63a228447bcc2265f3;hb=c9ce50e17952b0feeec68758444a50302a0aafba;hpb=67fb91aae1fc5315f462d6b5818806f154e9e687 diff --git a/src/view.h b/src/view.h index 24ae6d9..172b5e7 100644 --- a/src/view.h +++ b/src/view.h @@ -3,6 +3,7 @@ #include "ipdf.h" #include "document.h" +#include "graphicsbuffer.h" namespace IPDF { @@ -10,19 +11,36 @@ namespace IPDF { public: View(Document & document, const Rect & bounds = Rect(0,0,1,1), const Colour & colour = Colour(0.f,0.f,0.f,1.f)) - : m_document(document), m_bounds(bounds), m_colour(colour) {} + : m_document(document), m_bounds(bounds), m_colour(colour), m_use_gpu_transform(false), m_bounds_dirty(true) + { + Debug("View Created - Bounds => {%s}", m_bounds.Str().c_str()); + } virtual ~View() {} void Render(); void Translate(Real x, Real y); void ScaleAroundPoint(Real x, Real y, Real scaleAmt); + + Rect TransformToViewCoords(const Rect& inp) const; + + const Rect& GetBounds() const { return m_bounds; } + + const bool UsingGPUTransform() const { return m_use_gpu_transform; } + void ToggleGPUTransform() { m_use_gpu_transform = (!m_use_gpu_transform); m_bounds_dirty = true; } private: + void ReRender(); void DrawGrid(); + bool m_use_gpu_transform; + bool m_bounds_dirty; + GraphicsBuffer m_vertex_buffer; + GraphicsBuffer m_index_buffer; Document & m_document; Rect m_bounds; Colour m_colour; + uint32_t m_rendered_filled; + uint32_t m_rendered_outline; }; }