[PATCH v2 0/3] MR4639: wineps: Pattern brush improvements
-- v2: wineps: Fix color handling in PSDRV_WriteDIBPatternDict. https://gitlab.winehq.org/wine/wine/-/merge_requests/4639
From: Piotr Caban <piotr(a)codeweavers.com> Image rotation is done in PSDRV_WriteImageDict. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55210 --- dlls/wineps.drv/ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wineps.drv/ps.c b/dlls/wineps.drv/ps.c index a8050abe19b..f4f8850d65f 100644 --- a/dlls/wineps.drv/ps.c +++ b/dlls/wineps.drv/ps.c @@ -990,7 +990,7 @@ BOOL PSDRV_WriteDIBPatternDict(print_ctx *ctx, const BITMAPINFO *bmi, BYTE *bits buf = HeapAlloc( GetProcessHeap(), 0, max(sizeof(do_pattern) + 100, 2 * w/8 * h + 1) ); ptr = buf; - for(y = h-1; y >= 0; y--) { + for(y = 0; y < h; y++) { for(x = 0; x < w/8; x++) { sprintf(ptr, "%02x", *(bits + x/8 + y * ((bmi->bmiHeader.biWidth + 31) / 32) * 4)); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4639
From: Piotr Caban <piotr(a)codeweavers.com> --- 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); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4639
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/wineps.drv/ps.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/dlls/wineps.drv/ps.c b/dlls/wineps.drv/ps.c index 2a3da737c81..03c92aa00f0 100644 --- a/dlls/wineps.drv/ps.c +++ b/dlls/wineps.drv/ps.c @@ -1002,8 +1002,34 @@ BOOL PSDRV_WriteDIBPatternDict(print_ctx *ctx, const BITMAPINFO *bmi, BYTE *bits PSDRV_WriteSpool(ctx, "def\n", 4); PSDRV_WriteIndexColorSpaceBegin(ctx, 1); - map[0] = GetTextColor( ctx->hdc ); - map[1] = GetBkColor( ctx->hdc ); + if (usage == DIB_RGB_COLORS) + { + map[0] = RGB( bmi->bmiColors[0].rgbRed, bmi->bmiColors[0].rgbGreen, + bmi->bmiColors[0].rgbBlue ); + map[1] = RGB( bmi->bmiColors[1].rgbRed, bmi->bmiColors[1].rgbGreen, + bmi->bmiColors[1].rgbBlue ); + } + else if (usage == DIB_PAL_COLORS) + { + HPALETTE hpal = GetCurrentObject( ctx->hdc, OBJ_PAL ); + PALETTEENTRY pal[2]; + + memset(pal, 0, sizeof(pal)); + if (hpal) GetPaletteEntries(hpal, 0, 2, pal); + + map[0] = RGB(pal[0].peRed, pal[0].peGreen, pal[0].peBlue); + map[1] = RGB(pal[1].peRed, pal[1].peGreen, pal[1].peBlue); + } + else if (usage == 2 /* DIB_PAL_INDICES */) + { + map[0] = GetTextColor( ctx->hdc ); + map[1] = GetBkColor( ctx->hdc ); + } + else + { + FIXME("wrong usage: %d\n", usage); + return FALSE; + } PSDRV_WriteRGB(ctx, map, 2); PSDRV_WriteIndexColorSpaceEnd(ctx); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4639
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details: The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=140919 Your paranoid android. === debian11b (64 bit WoW report) === dinput: device8.c:2238: Test failed: 0x700: got key_state[0] 0
This merge request was approved by Huw Davies. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4639
participants (4)
-
Huw Davies (@huw) -
Marvin -
Piotr Caban -
Piotr Caban (@piotr)