-- v2: d3drm: Correct D3DRMIMAGE validation
From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
--- dlls/d3drm/tests/d3drm.c | 17 +++++++++++++++++ dlls/d3drm/texture.c | 27 ++++++++++++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 6922a70df24..5d478f24b1a 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -2724,6 +2724,12 @@ static void test_Texture(void) TRUE, 0, (void *)0xcafebabe, NULL, 0x000000ff, 0x0000ff00, 0x00ff0000, 0, 0, NULL }, + testimg_palette = + { + 2, 2, 1, 1, 32, + FALSE, 2 * sizeof(DWORD), (void *)0xcafebabe, NULL, + 0x00000000, 0x00000000, 0x00000000, 0, 2, (void *)0xcafebabe + }, *d3drm_img = NULL;
DWORD pixel[4] = { 20000, 30000, 10000, 0 }; @@ -2785,6 +2791,17 @@ static void test_Texture(void) IDirect3DRMTexture2_Release(texture2); IDirect3DRMTexture3_Release(texture3);
+ /* Just palette set */ + hr = IDirect3DRM_CreateTexture(d3drm1, &testimg_palette, &texture1); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRMTexture interface, hr %#lx\n", hr); + hr = IDirect3DRM2_CreateTexture(d3drm2, &testimg_palette, &texture2); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRMTexture2 interface, hr %#lx\n", hr); + hr = IDirect3DRM3_CreateTexture(d3drm3, &testimg_palette, &texture3); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRMTexture3 interface, hr %#lx\n", hr); + IDirect3DRMTexture_Release(texture1); + IDirect3DRMTexture2_Release(texture2); + IDirect3DRMTexture3_Release(texture3); + initimg.rgb = 0; texture1 = (IDirect3DRMTexture *)0xdeadbeef; hr = IDirect3DRM_CreateTexture(d3drm1, &initimg, &texture1); diff --git a/dlls/d3drm/texture.c b/dlls/d3drm/texture.c index b9d84114995..32f6ea48d04 100644 --- a/dlls/d3drm/texture.c +++ b/dlls/d3drm/texture.c @@ -52,14 +52,27 @@ static void d3drm_texture_destroy(struct d3drm_texture *texture)
static BOOL d3drm_validate_image(D3DRMIMAGE *image) { - if (!image - || !image->red_mask - || !image->green_mask - || !image->blue_mask - || !image->buffer1 - || !(image->rgb || (image->palette && image->palette_size))) - { + if (!image) return FALSE; + + TRACE("size (%d, %d), aspect (%d, %d), depth %d, red %lx, green %lx, blue %lx, " + "buffer1 %p, buffer2 %p, rgb %d, pal %p, size %d\n", + image->width, image->height, image->aspectx, image->aspecty, + image->depth, image->red_mask, image->green_mask, image->blue_mask, image->buffer1, + image->buffer2, image->rgb, image->palette, image->palette_size ); + + if (!image->buffer1) + return FALSE; + + if (image->rgb) + { + if (!image->red_mask || !image->green_mask || !image->blue_mask) + return FALSE; + } + else + { + if (!image->palette || !image->palette_size) + return FALSE; }
return TRUE;
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=137255
Your paranoid android.
=== debian11b (64 bit WoW report) ===
uiautomationcore: uiautomation.c:14704: Test failed: Wait for event_handle failed. uiautomation.c:14705: Test failed: expected uia_event_callback uiautomation.c:15296: Test failed: 2 failures in child process
Let's use %#x for hexadecimal masks, please.