Commit 25115380 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

riched20: Invert graphics when they are under the selection.

parent d014db68
...@@ -619,7 +619,7 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run, ...@@ -619,7 +619,7 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
DIBSECTION dibsect; DIBSECTION dibsect;
ENHMETAHEADER emh; ENHMETAHEADER emh;
HDC hMemDC; HDC hMemDC;
RECT rc; SIZE sz;
assert(run->nFlags & MERF_GRAPHICS); assert(run->nFlags & MERF_GRAPHICS);
assert(run->ole_obj); assert(run->ole_obj);
...@@ -651,43 +651,56 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run, ...@@ -651,43 +651,56 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
hMemDC = CreateCompatibleDC(c->hDC); hMemDC = CreateCompatibleDC(c->hDC);
SelectObject(hMemDC, stgm.u.hBitmap); SelectObject(hMemDC, stgm.u.hBitmap);
if (c->editor->nZoomNumerator == 0) if (c->editor->nZoomNumerator == 0)
{
sz.cx = dibsect.dsBm.bmWidth;
sz.cy = dibsect.dsBm.bmHeight;
BitBlt(c->hDC, x, y - dibsect.dsBm.bmHeight, BitBlt(c->hDC, x, y - dibsect.dsBm.bmHeight,
dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight,
hMemDC, 0, 0, SRCCOPY); hMemDC, 0, 0, SRCCOPY);
}
else else
{ {
int w = MulDiv(dibsect.dsBm.bmWidth, sz.cy = MulDiv(dibsect.dsBm.bmWidth,
c->editor->nZoomNumerator, c->editor->nZoomDenominator); c->editor->nZoomNumerator, c->editor->nZoomDenominator);
int h = MulDiv(dibsect.dsBm.bmHeight, sz.cx = MulDiv(dibsect.dsBm.bmHeight,
c->editor->nZoomNumerator, c->editor->nZoomDenominator); c->editor->nZoomNumerator, c->editor->nZoomDenominator);
StretchBlt(c->hDC, x, y - h, w, h, StretchBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy,
hMemDC, 0, 0, dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, SRCCOPY); hMemDC, 0, 0, dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, SRCCOPY);
} }
if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap); if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
break; break;
case TYMED_ENHMF: case TYMED_ENHMF:
GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh); GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
rc.left = x;
rc.bottom = y;
if (c->editor->nZoomNumerator == 0) if (c->editor->nZoomNumerator == 0)
{ {
rc.top = y - (emh.rclBounds.bottom - emh.rclBounds.top); sz.cy = emh.rclBounds.bottom - emh.rclBounds.top;
rc.right = x + (emh.rclBounds.right - emh.rclBounds.left); sz.cx = emh.rclBounds.right - emh.rclBounds.left;
} }
else else
{ {
rc.top = y - MulDiv(emh.rclBounds.bottom - emh.rclBounds.top, sz.cy = MulDiv(emh.rclBounds.bottom - emh.rclBounds.top,
c->editor->nZoomNumerator, c->editor->nZoomDenominator); c->editor->nZoomNumerator, c->editor->nZoomDenominator);
rc.right = x + MulDiv(emh.rclBounds.right - emh.rclBounds.left, sz.cx = MulDiv(emh.rclBounds.right - emh.rclBounds.left,
c->editor->nZoomNumerator, c->editor->nZoomDenominator); c->editor->nZoomNumerator, c->editor->nZoomDenominator);
}
{
RECT rc;
rc.left = x;
rc.top = y - sz.cy;
rc.right = x + sz.cx;
rc.bottom = y;
PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
} }
PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile); if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
break; break;
default: default:
FIXME("Unsupported tymed %d\n", stgm.tymed); FIXME("Unsupported tymed %d\n", stgm.tymed);
selected = FALSE;
break; break;
} }
if (selected && !c->editor->bHideSelection)
PatBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy, DSTINVERT);
IDataObject_Release(ido); IDataObject_Release(ido);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment