[Mono-dev] libgdiplus drawing performance
oken
okenjian at 163.com
Sun Sep 26 04:33:11 EDT 2010
#define VS(fun) \
do{\
GpStatus status = fun; \
if (Ok != status) \
{\
assert(!"invalid status");\
return status;\
}\
}while(0)
int width = 1000;
int height = 1000;
GpStatus status = Ok;
BYTE *scan0 = NULL;
VS(GdipCreateBitmapFromScan0(width, height, width * 4,
PixelFormat32bppARGB, scan0, &m_bmp));
VS(GdipGetImageGraphicsContext(m_bmp, &m_pGraphics));
VS(GdipGraphicsClear(m_pGraphics, 0xffffffff));
VS(GdipCreatePen1(0xa0f0a000, (REAL)2.0, UnitPixel, &m_pPen));
VS(GdipCreateSolidFill(0xa00000ff, &m_pSolidBrush));
VS(GdipSetPenColor(m_pPen, 0xff0000ff));
for (int i = 0; i < nTimes ; i++)
{
VS(GdipDrawLine(m_pGraphics, m_pPen, 100, 100, 500, 500));
}
I also find that libgdiplus's performance is slow.
In my example, drawing 1000 lines takes me 5,000ms!
I find it that most of the time is consumed by "cairo_stroke" in
stroke_graphics_with_pen (GpGraphics *graphics, GpPen *pen).
I am calling libgdiplus's API under wine!
How to improve the performance?
--
View this message in context: http://mono.1490590.n4.nabble.com/libgdiplus-drawing-performance-tp1537623p2714158.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list