Review Request: nofill and nostroke support in enhanced path from odf

Lukáš Tvrdý lukast.dev at gmail.com
Fri Jul 8 08:21:57 BST 2011



> On July 8, 2011, 4:05 a.m., Thorsten Zachmann wrote:
> > libs/flake/KoPathShape.h, lines 178-187
> > <http://git.reviewboard.kde.org/r/101873/diff/1/?file=26224#file26224line178>
> >
> >     I think these methods should be enhanced to make it possible to set/unset the fill/storke of any subpath in the shape.

Ok, more general version in KoPathShape liuke setStrokeEnabled(int index, bool enabled), 
and for KoSubpath just setStrokeEnabled(bool enabled). Correct?


> On July 8, 2011, 4:05 a.m., Thorsten Zachmann wrote:
> > libs/flake/KoSubpath.h, lines 47-48
> > <http://git.reviewboard.kde.org/r/101873/diff/1/?file=26227#file26227line47>
> >
> >     This break encapsulation. The properties should be moved to a d pointer. 
> >     Don't use a pointer for points 
> >     
> >     QList<KoPathPoint *> points
> >     is much better here
> >     
> >     To avoid constructs like
> >     
> >     subpath->points->last()
> >     
> >     KoSubpath should provide all methods like QList that are used. 
> >     so provide methods like last(), size(), begin() ...
> >     directly in KoSubpath.
> >     With that the diff will also be much smaller and it is much nicer api.

Ok, I will.

I though it is better to expose that list as I have to duplicate the last(), size(), etc.
It breaks the encapsulation for sure..


> On July 8, 2011, 4:05 a.m., Thorsten Zachmann wrote:
> > libs/flake/KoSubpath.h, line 124
> > <http://git.reviewboard.kde.org/r/101873/diff/1/?file=26227#file26227line124>
> >
> >     The name of the method is not very clear that it attached to the subpath path. How about
> >     appendPath(QPainterPath &path);

I agree with appendPath


> On July 8, 2011, 4:05 a.m., Thorsten Zachmann wrote:
> > libs/flake/KoPathShape.cpp, lines 248-249
> > <http://git.reviewboard.kde.org/r/101873/diff/1/?file=26225#file26225line248>
> >
> >     You should iterate over the subpaths here. Then no construct like the QPair is needed. It avoids copying the stuff which is not necessary. So just do
> >     foreach(KoSubpath * subpath, m_subpaths) {                                                                                                                                               
> >     } 
> >     
> >     As a small optimization you don't need to get the outline of the subpath if both the fill and the stroke of a subpath is disabled which should make it a bit faster.

Ok, QPainterPath is implicitly shared, so no copy occurs til you change the object. I would just move setFillStroke to constraction of the QPainterPath

But I like your advice, I will implement it.


- Lukáš


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/101873/#review4513
-----------------------------------------------------------


On July 8, 2011, 7:02 a.m., Lukáš Tvrdý wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/101873/
> -----------------------------------------------------------
> 
> (Updated July 8, 2011, 7:02 a.m.)
> 
> 
> Review request for Calligra, Jan Hambrecht and Thorsten Zachmann.
> 
> 
> Summary
> -------
> 
> This patch implements S and F commands in draw:enhanced-path. So far there were no support for this.
> 
> The idea is that the path is now rendered per sub-path, because S (no stroke) and F (no fill) can be 
> specified per subpath in the draw:enhanced-path.
> 
> I changed typedef KoSubpath to standalone class as it needs attributes about no fill and no stroke.
> I moved the code that operates only on KoSubpath to that class from KoPathShape.
> Then I render the output per QPainterPath with appropriate attributes (I turn off the pen temporary if no stroke and turn of the brush if no fill)
> 
> 
> This addresses bug 239561.
>     http://bugs.kde.org/show_bug.cgi?id=239561
> 
> 
> Diffs
> -----
> 
>   libs/flake/CMakeLists.txt b9f388f 
>   libs/flake/KoConnectionShape.cpp 210e171 
>   libs/flake/KoPathShape.h 8b54f26 
>   libs/flake/KoPathShape.cpp da6c928 
>   libs/flake/KoPathShape_p.h e1e2843 
>   libs/flake/KoSubpath.h PRE-CREATION 
>   libs/flake/KoSubpath.cpp PRE-CREATION 
>   libs/flake/commands/KoParameterToPathCommand.cpp 177d35d 
>   libs/flake/commands/KoSubpathRemoveCommand.cpp 79894f0 
>   plugins/pathshapes/ellipse/EllipseShape.cpp 0576f5d 
>   plugins/pathshapes/enhancedpath/EnhancedPathCommand.cpp a58d67e 
>   plugins/pathshapes/enhancedpath/EnhancedPathShape.cpp 46d76de 
>   plugins/pathshapes/rectangle/RectangleShape.cpp 9caca45 
>   plugins/pathshapes/star/StarShape.cpp 5fc8562 
> 
> Diff: http://git.reviewboard.kde.org/r/101873/diff
> 
> 
> Testing
> -------
> 
> From bug 239561:
> a) before patch http://wstaw.org/m/2011/07/07/nofill_nostroke_example_before.png
> b) with my patch http://wstaw.org/m/2011/07/07/nofill_nostroke_example_after.png
> 
> I first managed to break several unit tests (TestPointMergeCommand and TestPathShape), 
> but I fixed all the problems and no tests are broken by this patch now.
> 
> 
> Thanks,
> 
> Lukáš
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20110708/cd973142/attachment.htm>


More information about the calligra-devel mailing list