Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » How to efficiently update a large Image?
Re: How to efficiently update a large Image? [message #22950 is a reply to message #22944] |
Wed, 02 September 2009 11:37   |
 |
mirek
Messages: 14265 Registered: November 2005
|
Ultimate Member |
|
|
Tom1 wrote on Tue, 01 September 2009 02:24 | Mirek,
Here's the testcase. Only after running your test code I realized the problem was related to having a control inside the main window. So, I guess this has something to do with the control offset within the parent control.
#include <CtrlLib/CtrlLib.h>
#include <Painter/Painter.h>
using namespace Upp;
class PainterCtrl : public Ctrl {
ImageBuffer ib;
public:
virtual void Paint(Painter &pntr,Size &sz)=0;
virtual void Layout(){
Size sz=GetSize();
ib.Clear();
ib.Create(sz);
BufferPainter pntr(ib);
Paint(pntr,sz);
}
virtual void Paint(Draw &draw) {
Rect paintrect=draw.GetPaintRect();
Point p = paintrect.TopLeft();
if(p.x < ib.GetSize().cx && p.y < ib.GetSize().cy)
SetSurface(draw, paintrect, ib, ib.GetSize(), p);
}
};
struct ExampleCtrl : PainterCtrl {
virtual void Paint(Painter &pntr,Size &sz){
pntr.Move(0,0).Line(sz.cx,0).Line(sz.cx,sz.cy).Line(0,sz.cy).Close().Fill(White()).Stroke(5,Black());
pntr.Move(0,0).Line(sz.cx,sz.cy).Stroke(5,Black());
}
};
class ExampleTopWindow: public TopWindow{
public:
ExampleCtrl ec;
virtual void Layout(){
ec.SetRect(20,0,GetSize().cx-20,GetSize().cy);
}
ExampleTopWindow(){
Add(ec);
}
};
GUI_APP_MAIN
{
ExampleTopWindow win;
win.Sizeable();
win.Open();
win.Run();
}
(This example also sort of demonstrates how to boost application performance when drawing complex items with e.g. Painter and then not having to regenerate them each time the window gets an OS initiated paint request.)
// Tom
|
Thanks for testcase. You are right, the cause was that offset of child widget was not taken into account.
Hopefully fixed now.
Mirek
|
|
|
 |
|
How to efficiently update a large Image?
By: Tom1 on Mon, 27 July 2009 12:24
|
 |
|
Re: How to efficiently update a large Image?
By: mirek on Mon, 27 July 2009 13:39
|
 |
|
Re: How to efficiently update a large Image?
By: Tom1 on Mon, 27 July 2009 16:47
|
 |
|
Re: How to efficiently update a large Image?
By: mirek on Mon, 27 July 2009 17:15
|
 |
|
Re: How to efficiently update a large Image?
By: mirek on Mon, 27 July 2009 17:18
|
 |
|
Re: How to efficiently update a large Image?
By: Tom1 on Tue, 28 July 2009 11:16
|
 |
|
Re: How to efficiently update a large Image?
By: mirek on Tue, 28 July 2009 16:29
|
 |
|
Re: How to efficiently update a large Image?
By: mirek on Tue, 28 July 2009 16:32
|
 |
|
Re: How to efficiently update a large Image?
By: Tom1 on Wed, 29 July 2009 09:18
|
 |
|
Re: How to efficiently update a large Image?
By: mirek on Sun, 02 August 2009 15:11
|
 |
|
Re: How to efficiently update a large Image?
By: Tom1 on Wed, 26 August 2009 07:57
|
 |
|
Re: How to efficiently update a large Image?
By: mirek on Fri, 28 August 2009 00:24
|
 |
|
Re: How to efficiently update a large Image?
By: Tom1 on Tue, 01 September 2009 08:24
|
 |
|
Re: How to efficiently update a large Image?
By: mirek on Wed, 02 September 2009 11:37
|
 |
|
Re: How to efficiently update a large Image?
By: Tom1 on Thu, 03 September 2009 11:45
|
Goto Forum:
Current Time: Sun Jul 06 06:01:49 CEST 2025
Total time taken to generate the page: 0.03811 seconds
|