From bbc1265c400d44962621a6b2c7c36ccff097207c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 22 Mar 2003 19:01:27 +0000 Subject: [PATCH] create the DIBs in correct (and not down up) line order git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19709 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/dib.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index f5abc79777..9c2ad41950 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -69,7 +69,14 @@ bool wxDIB::Create(int width, int height, int depth) info->bmiHeader.biSize = infosize; info->bmiHeader.biWidth = width; - info->bmiHeader.biHeight = -height; + + // we use positive height here which corresponds to a DIB with normal, i.e. + // bottom to top, order -- normally using negative height (which means + // reversed for MS and hence natural for all the normal people top to + // bottom line scan order) could be used to avoid the need for the image + // reversal in Create(image) but this doesn't work under NT, only Win9x! + info->bmiHeader.biHeight = height; + info->bmiHeader.biPlanes = 1; info->bmiHeader.biBitCount = depth; info->bmiHeader.biCompression = BI_RGB; @@ -156,8 +163,8 @@ bool wxDIB::Create(const wxImage& image) if ( !Create(w, h, bpp) ) return false; - // DIBs are stored in bottom to top order so we need to copy bits line by - // line and starting from the end + // DIBs are stored in bottom to top order (see also the comment above in + // Create()) so we need to copy bits line by line and starting from the end const int srcBytesPerLine = w * 3; const int dstBytesPerLine = GetLineSize(w, bpp); const unsigned char *src = image.GetData() + ((h - 1) * srcBytesPerLine); -- 2.47.2