GDI + Memory Leak Issue

  • Thread starter Thread starter Rangaraj.P
  • Start date Start date
R

Rangaraj.P

Guest
Hi,

below codes are creates memory leak please give some input to solve.

Code:

PointF stpoint;
PointF endpoint;
graphics->SetSmoothingMode(Gdiplus::SmoothingModeHighSpeed);
//Pen pen(Color(255,180,180,0),3);
CRect rect;
rect.right =1600;
rect.bottom =1006;

Rect rc(rect.left,rect.top,rect.right,rect.bottom);
// Gdiplus::Bitmap bitmap(rect.right,rect.bottom);

Gdiplus::Bitmap *bitmap = new Gdiplus::Bitmap(rect.right, rect.bottom, PixelFormat32bppARGB);

Graphics* graph = Graphics::FromImage(bitmap);

int size = static_cast<int> (startline.GetSize());
for(int i= 0;i<size;i++)
{
int x1 = static_cast<int> (startline.GetAt(i).x());
int y1 = static_cast<int>(startline.GetAt(i).y());

int x2 = static_cast<int> (endline.GetAt(i).x());
int y2 = static_cast<int> (endline.GetAt(i).y());
graph->DrawLine(&pen_,x1,y1,x2,y2);
}

graphics->DrawImage(bitmap,rect.left,rect.top,rect.right,rect.bottom);

delete bitmap;
bitmap = NULL;


Rangaraj Palanisamy

Continue reading...
 
Back
Top