*/
#ifdef __WXWINCE__
- #define XLOG2DEV(x) ((x-m_logicalOriginX)*m_signX+m_deviceOriginX)
- #define YLOG2DEV(y) ((y-m_logicalOriginY)*m_signY+m_deviceOriginY)
- #define XDEV2LOG(x) ((x-m_deviceOriginX)*m_signX+m_logicalOriginX)
- #define YDEV2LOG(y) ((y-m_deviceOriginY)*m_signY+m_logicalOriginY)
+ #define XLOG2DEV(x) ((x-m_logicalOriginX)*m_signX)
+ #define YLOG2DEV(y) ((y-m_logicalOriginY)*m_signY)
+ #define XDEV2LOG(x) ((x)*m_signX+m_logicalOriginX)
+ #define YDEV2LOG(y) ((y)*m_signY+m_logicalOriginY)
#else
#define XLOG2DEV(x) (x)
#define YLOG2DEV(y) (y)
// otherwise
static bool AlphaBlt(HDC hdcDst,
int x, int y, int w, int h,
- HDC hdcSrc,
+ int srcX, int srcY, HDC hdcSrc,
const wxBitmap& bmpSrc);
#ifdef wxHAVE_RAW_BITMAP
// our (limited) AlphaBlend() replacement
static void
-wxAlphaBlend(HDC hdcDst, int x, int y, int w, int h, const wxBitmap& bmp);
+wxAlphaBlend(HDC hdcDst, int x, int y, int w, int h, int srcX, int srcY, const wxBitmap& bmp);
#endif
// ----------------------------------------------------------------------------
if ( !::GetClipBox(GetHdc(), &rectClip) )
return;
+ // GetClipBox returns logical coordinates, so transform to device
+ rectClip.left = LogicalToDeviceX(rectClip.left);
+ rectClip.top = LogicalToDeviceY(rectClip.top);
+ rectClip.right = LogicalToDeviceX(rectClip.right);
+ rectClip.bottom = LogicalToDeviceY(rectClip.bottom);
+
HRGN hrgnDest = ::CreateRectRgn(0, 0, 0, 0);
HRGN hrgnClipOld = ::CreateRectRgn(rectClip.left, rectClip.top,
rectClip.right, rectClip.bottom);
MemoryHDC hdcMem;
SelectInHDC select(hdcMem, GetHbitmapOf(bmp));
- if ( AlphaBlt(GetHdc(), x, y, width, height, hdcMem, bmp) )
+ if ( AlphaBlt(GetHdc(), x, y, width, height, 0, 0, hdcMem, bmp) )
return;
}
SIZE sizeRect;
TEXTMETRIC tm;
- GetTextExtentPoint(GetHdc(), string, string.length(), &sizeRect);
+ ::GetTextExtentPoint32(GetHdc(), string, string.length(), &sizeRect);
GetTextMetrics(GetHdc(), &tm);
if (x)
m_deviceOriginX = x;
m_deviceOriginY = y;
-#ifndef __WXWINCE__
::SetViewportOrgEx(GetHdc(), (int)m_deviceOriginX, (int)m_deviceOriginY, NULL);
-#endif
}
// ---------------------------------------------------------------------------
(m_selectedBitmap.Ok() && m_selectedBitmap.HasAlpha())) )
{
if ( AlphaBlt(GetHdc(), xdest, ydest, width, height,
- GetHdcOf(*source), bmpSrc) )
+ xsrc, ysrc, GetHdcOf(*source), bmpSrc) )
return true;
}
static bool AlphaBlt(HDC hdcDst,
int x, int y, int width, int height,
- HDC hdcSrc,
+ int srcX, int srcY, HDC hdcSrc,
const wxBitmap& bmp)
{
wxASSERT_MSG( bmp.Ok() && bmp.HasAlpha(), _T("AlphaBlt(): invalid bitmap") );
bf.AlphaFormat = AC_SRC_ALPHA;
if ( pfnAlphaBlend(hdcDst, x, y, width, height,
- hdcSrc, 0, 0, width, height,
+ hdcSrc, srcX, srcY, width, height,
bf) )
{
// skip wxAlphaBlend() call below
// AlphaBlend() unavailable of failed: use our own (probably much slower)
// implementation
#ifdef wxHAVE_RAW_BITMAP
- wxAlphaBlend(hdcDst, x, y, width, height, bmp);
+ wxAlphaBlend(hdcDst, x, y, width, height, srcX, srcY, bmp);
return true;
#else // !wxHAVE_RAW_BITMAP
#ifdef wxHAVE_RAW_BITMAP
static void
-wxAlphaBlend(HDC hdcDst, int xDst, int yDst, int w, int h, const wxBitmap& bmpSrc)
+wxAlphaBlend(HDC hdcDst, int xDst, int yDst, int w, int h, int srcX, int srcY, const wxBitmap& bmpSrc)
{
// get the destination DC pixels
wxBitmap bmpDst(w, h, 32 /* force creating RGBA DIB */);
wxAlphaPixelData::Iterator pDst(dataDst),
pSrc(dataSrc);
+ pSrc.Offset(dataSrc, srcX, srcY);
+
for ( int y = 0; y < h; y++ )
{
wxAlphaPixelData::Iterator pDstRowStart = pDst,
pSrcRowStart = pSrc;
-
+
for ( int x = 0; x < w; x++ )
{
// note that source bitmap uses premultiplied alpha (as required by