X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e0d314713977c17937a63a2de34f835ce239aa51..c3b501e187fdb318911177e5ad90fea9e163a112:/src/os2/dc.cpp diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index 56f4dacc08..e215660198 100644 --- a/src/os2/dc.cpp +++ b/src/os2/dc.cpp @@ -221,7 +221,7 @@ wxDCCacheEntry* wxDC::FindBitmapInCache( vBmpHdr.cx = nWidth; vBmpHdr.cy = nHeight; vBmpHdr.cPlanes = 1; - vBmpHdr.cBitCount = nDepth; + vBmpHdr.cBitCount = (USHORT)nDepth; pEntry->m_hBitmap = (WXHBITMAP) ::GpiCreateBitmap( hPS ,&vBmpHdr @@ -244,7 +244,7 @@ wxDCCacheEntry* wxDC::FindBitmapInCache( vBmpHdr.cx = nWidth; vBmpHdr.cy = nHeight; vBmpHdr.cPlanes = 1; - vBmpHdr.cBitCount = nDepth; + vBmpHdr.cBitCount = (USHORT)nDepth; WXHBITMAP hBitmap = (WXHBITMAP) ::GpiCreateBitmap( hPS ,&vBmpHdr @@ -578,7 +578,7 @@ bool wxDC::DoFloodFill( if ((lHits = ::GpiFloodFill(m_hPS, lOptions, lColor)) != GPI_ERROR) bSuccess = true; - return true; + return bSuccess; } // end of wxDC::DoFloodFill bool wxDC::DoGetPixel( @@ -592,17 +592,7 @@ bool wxDC::DoGetPixel( vPoint.x = vX; vPoint.y = OS2Y(vY,0); - lColor = ::GpiSetPel(m_hPS, &vPoint); - - // - // Get the color of the pen - // - LONG lPencolor = 0x00ffffff; - - if (m_pen.Ok()) - { - lPencolor = m_pen.GetColour().GetPixel(); - } + lColor = ::GpiQueryPel(m_hPS, &vPoint); // // return the color of the pixel @@ -612,7 +602,7 @@ bool wxDC::DoGetPixel( ,GetGValue(lColor) ,GetBValue(lColor) ); - return(lColor == lPencolor); + return true; } // end of wxDC::DoGetPixel void wxDC::DoCrossHair( @@ -784,7 +774,11 @@ void wxDC::DoDrawArc( vPtlArc[0].y = vYm; vPtlArc[1].x = vX2; vPtlArc[1].y = vY2; +#if !(defined(__WATCOMC__) && __WATCOMC__ < 1240 ) +// Open Watcom 1.3 had incomplete headers +// that's reported and should be fixed for OW 1.4 ::GpiPointArc(m_hPS, vPtlArc); // Draws the arc +#endif CalcBoundingBox( (wxCoord)(vXc - dRadius) ,(wxCoord)(vYc - dRadius) ); @@ -1301,10 +1295,12 @@ void wxDC::DoDrawBitmap( , bool bUseMask ) { +#if wxUSE_PRINTING_ARCHITECTURE if (!IsKindOf(CLASSINFO(wxPrinterDC))) +#endif { HBITMAP hBitmap = (HBITMAP)rBmp.GetHBITMAP(); - HBITMAP hBitmapOld; + HBITMAP hBitmapOld = NULLHANDLE; POINTL vPoint[4]; vY = OS2Y(vY,rBmp.GetHeight()); @@ -1397,7 +1393,7 @@ void wxDC::DoDrawBitmap( lColor = m_textBackgroundColour.GetPixel(); // - // Bitmap must be ina double-word alligned address so we may + // Bitmap must be in a double-word aligned address so we may // have some padding to worry about // if (nLineBoundary > 0) @@ -1881,9 +1877,7 @@ void wxDC::DoDrawRotatedText( // set GDI objects // --------------------------------------------------------------------------- -void wxDC::DoSelectPalette( - bool bRealize -) +void wxDC::DoSelectPalette( bool WXUNUSED(bRealize) ) { // // Set the old object temporarily, in case the assignment deletes an object @@ -2176,9 +2170,7 @@ void wxDC::SetRop( ::GpiSetMix((HPS)hDC, lCRop); } // end of wxDC::SetRop -bool wxDC::StartDoc( - const wxString& rsMessage -) +bool wxDC::StartDoc( const wxString& WXUNUSED(rsMessage) ) { // We might be previewing, so return true to let it continue. return true; @@ -2238,24 +2230,22 @@ void wxDC::DoGetTextExtent( int l; FONTMETRICS vFM; // metrics structure BOOL bRc; - char* pStr; ERRORID vErrorCode; // last error id code wxFont* pFontToUse = (wxFont*)pTheFont; - char zMsg[128]; // DEBUG + wxChar zMsg[128]; // DEBUG wxString sError; if (!pFontToUse) pFontToUse = (wxFont*)&m_font; l = rsString.length(); - pStr = (PCH) rsString.c_str(); // // In world coordinates. // bRc = ::GpiQueryTextBox( m_hPS ,l - ,pStr + ,(PCH)rsString.c_str() ,TXTBOX_COUNT // return maximum information ,avPoint // array of coordinates points ); @@ -2264,8 +2254,8 @@ void wxDC::DoGetTextExtent( vErrorCode = ::WinGetLastError(wxGetInstance()); sError = wxPMErrorToStr(vErrorCode); // DEBUG - sprintf(zMsg, "GpiQueryTextBox for %s: failed with Error: %lx - %s", pStr, vErrorCode, sError.c_str()); - (void)wxMessageBox( "wxWidgets Menu sample" + wxSprintf(zMsg, _T("GpiQueryTextBox for %s: failed with Error: %lx - %s"), rsString.c_str(), vErrorCode, sError.c_str()); + (void)wxMessageBox( _T("wxWidgets Menu sample") ,zMsg ,wxICON_INFORMATION ); @@ -2375,10 +2365,8 @@ void wxDC::SetMapMode( // ???? }; // end of wxDC::SetMapMode -void wxDC::SetUserScale( - double dX -, double dY -) +void wxDC::SetUserScale( double dX, + double dY ) { m_userScaleX = dX; m_userScaleY = dY; @@ -2386,10 +2374,8 @@ void wxDC::SetUserScale( SetMapMode(m_mappingMode); } // end of wxDC::SetUserScale -void wxDC::SetAxisOrientation( - bool bXLeftRight -, bool bYBottomUp -) +void wxDC::SetAxisOrientation( bool bXLeftRight, + bool bYBottomUp ) { m_signX = bXLeftRight ? 1 : -1; m_signY = bYBottomUp ? -1 : 1; @@ -2500,19 +2486,17 @@ wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const // bit blit // --------------------------------------------------------------------------- -bool wxDC::DoBlit( - wxCoord vXdest -, wxCoord vYdest -, wxCoord vWidth -, wxCoord vHeight -, wxDC* pSource -, wxCoord vXsrc -, wxCoord vYsrc -, int nRop -, bool bUseMask -, wxCoord vXsrcMask -, wxCoord vYsrcMask -) +bool wxDC::DoBlit( wxCoord vXdest, + wxCoord vYdest, + wxCoord vWidth, + wxCoord vHeight, + wxDC* pSource, + wxCoord vXsrc, + wxCoord vYsrc, + int nRop, + bool bUseMask, + wxCoord WXUNUSED(vXsrcMask), + wxCoord WXUNUSED(vYsrcMask) ) { wxMask* pMask = NULL; CHARBUNDLE vCbnd; @@ -2606,7 +2590,6 @@ bool wxDC::DoBlit( vBmpHdr.cBitCount = 24; #if wxUSE_DC_CACHEING - if (true) { // // create a temp buffer bitmap and DCs to access it and the mask @@ -2625,9 +2608,9 @@ bool wxDC::DoBlit( hPSMask = pDCCacheEntry1->m_hPS; hDCBuffer = (HDC)pDCCacheEntry2->m_hPS; hBufBitmap = (HBITMAP)pBitmapCacheEntry->m_hBitmap; + wxUnusedVar(hDCMask); } - else -#endif +#else { hDCMask = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDOP, NULLHANDLE); hDCBuffer = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDOP, NULLHANDLE); @@ -2635,6 +2618,7 @@ bool wxDC::DoBlit( hPSBuffer = ::GpiCreatePS(vHabmain, hDCBuffer, &vSize, PU_PELS | GPIT_MICRO | GPIA_ASSOC); hBufBitmap = ::GpiCreateBitmap(GetHPS(), &vBmpHdr, 0L, NULL, NULL); } +#endif POINTL aPoint1[4] = { {0, 0} ,{vWidth, vHeight} @@ -2812,10 +2796,8 @@ void wxDC::DoGetSize( } }; // end of wxDC::DoGetSize( -void wxDC::DoGetSizeMM( - int* pnWidth -, int* pnHeight -) const +void wxDC::DoGetSizeMM( int* pnWidth, + int* pnHeight ) const { LONG lArray[CAPS_VERTICAL_RESOLUTION]; @@ -2825,25 +2807,27 @@ void wxDC::DoGetSizeMM( ,lArray )) { - int nWidth; - int nHeight; - int nHorzRes; - int nVertRes; + if(pnWidth) + { + int nWidth = lArray[CAPS_WIDTH]; + int nHorzRes = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter + *pnWidth = (nHorzRes/1000) * nWidth; + } - nWidth = lArray[CAPS_WIDTH]; - nHeight = lArray[CAPS_HEIGHT]; - nHorzRes = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter - nVertRes = lArray[CAPS_VERTICAL_RESOLUTION]; // returns pel/meter - nWidth = (nHorzRes/1000) * nWidth; - nHeight = (nVertRes/1000) * nHeight; + if(pnHeight) + { + int nHeight = lArray[CAPS_HEIGHT]; + int nVertRes = lArray[CAPS_VERTICAL_RESOLUTION]; // returns pel/meter + *pnHeight = (nVertRes/1000) * nHeight; + } } }; // end of wxDC::DoGetSizeMM wxSize wxDC::GetPPI() const { LONG lArray[CAPS_VERTICAL_RESOLUTION]; - int nWidth; - int nHeight; + int nWidth = 0; + int nHeight = 0; if(::DevQueryCaps( m_hDC ,CAPS_FAMILY @@ -2863,7 +2847,8 @@ wxSize wxDC::GetPPI() const nWidth = (int)((nHorzRes/39.3) * nPelWidth); nHeight = (int)((nVertRes/39.3) * nPelHeight); } - return (wxSize(nWidth,nHeight)); + wxSize ppisize(nWidth, nHeight); + return ppisize; } // end of wxDC::GetPPI void wxDC::SetLogicalScale( @@ -2874,6 +2859,3 @@ void wxDC::SetLogicalScale( m_logicalScaleX = dX; m_logicalScaleY = dY; }; // end of wxDC::SetLogicalScale - - -