Module: wine Branch: master Commit: f235c48cae7cf27c5e5a44972856f1ce6caf2c8b URL: http://source.winehq.org/git/wine.git/?a=commit;h=f235c48cae7cf27c5e5a449728...
Author: Dylan Smith dylan.ah.smith@gmail.com Date: Mon Feb 22 03:18:29 2010 -0500
wordpad: Avoid unnecessary deletion of hdcSized.
---
programs/wordpad/print.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/programs/wordpad/print.c b/programs/wordpad/print.c index 868f992..5c679ea 100644 --- a/programs/wordpad/print.c +++ b/programs/wordpad/print.c @@ -927,16 +927,20 @@ LRESULT CALLBACK ruler_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) static void draw_preview_page(HDC hdc, HDC* hdcSized, FORMATRANGE* lpFr, float ratio, int bmNewWidth, int bmNewHeight, int bmWidth, int bmHeight) { HBITMAP hBitmapScaled = CreateCompatibleBitmap(hdc, bmNewWidth, bmNewHeight); + HBITMAP oldbm; HPEN hPen, oldPen; int TopMargin = (int)((float)twips_to_pixels(lpFr->rc.top, GetDeviceCaps(hdc, LOGPIXELSX)) * ratio); int BottomMargin = (int)((float)twips_to_pixels(lpFr->rc.bottom, GetDeviceCaps(hdc, LOGPIXELSX)) * ratio); int LeftMargin = (int)((float)twips_to_pixels(lpFr->rc.left, GetDeviceCaps(hdc, LOGPIXELSY)) * ratio); int RightMargin = (int)((float)twips_to_pixels(lpFr->rc.right, GetDeviceCaps(hdc, LOGPIXELSY)) * ratio);
- if(*hdcSized) - DeleteDC(*hdcSized); - *hdcSized = CreateCompatibleDC(hdc); - SelectObject(*hdcSized, hBitmapScaled); + if(*hdcSized) { + oldbm = SelectObject(*hdcSized, hBitmapScaled); + DeleteObject(oldbm); + } else { + *hdcSized = CreateCompatibleDC(hdc); + SelectObject(*hdcSized, hBitmapScaled); + }
StretchBlt(*hdcSized, 0, 0, bmNewWidth, bmNewHeight, hdc, 0, 0, bmWidth, bmHeight, SRCCOPY);