aboutsummaryrefslogtreecommitdiff
path: root/guilib
diff options
context:
space:
mode:
authorcrystalpt <crystalpt@svn>2010-07-16 05:30:35 +0000
committercrystalpt <crystalpt@svn>2010-07-16 05:30:35 +0000
commit6464b30ae1f2839c6a85b27190901621719a62b7 (patch)
tree0fc8af8d4a4eb9bd2748976d43aea162be33832f /guilib
parent4e9b332a6b4a26e137d274e3f89baef0b9df5f17 (diff)
[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
Diffstat (limited to 'guilib')
-rw-r--r--guilib/D3DResource.cpp4
-rw-r--r--guilib/GUIFontTTFDX.cpp3
2 files changed, 6 insertions, 1 deletions
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);