From f16e72c8371e1dd64eb44b65148dcf6b9cfcb8e1 Mon Sep 17 00:00:00 2001
From: David Webster <Dave.Webster@bhmi.com>
Date: Mon, 22 Apr 2002 04:12:22 +0000
Subject: [PATCH] More bitamp and image fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15230 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/os2/bitmap.cpp | 20 ++++++++++++++------
 src/os2/dc.cpp     | 45 +++++++++++++++++++++++++++++++++++++++++----
 src/os2/wx23.def   | 30 +++++++++++++++++++++++++-----
 3 files changed, 80 insertions(+), 15 deletions(-)

diff --git a/src/os2/bitmap.cpp b/src/os2/bitmap.cpp
index 3b86f1c669..6a6be7033f 100644
--- a/src/os2/bitmap.cpp
+++ b/src/os2/bitmap.cpp
@@ -661,12 +661,20 @@ bool wxBitmap::CreateFromImage (
         // Have to do something similar to WIN32's StretchDIBits, use GpiBitBlt
         // in combination with setting the bits into the selected bitmap
         //
-        lScans = ::GpiSetBitmapBits( hPS
-                                    ,0             // Start at the bottom
-                                    ,(LONG)nHeight // One line per scan
-                                    ,(PBYTE)pucBits
-                                    ,&vInfo
-                                   );
+        if ((lScans = ::GpiSetBitmapBits( hPS
+                                         ,0             // Start at the bottom
+                                         ,(LONG)nHeight // One line per scan
+                                         ,(PBYTE)pucBits
+                                         ,&vInfo
+                                       )) == GPI_ALTERROR)
+        {
+            ERRORID                 vError;
+            wxString                sError;
+
+            vError = ::WinGetLastError(vHabmain);
+            sError = wxPMErrorToStr(vError);
+        }
+
         hPSScreen = ::GpiCreatePS( vHabmain
                                   ,hDCScreen
                                   ,&vSize
diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp
index 0d89f00d9f..9a58657da1 100644
--- a/src/os2/dc.cpp
+++ b/src/os2/dc.cpp
@@ -1043,12 +1043,49 @@ void wxDC::DoDrawRectangle(
         //
         // Debug testing:
         //
-        for (int i = 0; i < vHeight; i++)
+        if (m_vSelectedBitmap != wxNullBitmap)
         {
-            for (int j = 0; j < vHeight; j++)
+            BITMAPINFOHEADER2           vHeader;
+            BITMAPINFO2                 vInfo;
+
+            vHeader.cbFix = 16L;
+            if (::GpiQueryBitmapInfoHeader(m_hPS, &vHeader))
             {
-                vPoint[0].x = j; vPoint[0].y = i;
-                lColor = ::GpiQueryPel(m_hPS, &vPoint[0]);
+                int                     nBytesPerLine = vHeader.cBitCount/8;
+                unsigned char*          pucData = NULL;
+                unsigned char*          pucBits;
+                LONG                    lScans = 0L;
+
+                vInfo.cbFix = 16;
+                vInfo.cx              = vHeader.cx;
+                vInfo.cy              = vHeader.cy;
+                vInfo.cPlanes         = vHeader.cPlanes;
+                vInfo.cBitCount       = vHeader.cBitCount;
+                pucData = (unsigned char*)malloc(nBytesPerLine * vHeight);
+                pucBits = pucData;
+                for (int i = 0; i < vHeight; i++)
+                {
+                    if (i <= m_vSelectedBitmap.GetHeight())
+                    {
+                        for (int j = 0; j < vWidth; j++)
+                        {
+                            if (j <= m_vSelectedBitmap.GetWidth())
+                            {
+                                vPoint[0].x = j; vPoint[0].y = i;
+                                lColor = ::GpiQueryPel(m_hPS, &vPoint[0]);
+                                *(pucBits++) = lColor >> 24;
+                                *(pucBits++) = lColor >> 16;
+                                *(pucBits++) = lColor >> 8;
+                            }
+                        }
+                    }
+                }
+                lScans = ::GpiSetBitmapBits( m_hPS
+                                            ,0             // Start at the bottom
+                                            ,(LONG)vHeight // One line per scan
+                                            ,(PBYTE)pucData
+                                            ,&vInfo
+                                           );
             }
         }
     }
diff --git a/src/os2/wx23.def b/src/os2/wx23.def
index 4fdc09a93d..e183562671 100644
--- a/src/os2/wx23.def
+++ b/src/os2/wx23.def
@@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
 CODE LOADONCALL
 
 EXPORTS
-;From library:  H:\DEV\WX2\WXWINDOWS\lib\wx.lib
+;From library:  F:\DEV\WX2\WXWINDOWS\LIB\wx.lib
   ;From object file:  dummy.cpp
     ;PUBDEFs (Symbols available from object file):
       wxDummyChar
@@ -1925,7 +1925,7 @@ EXPORTS
       wxEVT_NC_LEFT_DCLICK
       wxEVT_INIT_DIALOG
       wxEVT_COMMAND_SET_FOCUS
-  ;From object file:  H:\DEV\WX2\WXWINDOWS\src\common\extended.c
+  ;From object file:  F:\DEV\WX2\WXWINDOWS\src\common\extended.c
     ;PUBDEFs (Symbols available from object file):
       ConvertToIeeeExtended
       ConvertFromIeeeExtended
@@ -5003,6 +5003,8 @@ EXPORTS
       Fit__7wxSizerFP8wxWindow
       ;wxSizer::GetMinWindowSize(wxWindow*)
       GetMinWindowSize__7wxSizerFP8wxWindow
+      ;wxSizer::FitInside(wxWindow*)
+      FitInside__7wxSizerFP8wxWindow
       ;wxSizer::Prepend(wxWindow*,int,int,int,wxObject*)
       Prepend__7wxSizerFP8wxWindowiN22P8wxObject
       __vft15wxFlexGridSizer8wxObject
@@ -5089,6 +5091,10 @@ EXPORTS
       DoSetItemMinSize__7wxSizerFP7wxSizeriT2
       ;wxSizerItem::DeleteWindows()
       DeleteWindows__11wxSizerItemFv
+      ;wxSizer::GetMinClientSize(wxWindow*)
+      GetMinClientSize__7wxSizerFP8wxWindow
+      ;wxSizer::GetMaxClientSize(wxWindow*)
+      GetMaxClientSize__7wxSizerFP8wxWindow
       ;wxSizerItem::wxSizerItem(wxWindow*,int,int,int,wxObject*)
       __ct__11wxSizerItemFP8wxWindowiN22P8wxObject
       __vft16wxStaticBoxSizer8wxObject
@@ -5113,8 +5119,12 @@ EXPORTS
       SetItemBounds__11wxGridSizerFP11wxSizerItemiN32
       ;wxGridSizer::CalcMin()
       CalcMin__11wxGridSizerFv
+      ;wxSizer::VirtualFitSize(wxWindow*)
+      VirtualFitSize__7wxSizerFP8wxWindow
       ;wxNotebookSizer::wxNotebookSizer(wxNotebook*)
       __ct__15wxNotebookSizerFP10wxNotebook
+      ;wxSizer::SetVirtualSizeHints(wxWindow*)
+      SetVirtualSizeHints__7wxSizerFP8wxWindow
   ;From object file:  ..\common\socket.cpp
     ;PUBDEFs (Symbols available from object file):
       ;wxSocketBase::SetTimeout(long)
@@ -6027,7 +6037,7 @@ EXPORTS
       Read32__17wxTextInputStreamFv
       ;wxTextInputStream::SkipIfEndOfLine(char)
       SkipIfEndOfLine__17wxTextInputStreamFc
-  ;From object file:  H:\DEV\WX2\WXWINDOWS\src\common\unzip.c
+  ;From object file:  F:\DEV\WX2\WXWINDOWS\src\common\unzip.c
     ;PUBDEFs (Symbols available from object file):
       unzReadCurrentFile
       unzGetCurrentFileInfo
@@ -6876,6 +6886,8 @@ EXPORTS
       ConvertPixelsToDialog__12wxWindowBaseFRC7wxPoint
       ;wxWindowBase::SetSizer(wxSizer*,unsigned long)
       SetSizer__12wxWindowBaseFP7wxSizerUl
+      ;wxWindowBase::SetSizerAndFit(wxSizer*,unsigned long)
+      SetSizerAndFit__12wxWindowBaseFP7wxSizerUl
       ;wxWindowBase::FindWindow(long)
       FindWindow__12wxWindowBaseFl
       ;wxWindowBase::IsExposed(int,int) const
@@ -6885,6 +6897,8 @@ EXPORTS
       ;wxWindowBase::sm_classwxWindowBase
       sm_classwxWindowBase__12wxWindowBase
       __vft16wxWindowListNode10wxNodeBase
+      ;wxWindowBase::SetVirtualSizeHints(int,int,int,int)
+      SetVirtualSizeHints__12wxWindowBaseFiN31
       ;wxWindowBase::SetSizeHints(int,int,int,int,int,int)
       SetSizeHints__12wxWindowBaseFiN51
       ;wxWindowBase::MoveConstraint(int,int)
@@ -6921,6 +6935,8 @@ EXPORTS
       SetSizeConstraint__12wxWindowBaseFiN31
       ;wxWindowBase::GetClientSizeConstraint(int*,int*) const
       GetClientSizeConstraint__12wxWindowBaseCFPiT1
+      ;wxWindowBase::DoSetVirtualSize(int,int)
+      DoSetVirtualSize__12wxWindowBaseFiT1
       ;wxWindowBase::DoHitTest(int,int) const
       DoHitTest__12wxWindowBaseCFiT1
       ;wxWindowBase::DoGetBestSize() const
@@ -6961,6 +6977,8 @@ EXPORTS
       GetBorder__12wxWindowBaseCFv
       ;wxWindowBase::Fit()
       Fit__12wxWindowBaseFv
+      ;wxWindowBase::DoGetVirtualSize() const
+      DoGetVirtualSize__12wxWindowBaseCFv
       ;wxWindowBase::DeleteRelatedConstraints()
       DeleteRelatedConstraints__12wxWindowBaseFv
       ;wxWindowBase::SetHelpText(const wxString&)
@@ -9858,6 +9876,8 @@ EXPORTS
       GetScrollPixelsPerUnit__14wxScrollHelperCFPiT1
       ;wxScrollHelper::Scroll(int,int)
       Scroll__14wxScrollHelperFiT1
+      ;wxGenericScrolledWindow::DoSetVirtualSize(int,int)
+      DoSetVirtualSize__23wxGenericScrolledWindowFiT1
       ;wxScrollHelper::~wxScrollHelper()
       __dt__14wxScrollHelperFv
       ;wxConstructorForwxGenericScrolledWindow()
@@ -9873,8 +9893,8 @@ EXPORTS
       HandleOnSize__14wxScrollHelperFR11wxSizeEvent
       ;wxScrollHelper::HandleOnPaint(wxPaintEvent&)
       HandleOnPaint__14wxScrollHelperFR12wxPaintEvent
-      ;wxScrollHelper::GetVirtualSize(int*,int*) const
-      GetVirtualSize__14wxScrollHelperCFPiT1
+      ;wxScrollHelper::SetScrollRate(int,int)
+      SetScrollRate__14wxScrollHelperFiT1
       ;wxScrollHelper::GetTargetWindow() const
       GetTargetWindow__14wxScrollHelperCFv
       __vft14wxScrollHelper
-- 
2.50.0

