oleaut: Reduce an ERR down to a WARN since a NULL interface pointer
[wine/multimedia.git] / dlls / d3dx8 / d3dxbuffer.c
blobbc25570d3fe035f8a55ce5dcb30f2cebc259b2b6
1 /*
2 * ID3DXBuffer implementation
4 * Copyright 2002 Raphael Junqueira
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "wingdi.h"
30 #include "wine/debug.h"
32 #include "d3d8.h"
33 #include "d3dx8core_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
37 /* ID3DXBuffer IUnknown parts follow: */
38 HRESULT WINAPI ID3DXBufferImpl_QueryInterface(LPD3DXBUFFER iface, REFIID riid, LPVOID* ppobj) {
39 ID3DXBufferImpl *This = (ID3DXBufferImpl *)iface;
41 if (IsEqualGUID(riid, &IID_IUnknown)
42 || IsEqualGUID(riid, &IID_ID3DXBuffer)) {
43 ID3DXBufferImpl_AddRef(iface);
44 *ppobj = This;
45 return D3D_OK;
48 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
49 return E_NOINTERFACE;
52 ULONG WINAPI ID3DXBufferImpl_AddRef(LPD3DXBUFFER iface) {
53 ID3DXBufferImpl *This = (ID3DXBufferImpl *)iface;
54 ULONG ref = InterlockedIncrement(&This->ref);
56 TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
58 return ref;
61 ULONG WINAPI ID3DXBufferImpl_Release(LPD3DXBUFFER iface) {
62 ID3DXBufferImpl *This = (ID3DXBufferImpl *)iface;
63 ULONG ref = InterlockedDecrement(&This->ref);
65 TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
67 if (ref == 0) {
68 HeapFree(GetProcessHeap(), 0, This->buffer);
69 HeapFree(GetProcessHeap(), 0, This);
71 return ref;
74 /* ID3DXBuffer Interface follow: */
75 LPVOID WINAPI ID3DXBufferImpl_GetBufferPointer(LPD3DXBUFFER iface) {
76 ID3DXBufferImpl *This = (ID3DXBufferImpl *)iface;
77 return This->buffer;
80 DWORD WINAPI ID3DXBufferImpl_GetBufferSize(LPD3DXBUFFER iface) {
81 ID3DXBufferImpl *This = (ID3DXBufferImpl *)iface;
82 return This->bufferSize;
85 const ID3DXBufferVtbl D3DXBuffer_Vtbl =
87 ID3DXBufferImpl_QueryInterface,
88 ID3DXBufferImpl_AddRef,
89 ID3DXBufferImpl_Release,
90 ID3DXBufferImpl_GetBufferPointer,
91 ID3DXBufferImpl_GetBufferSize