summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorJosé Fonseca <jose.r.fonseca@gmail.com>2012-04-30 23:33:02 +0100
committerJosé Fonseca <jose.r.fonseca@gmail.com>2012-04-30 23:33:02 +0100
commit6d5372b819f636f36b6390158a1ccacb4ca95c28 (patch)
tree281e933d81b4f9acb1ebf0391e0a9c4fb251c330 /helpers
parent446b6df23a795e68dc76941e07bfd34ec295ff2a (diff)
Use same logic for both Lock and LockRect.
Diffstat (limited to 'helpers')
-rw-r--r--helpers/d3dsize.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/helpers/d3dsize.hpp b/helpers/d3dsize.hpp
index 97fccd3e..92503fe8 100644
--- a/helpers/d3dsize.hpp
+++ b/helpers/d3dsize.hpp
@@ -161,6 +161,36 @@ _formatSize(D3DFORMAT Format, UINT Width, UINT Height, INT Pitch) {
static inline size_t
+_getLockSize(IDirect3DVertexBuffer9 *pBuffer, UINT OffsetToLock, UINT SizeToLock, void ** ppbData) {
+ if (SizeToLock == 0) {
+ D3DVERTEXBUFFER_DESC Desc;
+ HRESULT hr = pBuffer->GetDesc(&Desc);
+ if (FAILED(hr)) {
+ return 0;
+ }
+ SizeToLock = Desc.Size;
+ }
+
+ return SizeToLock;
+}
+
+
+static inline size_t
+_getLockSize(IDirect3DIndexBuffer9 *pBuffer, UINT OffsetToLock, UINT SizeToLock, void ** ppbData) {
+ if (SizeToLock == 0) {
+ D3DINDEXBUFFER_DESC Desc;
+ HRESULT hr = pBuffer->GetDesc(&Desc);
+ if (FAILED(hr)) {
+ return 0;
+ }
+ SizeToLock = Desc.Size;
+ }
+
+ return SizeToLock;
+}
+
+
+static inline size_t
_getLockSize(IDirect3DSurface9 *pSurface, const D3DLOCKED_RECT *pLockedRect, const RECT *pRect) {
HRESULT hr;