Fix for upside down bmp projections
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15478 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
c3f7931401
commit
ad6bd8701e
@ -217,7 +217,6 @@ public:
|
||||
{ return (GetBitmapData() ? GetBitmapData()->m_pSelectedInto : (wxDC*) NULL); }
|
||||
|
||||
inline bool IsMono(void) const { return m_bIsMono; }
|
||||
inline bool Flip(void) const { return m_bFlip; }
|
||||
|
||||
|
||||
// An OS/2 version that probably doesn't do anything like the msw version
|
||||
@ -242,7 +241,6 @@ private:
|
||||
bool CopyFromIconOrCursor(const wxGDIImage& rIcon);
|
||||
|
||||
bool m_bIsMono;
|
||||
bool m_bFlip;
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||
}; // end of CLASS wxBitmap
|
||||
|
||||
|
@ -90,7 +90,6 @@ void wxBitmap::Init()
|
||||
//
|
||||
// True for all bitmaps created from bits, wxImages, Xpms
|
||||
//
|
||||
m_bFlip = TRUE;
|
||||
} // end of wxBitmap::Init
|
||||
|
||||
bool wxBitmap::CopyFromIconOrCursor(
|
||||
@ -269,7 +268,6 @@ wxBitmap::wxBitmap(
|
||||
)
|
||||
{
|
||||
Init();
|
||||
m_bFlip = FALSE;
|
||||
(void)Create( nW
|
||||
,nH
|
||||
,nD
|
||||
@ -300,7 +298,6 @@ wxBitmap::wxBitmap(
|
||||
)
|
||||
{
|
||||
Init();
|
||||
m_bFlip = FALSE;
|
||||
LoadFile( rFilename
|
||||
,(int)lType
|
||||
);
|
||||
@ -326,8 +323,6 @@ bool wxBitmap::Create(
|
||||
// Xpms and bitmaps from other images can also be mono's, but only
|
||||
// mono's need help changing their colors with MemDC changes
|
||||
//
|
||||
if (nD == 1)
|
||||
m_bIsMono = TRUE;
|
||||
if (nD > 0)
|
||||
{
|
||||
DEVOPENSTRUC vDop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
|
||||
@ -335,6 +330,8 @@ bool wxBitmap::Create(
|
||||
HDC hDC = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE);
|
||||
HPS hPS = ::GpiCreatePS(vHabmain, hDC, &vSize, PU_PELS | GPIA_ASSOC);
|
||||
|
||||
if (nD == 1)
|
||||
m_bIsMono = TRUE;
|
||||
memset(&vHeader, '\0', 16);
|
||||
vHeader.cbFix = 16;
|
||||
vHeader.cx = nW;
|
||||
@ -526,7 +523,6 @@ bool wxBitmap::CreateFromImage (
|
||||
{
|
||||
wxCHECK_MSG(rImage.Ok(), FALSE, wxT("invalid image"));
|
||||
m_refData = new wxBitmapRefData();
|
||||
m_bFlip = TRUE;
|
||||
|
||||
int nSizeLimit = 1024 * 768 * 3;
|
||||
int nWidth = rImage.GetWidth();
|
||||
@ -565,6 +561,10 @@ bool wxBitmap::CreateFromImage (
|
||||
wxCHECK_MSG(rImage.Ok(), FALSE, wxT("invalid image"));
|
||||
SetWidth(nWidth);
|
||||
SetHeight(nBmpHeight);
|
||||
if (nDepth == 1)
|
||||
m_bIsMono = TRUE;
|
||||
else
|
||||
m_bIsMono = FALSE;
|
||||
if (nDepth == -1)
|
||||
nDepth = wxDisplayDepth();
|
||||
SetDepth(nDepth);
|
||||
@ -770,6 +770,7 @@ bool wxBitmap::CreateFromImage (
|
||||
//
|
||||
nHeight = nHRemain;
|
||||
vHeader.cy = (DWORD)(nHeight);
|
||||
vHeader.cbImage = nBytePerLine * nHeight;
|
||||
}
|
||||
ptbits = pucBits;
|
||||
for (int j = 0; j < nHeight; j++)
|
||||
|
@ -1147,8 +1147,8 @@ void wxDC::DoDrawRoundedRectangle(
|
||||
::GpiBox( m_hPS
|
||||
,lControl
|
||||
,&vPoint[1]
|
||||
,0L
|
||||
,0L
|
||||
,(LONG)dRadius
|
||||
,(LONG)dRadius
|
||||
);
|
||||
lControl = DRO_FILL;
|
||||
::GpiSetColor( m_hPS
|
||||
@ -1162,8 +1162,8 @@ void wxDC::DoDrawRoundedRectangle(
|
||||
::GpiBox( m_hPS
|
||||
,lControl
|
||||
,&vPoint[1]
|
||||
,0L
|
||||
,0L
|
||||
,(LONG)dRadius
|
||||
,(LONG)dRadius
|
||||
);
|
||||
}
|
||||
|
||||
@ -1314,31 +1314,14 @@ void wxDC::DoDrawBitmap(
|
||||
|
||||
vY = OS2Y(vY,rBmp.GetHeight());
|
||||
|
||||
//
|
||||
// Flip the picture as OS/2 is upside-down
|
||||
//
|
||||
if (rBmp.Flip())
|
||||
{
|
||||
vPoint[0].x = vX;
|
||||
vPoint[0].y = vY + rBmp.GetHeight();
|
||||
vPoint[1].x = vX + rBmp.GetWidth();
|
||||
vPoint[1].y = vY;
|
||||
vPoint[2].x = 0;
|
||||
vPoint[2].y = 0;
|
||||
vPoint[3].x = rBmp.GetWidth();
|
||||
vPoint[3].y = rBmp.GetHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
vPoint[0].x = vX;
|
||||
vPoint[0].y = vY;
|
||||
vPoint[1].x = vX + rBmp.GetWidth();
|
||||
vPoint[1].y = vY + rBmp.GetHeight();
|
||||
vPoint[2].x = 0;
|
||||
vPoint[2].y = 0;
|
||||
vPoint[3].x = rBmp.GetWidth();
|
||||
vPoint[3].y = rBmp.GetHeight();
|
||||
}
|
||||
vPoint[0].x = vX;
|
||||
vPoint[0].y = vY + rBmp.GetHeight();
|
||||
vPoint[1].x = vX + rBmp.GetWidth();
|
||||
vPoint[1].y = vY;
|
||||
vPoint[2].x = 0;
|
||||
vPoint[2].y = 0;
|
||||
vPoint[3].x = rBmp.GetWidth();
|
||||
vPoint[3].y = rBmp.GetHeight();
|
||||
if (bUseMask)
|
||||
{
|
||||
wxMask* pMask = rBmp.GetMask();
|
||||
@ -1786,14 +1769,14 @@ void wxDC::DrawAnyText(
|
||||
m_vRclPaint.yBottom == 0 &&
|
||||
m_vRclPaint.xRight == 0 &&
|
||||
m_vRclPaint.xLeft == 0))
|
||||
vPtlStart.y = OS2Y(vY,vTextY);
|
||||
vPtlStart.y = OS2Y(vY,vTextY/1.5); // Full extent is a bit much
|
||||
else
|
||||
{
|
||||
if (m_vSelectedBitmap != wxNullBitmap)
|
||||
{
|
||||
m_vRclPaint.yTop = m_vSelectedBitmap.GetHeight();
|
||||
m_vRclPaint.xRight = m_vSelectedBitmap.GetWidth();
|
||||
vPtlStart.y = OS2Y(vY,vTextY);
|
||||
vPtlStart.y = OS2Y(vY,vTextY/1.5);
|
||||
}
|
||||
else
|
||||
vPtlStart.y = vY;
|
||||
|
@ -150,6 +150,22 @@ void wxMemoryDC::SelectObject(
|
||||
|
||||
if (!hBmp)
|
||||
{
|
||||
//
|
||||
// Bmps drawn to are upside down, so flip it before committing
|
||||
//
|
||||
POINTL vPoint[4] = { 0, m_vSelectedBitmap.GetHeight(),
|
||||
m_vSelectedBitmap.GetWidth(), 0,
|
||||
0, 0, m_vSelectedBitmap.GetWidth(), m_vSelectedBitmap.GetHeight()
|
||||
};
|
||||
|
||||
|
||||
::GpiBitBlt( m_hPS
|
||||
,m_hPS
|
||||
,4
|
||||
,vPoint
|
||||
,ROP_SRCCOPY
|
||||
,BBO_IGNORE
|
||||
);
|
||||
m_vSelectedBitmap.SetSelectedInto(NULL);
|
||||
}
|
||||
m_vSelectedBitmap = rBitmap;
|
||||
@ -157,6 +173,7 @@ void wxMemoryDC::SelectObject(
|
||||
|
||||
if (!hBmp)
|
||||
{
|
||||
|
||||
m_hOldBitmap = (WXHBITMAP)::GpiSetBitmap(m_hPS, NULLHANDLE);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user