Dylan Smith : wordpad: Avoid making monochrome bitmaps for print preview.
Alexandre Julliard
julliard at winehq.org
Thu Feb 18 12:49:22 CST 2010
Module: wine
Branch: master
Commit: 003e7e967545711f5a750b05686856d7630d7ce5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=003e7e967545711f5a750b05686856d7630d7ce5
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Wed Feb 17 14:16:01 2010 -0500
wordpad: Avoid making monochrome bitmaps for print preview.
Previewly monochrome bitmaps were being created by CreateCompatibleBitmap
because the hdc passed into that call came from CreateCompatibleDC which is
initialized with a single pixel monochrome bitmap.
---
programs/wordpad/print.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/programs/wordpad/print.c b/programs/wordpad/print.c
index e43b4b9..e8d14e8 100644
--- a/programs/wordpad/print.c
+++ b/programs/wordpad/print.c
@@ -874,13 +874,11 @@ static void draw_preview_page(HDC hdc, HDC* hdcSized, FORMATRANGE* lpFr, float r
}
-static void draw_preview(HWND hEditorWnd, FORMATRANGE* lpFr, int bmWidth, int bmHeight, RECT* paper, int page)
+static void draw_preview(HWND hEditorWnd, FORMATRANGE* lpFr, RECT* paper, int page)
{
- HBITMAP hBitmapCapture = CreateCompatibleBitmap(lpFr->hdc, bmWidth, bmHeight);
int bottom;
char_from_pagenum(hEditorWnd, lpFr, page);
- SelectObject(lpFr->hdc, hBitmapCapture);
FillRect(lpFr->hdc, paper, GetStockObject(WHITE_BRUSH));
bottom = lpFr->rc.bottom;
SendMessageW(hEditorWnd, EM_FORMATRANGE, TRUE, (LPARAM)lpFr);
@@ -926,6 +924,7 @@ LRESULT print_preview(HWND hwndPreview)
GETTEXTLENGTHEX gt;
RECT paper;
HWND hEditorWnd = GetDlgItem(hMainWnd, IDC_EDITOR);
+ HBITMAP hBitmapCapture;
preview.hdc = CreateCompatibleDC(hdc);
@@ -947,12 +946,16 @@ LRESULT print_preview(HWND hwndPreview)
paper.bottom = preview.bmSize.cy;
fr.hdc = preview.hdc;
- draw_preview(hEditorWnd, &fr, preview.bmSize.cx, preview.bmSize.cy, &paper, preview.page);
+ hBitmapCapture = CreateCompatibleBitmap(hdc, preview.bmSize.cx, preview.bmSize.cy);
+ SelectObject(fr.hdc, hBitmapCapture);
+ draw_preview(hEditorWnd, &fr, &paper, preview.page);
if(preview.hdc2)
{
fr.hdc = preview.hdc2;
- draw_preview(hEditorWnd, &fr, preview.bmSize.cx, preview.bmSize.cy, &fr.rcPage, preview.page + 1);
+ hBitmapCapture = CreateCompatibleBitmap(hdc, preview.bmSize.cx, preview.bmSize.cy);
+ SelectObject(fr.hdc, hBitmapCapture);
+ draw_preview(hEditorWnd, &fr, &fr.rcPage, preview.page + 1);
}
update_preview_buttons(hMainWnd);
More information about the wine-cvs
mailing list