X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fobjectrenderer.cpp;h=cbceb3aa94f48d3f65ad8ac019962fc8960be1e3;hb=35bc799125eec0d0c839af56fd136c8e85793a56;hp=a6bb77deb0b97b145a43957ec7dcb1a7179a49e8;hpb=6472d20ee58d2ecc0aee8bc1a12a071b2afc8a27;p=ipdf%2Fcode.git diff --git a/src/objectrenderer.cpp b/src/objectrenderer.cpp index a6bb77d..cbceb3a 100644 --- a/src/objectrenderer.cpp +++ b/src/objectrenderer.cpp @@ -24,9 +24,12 @@ ObjectRenderer::ObjectRenderer(const ObjectType & type, const char * vert_glsl_file, const char * frag_glsl_file, const char * geom_glsl_file) : m_type(type), m_shader_program(), m_indexes(), m_buffer_builder(NULL) { - m_shader_program.InitialiseShaders(vert_glsl_file, frag_glsl_file, geom_glsl_file); - m_shader_program.Use(); - glUniform4f(m_shader_program.GetUniformLocation("colour"), 0,0,0,1); //TODO: Allow different colours + if (vert_glsl_file != NULL && frag_glsl_file != NULL && geom_glsl_file != NULL) + { + m_shader_program.InitialiseShaders(vert_glsl_file, frag_glsl_file, geom_glsl_file); + m_shader_program.Use(); + glUniform4f(m_shader_program.GetUniformLocation("colour"), 0,0,0,1); //TODO: Allow different colours + } } /** @@ -219,8 +222,8 @@ ObjectRenderer::PixelPoint ObjectRenderer::CPUPointLocation(const Vec2 & point, { // hack... Rect result = view.TransformToViewCoords(Rect(point.x, point.y,1,1)); - int64_t x = Int64(result.x*target.w); - int64_t y = Int64(result.y*target.h); + int64_t x = Int64(result.x)*target.w; + int64_t y = Int64(result.y)*target.h; return PixelPoint(x,y); } @@ -239,8 +242,8 @@ void BezierRenderer::RenderBezierOnCPU(unsigned i, Objects & objects, const View ObjectRenderer::RenderLineOnCPU(pix_bounds.x+pix_bounds.w, pix_bounds.y, pix_bounds.x+pix_bounds.w, pix_bounds.y+pix_bounds.h, target, Colour(0,255,0,0)); } - unsigned blen = min(max(2U, (unsigned)Int64(Real(target.w)/view.GetBounds().w)), - min((unsigned)(pix_bounds.w+pix_bounds.h)/4 + 1, 100U)); + unsigned blen = target.w;//min(max(2U, (unsigned)Int64(Real(target.w)/view.GetBounds().w)), + //min((unsigned)(pix_bounds.w+pix_bounds.h)/4 + 1, 100U)); // DeCasteljau Divide the Bezier queue divisions; @@ -384,7 +387,7 @@ void PathRenderer::RenderUsingCPU(Objects & objects, const View & view, const CP Rect bounds(CPURenderBounds(objects.bounds[m_indexes[i]], view, target)); PixelBounds pix_bounds(bounds); - const Path & path = objects.paths[objects.data_indices[m_indexes[i]]]; + Path & path = objects.paths[objects.data_indices[m_indexes[i]]]; if (view.ShowingFillPoints()) { @@ -407,10 +410,11 @@ void PathRenderer::RenderUsingCPU(Objects & objects, const View & view, const CP if (pix_bounds.w*pix_bounds.h > 100) { + vector & fill_points = path.FillPoints(objects, view); Debug("High resolution; use fill points %u,%u", pix_bounds.w, pix_bounds.h); - for (unsigned f = 0; f < path.m_fill_points.size(); ++f) + for (unsigned f = 0; f < fill_points.size(); ++f) { - PixelPoint fill_point(CPUPointLocation(path.m_fill_points[f], view, target)); + PixelPoint fill_point(CPUPointLocation(fill_points[f], view, target)); FloodFillOnCPU(fill_point.first, fill_point.second, pix_bounds, target, path.m_fill, path.m_stroke); }