wined3d: Just print a message if loading the logo bitmap failed.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-03-28 23:37:37 +02:00 committed by Alexandre Julliard
parent 74492d7857
commit b44b2c2dce
1 changed files with 18 additions and 33 deletions

View File

@ -35,6 +35,7 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(winediag);
/* Define the default light parameters as specified by MSDN. */ /* Define the default light parameters as specified by MSDN. */
const struct wined3d_light WINED3D_default_light = const struct wined3d_light WINED3D_default_light =
@ -547,23 +548,16 @@ static void device_load_logo(struct wined3d_device *device, const char *filename
HRESULT hr; HRESULT hr;
HDC dcb = NULL, dcs = NULL; HDC dcb = NULL, dcs = NULL;
hbm = LoadImageA(NULL, filename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); if (!(hbm = LoadImageA(NULL, filename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION)))
if(hbm)
{ {
GetObjectA(hbm, sizeof(BITMAP), &bm); ERR_(winediag)("Failed to load logo %s.\n", wine_dbgstr_a(filename));
dcb = CreateCompatibleDC(NULL); return;
if(!dcb) goto out;
SelectObject(dcb, hbm);
}
else
{
/* Create a 32x32 white surface to indicate that wined3d is used, but the specified image
* couldn't be loaded
*/
memset(&bm, 0, sizeof(bm));
bm.bmWidth = 32;
bm.bmHeight = 32;
} }
GetObjectA(hbm, sizeof(BITMAP), &bm);
if (!(dcb = CreateCompatibleDC(NULL)))
goto out;
SelectObject(dcb, hbm);
desc.resource_type = WINED3D_RTYPE_TEXTURE_2D; desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
desc.format = WINED3DFMT_B5G6R5_UNORM; desc.format = WINED3DFMT_B5G6R5_UNORM;
@ -583,27 +577,18 @@ static void device_load_logo(struct wined3d_device *device, const char *filename
goto out; goto out;
} }
if (dcb) if (FAILED(hr = wined3d_texture_get_dc(device->logo_texture, 0, &dcs)))
{ {
if (FAILED(hr = wined3d_texture_get_dc(device->logo_texture, 0, &dcs))) wined3d_texture_decref(device->logo_texture);
goto out; device->logo_texture = NULL;
BitBlt(dcs, 0, 0, bm.bmWidth, bm.bmHeight, dcb, 0, 0, SRCCOPY); goto out;
wined3d_texture_release_dc(device->logo_texture, 0, dcs);
color_key.color_space_low_value = 0;
color_key.color_space_high_value = 0;
wined3d_texture_set_color_key(device->logo_texture, WINED3D_CKEY_SRC_BLT, &color_key);
} }
else BitBlt(dcs, 0, 0, bm.bmWidth, bm.bmHeight, dcb, 0, 0, SRCCOPY);
{ wined3d_texture_release_dc(device->logo_texture, 0, dcs);
const struct wined3d_color c = {1.0f, 1.0f, 1.0f, 1.0f};
const RECT rect = {0, 0, desc.width, desc.height};
struct wined3d_surface *surface;
/* Fill the surface with a white color to show that wined3d is there */ color_key.color_space_low_value = 0;
surface = device->logo_texture->sub_resources[0].u.surface; color_key.color_space_high_value = 0;
surface_color_fill(surface, &rect, &c); wined3d_texture_set_color_key(device->logo_texture, WINED3D_CKEY_SRC_BLT, &color_key);
}
out: out:
if (dcb) DeleteDC(dcb); if (dcb) DeleteDC(dcb);