From 6464b30ae1f2839c6a85b27190901621719a62b7 Mon Sep 17 00:00:00 2001 From: crystalpt Date: Fri, 16 Jul 2010 05:30:35 +0000 Subject: [WIN32] fixed: LockRect when dynamic textures are not available git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31842 568bbfeb-2a22-0410-94d2-cc84cf5bfa90 --- guilib/D3DResource.cpp | 4 ++++ guilib/GUIFontTTFDX.cpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'guilib') diff --git a/guilib/D3DResource.cpp b/guilib/D3DResource.cpp index 6b3978d5d7..a8f4dbc61f 100644 --- a/guilib/D3DResource.cpp +++ b/guilib/D3DResource.cpp @@ -88,7 +88,11 @@ void CD3DTexture::Release() bool CD3DTexture::LockRect(UINT level, D3DLOCKED_RECT *lr, const RECT *rect, DWORD flags) { if (m_texture) + { + if ((flags & D3DLOCK_DISCARD) && !(m_usage & D3DUSAGE_DYNAMIC)) + flags &= ~D3DLOCK_DISCARD; return (D3D_OK == m_texture->LockRect(level, lr, rect, flags)); + } return false; } diff --git a/guilib/GUIFontTTFDX.cpp b/guilib/GUIFontTTFDX.cpp index 47b80a3dc9..f1b8c0d814 100644 --- a/guilib/GUIFontTTFDX.cpp +++ b/guilib/GUIFontTTFDX.cpp @@ -140,8 +140,9 @@ CBaseTexture* CGUIFontTTFDX::ReallocTexture(unsigned int& newHeight) m_textureHeight = desc.Height; m_textureWidth = desc.Width; + DWORD flags = (newTexture->Usage & D3DUSAGE_DYNAMIC) ? D3DLOCK_DISCARD : 0; D3DLOCKED_RECT rect; - newTexture->LockRect(0, &rect, NULL, D3DLOCK_DISCARD); + newTexture->LockRect(0, &rect, NULL, flags); memset(rect.pBits, 0, rect.Pitch * m_textureHeight); newTexture->UnlockRect(0); -- cgit v1.2.3