From 7ed13120ab62b424bd626d9ed31e73d74963ea10 Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Sat, 27 Feb 2010 13:31:07 -0500 Subject: [PATCH] richedit: Make zooming affect all pictures. --- dlls/riched20/richole.c | 65 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index c7eb5ffca9..5b6b2b666f 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -1729,6 +1729,11 @@ void ME_GetOLEObjectSize(ME_Context *c, ME_Run *run, SIZE *pSize) if (run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0) { convert_sizel(c, &run->ole_obj->sizel, pSize); + if (c->editor->nZoomNumerator != 0) + { + pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator); + pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator); + } return; } @@ -1819,53 +1824,45 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run, GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect); hMemDC = CreateCompatibleDC(c->hDC); SelectObject(hMemDC, stgm.u.hBitmap); - if (!has_size && c->editor->nZoomNumerator == 0) + if (has_size) { - sz.cx = dibsect.dsBm.bmWidth; - sz.cy = dibsect.dsBm.bmHeight; - BitBlt(c->hDC, x, y - dibsect.dsBm.bmHeight, - dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, - hMemDC, 0, 0, SRCCOPY); + convert_sizel(c, &run->ole_obj->sizel, &sz); + } else { + sz.cx = MulDiv(dibsect.dsBm.bmWidth, c->dpi.cx, 96); + sz.cy = MulDiv(dibsect.dsBm.bmHeight, c->dpi.cy, 96); + } + if (c->editor->nZoomNumerator != 0) + { + sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator); + sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator); } - else + if (sz.cx == dibsect.dsBm.bmWidth && sz.cy == dibsect.dsBm.bmHeight) { - if (has_size) - { - convert_sizel(c, &run->ole_obj->sizel, &sz); - } - else - { - sz.cx = MulDiv(dibsect.dsBm.bmWidth, - c->editor->nZoomNumerator, c->editor->nZoomDenominator); - sz.cy = MulDiv(dibsect.dsBm.bmHeight, - c->editor->nZoomNumerator, c->editor->nZoomDenominator); - } + BitBlt(c->hDC, x, y - sz.cy, + dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, + hMemDC, 0, 0, SRCCOPY); + } else { 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); break; case TYMED_ENHMF: GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh); - if (!has_size && c->editor->nZoomNumerator == 0) + if (has_size) { - sz.cy = emh.rclBounds.bottom - emh.rclBounds.top; - sz.cx = emh.rclBounds.right - emh.rclBounds.left; + convert_sizel(c, &run->ole_obj->sizel, &sz); + } else { + sz.cy = MulDiv(emh.rclBounds.bottom - emh.rclBounds.top, c->dpi.cx, 96); + sz.cx = MulDiv(emh.rclBounds.right - emh.rclBounds.left, c->dpi.cy, 96); } - else + if (c->editor->nZoomNumerator != 0) { - if (has_size) - { - convert_sizel(c, &run->ole_obj->sizel, &sz); - } - else - { - sz.cy = MulDiv(emh.rclBounds.bottom - emh.rclBounds.top, - c->editor->nZoomNumerator, c->editor->nZoomDenominator); - sz.cx = MulDiv(emh.rclBounds.right - emh.rclBounds.left, - c->editor->nZoomNumerator, c->editor->nZoomDenominator); - } + sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator); + sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator); } + { RECT rc; -- 2.32.0.93.g670b81a890