Module: wine Branch: master Commit: 8be8d18831cc575e685e61f299a7c75c45d9a3b7 URL: https://gitlab.winehq.org/wine/wine/-/commit/8be8d18831cc575e685e61f299a7c75...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Dec 6 21:28:41 2023 +0100
wineps: Fix handling of patterns that are not 8x8 in PSDRV_WriteDIBPatternDict.
---
dlls/wineps.drv/ps.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/wineps.drv/ps.c b/dlls/wineps.drv/ps.c index f4f8850d65f..2a3da737c81 100644 --- a/dlls/wineps.drv/ps.c +++ b/dlls/wineps.drv/ps.c @@ -985,20 +985,20 @@ BOOL PSDRV_WriteDIBPatternDict(print_ctx *ctx, const BITMAPINFO *bmi, BYTE *bits return FALSE; }
- w = bmi->bmiHeader.biWidth & ~0x7; - h = abs_height & ~0x7; + w = bmi->bmiHeader.biWidth; + h = abs_height;
buf = HeapAlloc( GetProcessHeap(), 0, max(sizeof(do_pattern) + 100, 2 * w/8 * h + 1) ); ptr = buf; for(y = 0; y < h; y++) { - for(x = 0; x < w/8; x++) { - sprintf(ptr, "%02x", *(bits + x/8 + y * + for(x = 0; x < (w + 7) / 8; x++) { + sprintf(ptr, "%02x", *(bits + x + y * ((bmi->bmiHeader.biWidth + 31) / 32) * 4)); ptr += 2; } } PSDRV_WriteSpool(ctx, mypat, sizeof(mypat) - 1); - PSDRV_WriteImageDict(ctx, 1, FALSE, 8, 8, buf, bmi->bmiHeader.biHeight < 0); + PSDRV_WriteImageDict(ctx, 1, FALSE, w, h, buf, bmi->bmiHeader.biHeight < 0); PSDRV_WriteSpool(ctx, "def\n", 4);
PSDRV_WriteIndexColorSpaceBegin(ctx, 1);