Use the lea instruction to reduce number of "inc"s
[ipdf/code.git] / src / objectrenderer.h
index 4dd7fe1..6f29add 100644 (file)
@@ -50,7 +50,7 @@ namespace IPDF
                        struct PixelBounds
                        {
                                int64_t x; int64_t y; int64_t w; int64_t h;
-                               PixelBounds(const Rect & bounds) : x(bounds.x), y(bounds.y), w(bounds.w), h(bounds.h) {}
+                               PixelBounds(const Rect & bounds) : x(Double(bounds.x)), y(Double(bounds.y)), w(Double(bounds.w)), h(Double(bounds.h)) {}
                        };
 
                        static Rect CPURenderBounds(const Rect & bounds, const View & view, const CPURenderTarget & target);
@@ -108,14 +108,24 @@ namespace IPDF
        class BezierRenderer : public ObjectRenderer
        {
                public:
-                       BezierRenderer() : ObjectRenderer(BEZIER, "shaders/rect_vert.glsl", "shaders/rect_frag.glsl", "shaders/rect_outline_geom.glsl") {}
+                       BezierRenderer() : ObjectRenderer(BEZIER, "shaders/rect_vert.glsl", "shaders/rect_frag.glsl", "shaders/bezier_texbuf_geom.glsl") {}
                        virtual ~BezierRenderer() {}
-                       virtual void RenderUsingGPU() 
-                       {
-                               Error("Cannot render beziers on the GPU; they will appear as outlined rectangles.");    
-                               ObjectRenderer::RenderUsingGPU();
-                       }
+                       virtual void RenderUsingGPU(); 
                        virtual void RenderUsingCPU(const Objects & objects, const View & view, const CPURenderTarget & target);
+                       void PrepareBezierGPUBuffer(const Objects & objects);
+               private:
+                       GraphicsBuffer m_bezier_coeffs;
+                       GraphicsBuffer m_bezier_ids;
+                       struct GPUBezierCoeffs
+                       {
+                               float x0, y0;
+                               float x1, y1;
+                               float x2, y2;
+                       };
+
+                       GLuint m_bezier_buffer_texture;
+                       GLuint m_bezier_id_buffer_texture;
+
        };
 }
 

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