Applied patch #1875242 - fixing more bugs related to using OS/2's DevQueryCaps
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51288 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -501,16 +501,16 @@ bool wxPMDCImpl::CanGetTextExtent() const
|
|||||||
|
|
||||||
int wxPMDCImpl::GetDepth() const
|
int wxPMDCImpl::GetDepth() const
|
||||||
{
|
{
|
||||||
LONG lArray[CAPS_COLOR_BITCOUNT];
|
LONG lCapsColorBitcount;
|
||||||
int nBitsPerPixel = 0;
|
int nBitsPerPixel = 0;
|
||||||
|
|
||||||
if(::DevQueryCaps( GetHDC()
|
if(::DevQueryCaps( GetHDC()
|
||||||
,CAPS_FAMILY
|
|
||||||
,CAPS_COLOR_BITCOUNT
|
,CAPS_COLOR_BITCOUNT
|
||||||
,lArray
|
,1L
|
||||||
|
,&lCapsColorBitcount
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
nBitsPerPixel = (int)lArray[CAPS_COLOR_BITCOUNT];
|
nBitsPerPixel = (int)lCapsColorBitcount;
|
||||||
}
|
}
|
||||||
return nBitsPerPixel;
|
return nBitsPerPixel;
|
||||||
} // end of wxPMDCImpl::GetDepth
|
} // end of wxPMDCImpl::GetDepth
|
||||||
@@ -2652,57 +2652,61 @@ bool wxPMDCImpl::DoBlit( wxCoord vXdest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxPMDCImpl::DoGetSize( int* pnWidth,
|
void wxPMDCImpl::DoGetSize( int* pnWidth,
|
||||||
int* pnHeight ) const
|
int* pnHeight ) const
|
||||||
{
|
{
|
||||||
LONG lArray[CAPS_HEIGHT];
|
LONG lArray[CAPS_HEIGHT+1];
|
||||||
|
|
||||||
if(::DevQueryCaps( m_hDC
|
if(::DevQueryCaps( m_hDC
|
||||||
,CAPS_FAMILY
|
,CAPS_FAMILY
|
||||||
,CAPS_HEIGHT
|
,CAPS_HEIGHT+1
|
||||||
,lArray
|
,lArray
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
*pnWidth = lArray[CAPS_WIDTH];
|
if (pnWidth)
|
||||||
*pnHeight = lArray[CAPS_HEIGHT];
|
*pnWidth = lArray[CAPS_WIDTH];
|
||||||
|
if (pnHeight)
|
||||||
|
*pnHeight = lArray[CAPS_HEIGHT];
|
||||||
}
|
}
|
||||||
}; // end of wxPMDCImpl::DoGetSize(
|
}; // end of wxPMDCImpl::DoGetSize(
|
||||||
|
|
||||||
void wxPMDCImpl::DoGetSizeMM( int* pnWidth,
|
void wxPMDCImpl::DoGetSizeMM( int* pnWidth,
|
||||||
int* pnHeight ) const
|
int* pnHeight ) const
|
||||||
{
|
{
|
||||||
LONG lArray[CAPS_VERTICAL_RESOLUTION];
|
LONG lArray[CAPS_VERTICAL_RESOLUTION+1];
|
||||||
|
|
||||||
if(::DevQueryCaps( m_hDC
|
if(::DevQueryCaps( m_hDC
|
||||||
,CAPS_FAMILY
|
,CAPS_FAMILY
|
||||||
,CAPS_VERTICAL_RESOLUTION
|
,CAPS_VERTICAL_RESOLUTION+1
|
||||||
,lArray
|
,lArray
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
if(pnWidth)
|
if(pnWidth)
|
||||||
{
|
{
|
||||||
int nWidth = lArray[CAPS_WIDTH];
|
int nWidth = lArray[CAPS_WIDTH];
|
||||||
int nHorzRes = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter
|
int nHorzRes = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter
|
||||||
*pnWidth = (nHorzRes/1000) * nWidth;
|
// use fp to avoid returning 0 if nHorzRes < 1000
|
||||||
|
*pnWidth = (int)((nHorzRes/1000.0) * nWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pnHeight)
|
if(pnHeight)
|
||||||
{
|
{
|
||||||
int nHeight = lArray[CAPS_HEIGHT];
|
int nHeight = lArray[CAPS_HEIGHT];
|
||||||
int nVertRes = lArray[CAPS_VERTICAL_RESOLUTION]; // returns pel/meter
|
int nVertRes = lArray[CAPS_VERTICAL_RESOLUTION]; // returns pel/meter
|
||||||
*pnHeight = (nVertRes/1000) * nHeight;
|
// use fp to avoid returning 0 if nVertRes < 1000
|
||||||
|
*pnHeight = (int)((nVertRes/1000.0) * nHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}; // end of wxPMDCImpl::DoGetSizeMM
|
}; // end of wxPMDCImpl::DoGetSizeMM
|
||||||
|
|
||||||
wxSize wxPMDCImpl::GetPPI() const
|
wxSize wxPMDCImpl::GetPPI() const
|
||||||
{
|
{
|
||||||
LONG lArray[CAPS_VERTICAL_RESOLUTION];
|
LONG lArray[CAPS_VERTICAL_RESOLUTION+1];
|
||||||
int nWidth = 0;
|
int nWidth = 0;
|
||||||
int nHeight = 0;
|
int nHeight = 0;
|
||||||
|
|
||||||
if(::DevQueryCaps( m_hDC
|
if(::DevQueryCaps( m_hDC
|
||||||
,CAPS_FAMILY
|
,CAPS_FAMILY
|
||||||
,CAPS_VERTICAL_RESOLUTION
|
,CAPS_VERTICAL_RESOLUTION+1
|
||||||
,lArray
|
,lArray
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
|
@@ -281,11 +281,16 @@ void wxConvertVectorFontSize(
|
|||||||
// NOTE: 1 point == 1/72 of an inch.
|
// NOTE: 1 point == 1/72 of an inch.
|
||||||
//
|
//
|
||||||
|
|
||||||
vSizef.cx = (FIXED)(((fxPointSize) / 72 ) * lXFontResolution );
|
// multiply first to avoid getting vSizef.cx,cy = 0 since fxPointSize
|
||||||
vSizef.cy = (FIXED)(((fxPointSize) / 72 ) * lYFontResolution );
|
// is normally < 72 and FontResolution is typically ca. 100
|
||||||
|
vSizef.cx = (FIXED)( (fxPointSize * lXFontResolution) / 72 );
|
||||||
|
vSizef.cy = (FIXED)( (fxPointSize * lYFontResolution) / 72 );
|
||||||
|
|
||||||
pFattrs->lMaxBaselineExt = MAKELONG( HIUSHORT( vSizef.cy ), 0 );
|
if (pFattrs)
|
||||||
pFattrs->lAveCharWidth = MAKELONG( HIUSHORT( vSizef.cx ), 0 );
|
{
|
||||||
|
pFattrs->lMaxBaselineExt = MAKELONG( HIUSHORT( vSizef.cy ), 0 );
|
||||||
|
pFattrs->lAveCharWidth = MAKELONG( HIUSHORT( vSizef.cx ), 0 );
|
||||||
|
}
|
||||||
WinReleasePS(hPS);
|
WinReleasePS(hPS);
|
||||||
|
|
||||||
} // end of wxConvertVectorPointSize
|
} // end of wxConvertVectorPointSize
|
||||||
|
Reference in New Issue
Block a user