static struct wined3d_resource * WINAPI IWineD3DTextureImpl_GetSubResource(IWineD3DBaseTexture *iface, UINT sub_resource_idx) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx); return basetexture_get_sub_resource(texture, sub_resource_idx); }
static HRESULT WINAPI IWineD3DTextureImpl_Unmap(IWineD3DTexture *iface, UINT sub_resource_idx) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; IWineD3DSurface *surface; TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx); if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; } return IWineD3DSurface_Unmap(surface); }
/* ******************************************* IWineD3DTexture IWineD3DTexture parts follow ******************************************* */ static HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface, UINT level, WINED3DSURFACE_DESC *desc) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; IWineD3DSurface *surface; TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, 0, level))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; } return IWineD3DSurface_GetDesc(surface, desc); }
static HRESULT WINAPI IWineD3DTextureImpl_Map(IWineD3DTexture *iface, UINT sub_resource_idx, WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; IWineD3DSurface *surface; TRACE("iface %p, sub_resource_idx %u, locked_rect %p, rect %s, flags %#x.\n", iface, sub_resource_idx, locked_rect, wine_dbgstr_rect(rect), flags); if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; } return IWineD3DSurface_Map(surface, locked_rect, rect, flags); }
static HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRegion(IWineD3DBaseTexture *iface, UINT layer, const WINED3DBOX *dirty_region) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; struct wined3d_resource *sub_resource; TRACE("iface %p, layer %u, dirty_region %p.\n", iface, layer, dirty_region); if (!(sub_resource = basetexture_get_sub_resource(texture, layer * texture->baseTexture.level_count))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; } basetexture_set_dirty(texture, TRUE); surface_add_dirty_rect(surface_from_resource(sub_resource), dirty_region); return WINED3D_OK; }
static HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRect(IWineD3DTexture *iface, const RECT *dirty_rect) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; IWineD3DSurfaceImpl *surface; TRACE("iface %p, dirty_rect %s.\n", iface, wine_dbgstr_rect(dirty_rect)); if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, 0))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; } texture->baseTexture.texture_rgb.dirty = TRUE; texture->baseTexture.texture_srgb.dirty = TRUE; surface_add_dirty_rect(surface, dirty_rect); return WINED3D_OK; }
static HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface, UINT sub_resource_idx, IWineD3DSurface **surface) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; IWineD3DSurface *s; TRACE("iface %p, sub_resource_idx %u, surface %p.\n", iface, sub_resource_idx, surface); if (!(s = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx))) { WARN("Failed to get sub-resource.\n"); return WINED3DERR_INVALIDCALL; } IWineD3DSurface_AddRef(s); *surface = s; TRACE("Returning surface %p.\n", *surface); return WINED3D_OK; }