|
|
Home » Community » U++ community news and announcements » Painter refactored/optimized
|
|
|
Re: Painter refactored/optimized [message #50495 is a reply to message #50488] |
Sun, 11 November 2018 19:55 |
Novo
Messages: 1358 Registered: December 2006
|
Ultimate Contributor |
|
|
Thank you!
Could you please fix this:
uppsrc/Painter/BufferPainter.h:325:82: warning: control reaches end of non-void function [-Wreturn-type]
BufferPainter& NoImageCache(bool b = true) { ImageCache(false); }
^
Regards,
Novo
|
|
|
Re: Painter refactored/optimized [message #50497 is a reply to message #50488] |
Mon, 12 November 2018 09:25 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
Hi Mirek,
It is faster indeed, but now some segments of strokes drop out on the right edge of the view if they are partially clipped by the right edge of the view. I think the 'blanking distance' from the right edge is erroneously dependent on the scaling in the transformation being used. (I use the scaling and transformation to implement zooming, rotation and panning of vector maps.)
Another issue is that Filled text drops out in the top edge when the text touches or crosses the edge of the view. The outline (Stroked) text gets drawn until half of it is clipped from the top. (They should obviously both be drawn as long as there are any pixels visible.)
Best regards,
Tom
|
|
|
Re: Painter refactored/optimized [message #50498 is a reply to message #50497] |
Mon, 12 November 2018 09:35 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
Tom1 wrote on Mon, 12 November 2018 09:25Hi Mirek,
It is faster indeed, but now some segments of strokes drop out on the right edge of the view if they are partially clipped by the right edge of the view. I think the 'blanking distance' from the right edge is erroneously dependent on the scaling in the transformation being used. (I use the scaling and transformation to implement zooming, rotation and panning of vector maps.)
Another issue is that Filled text drops out in the top edge when the text touches or crosses the edge of the view. The outline (Stroked) text gets drawn until half of it is clipped from the top. (They should obviously both be drawn as long as there are any pixels visible.)
Best regards,
Tom
Well, thanks for testing, in fact I was hoping you will test this and half expected that there will be issues.
Do you think it would be possible to provide screenshots and/or testcase?
Are this issue apparent both in ST and MT?
Also: In Render.cpp, line 142, there is
if(pathattr.mtx_serial != preclip_mtx_serial) {
try to change that to
if(pathattr.mtx_serial != preclip_mtx_serial || 1) {
Thanks, I will try hard to resolve this as soon as possible... (if you provide testcase, it should be really soon
Mirek
|
|
|
|
|
Re: Painter refactored/optimized [message #50501 is a reply to message #50500] |
Mon, 12 November 2018 09:59 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
As for a testcase, my (commercial) code is complex and figuring out a testcase will take a while. I'll see what I can do. Anyway, please let me know if the above already helped you on the track...
Thanks and best regards,
Tom
|
|
|
|
|
|
|
Re: Painter refactored/optimized [message #50516 is a reply to message #50514] |
Mon, 12 November 2018 12:39 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
Hi,
I cannot confirm any change in PreClip() or PreClipDashed() performance with my usage profile. But it is true that my program tries really hard to not pass Painter anything that would not be visible at least partially. So, this may be the reason I'm not seeing the improvement here.
Importantly, both PreClip() and PreClipDashed() still improve rendering speed of a _very_ long partially visible horizontal dashed line from e.g. 10 seconds to about 0.9 seconds. I guess the only way to dramatically improve this is to clip the line before dashing it.
Is there any difference between the two preclip functions anymore?
Best regards,
Tom
|
|
|
|
|
|
Re: Painter refactored/optimized [message #50530 is a reply to message #50523] |
Tue, 13 November 2018 09:14 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
Hi Mirek,
Here's the test result from this morning.
If I replace the following in my Paint() method:
BufferPainter painter(ib);
With the following:
And add a class variable 'BufferPainter painter;', The rendering will seemingly randomly drop various elements, especially texts, from the result when using MT. It does not matter if I have PreClip()/PreClipDashed() enabled or not. When using ST, everything works fine even with this new Create() mechanism. Also, if I use the traditional 'BufferPainter painter(ib);' on each Paint(), everything works fine with both MT and ST.
Best regards,
Tom
|
|
|
|
Re: Painter refactored/optimized [message #50532 is a reply to message #50531] |
Tue, 13 November 2018 09:35 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
Hi,
OK, I added 'sw.Finish();' in the end. There is still something strange with it.
Please add 'BufferPainter csw;' to PainterExamples App and Change the App::Paint() in main.cpp:
void App::Paint(Draw& w)
{
Size sz = GetSize();
if(ctrl.transparent) {
for(int y = 0; y < sz.cy; y += 32)
for(int x = 0; x < sz.cx; x += 32)
w.DrawRect(x, y, 32, 32, (x ^ y) & 32 ? Color(254, 172, 120) : Color(124, 135, 253));
}
ImageBuffer ib(sz);
{
//BufferPainter sw(ib, ctrl.quality); // Removed
csw.Create(ib, ctrl.quality); // Added
BufferPainter &sw=csw;
if(ctrl.transparent)
sw.Clear(RGBAZero());
else
sw.Clear(White());
sw.Co(ctrl.mt);
DoPaint(sw);
sw.Finish(); // Added
}
w.DrawImage(0, 0, ib);
}
Just scaling causes strange behavior.
Best regards,
Tom
EDIT: My own code worked fine again after adding the 'sw.Finish();'. However, it feels like the transformations do not get reset to default identity transformation in PainterExamples. Maybe this should be part of Create()...?
EDIT2: This appears to solve the issue with PainterExamples. Add the following in the end of BufferPainter::Create():
pathattr.mtx = attr.mtx = Xform2D::Identity();
However, I'm not sure if this breaks something else instead...
[Updated on: Tue, 13 November 2018 10:05] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed Apr 24 12:56:49 CEST 2024
Total time taken to generate the page: 0.01818 seconds
|
|
|