VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/view.c@ 46966

Last change on this file since 46966 was 46521, checked in by vboxsync, 12 years ago

wine/new: export

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/*
2 * Copyright 2009, 2011 Henri Verbeet for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 *
18 */
19
20#include "config.h"
21#include "wine/port.h"
22
23#include "wined3d_private.h"
24
25WINE_DEFAULT_DEBUG_CHANNEL(d3d);
26
27ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view)
28{
29 ULONG refcount = InterlockedIncrement(&view->refcount);
30
31 TRACE("%p increasing refcount to %u.\n", view, refcount);
32
33 return refcount;
34}
35
36ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view)
37{
38 ULONG refcount = InterlockedDecrement(&view->refcount);
39
40 TRACE("%p decreasing refcount to %u.\n", view, refcount);
41
42 if (!refcount)
43 HeapFree(GetProcessHeap(), 0, view);
44
45 return refcount;
46}
47
48void * CDECL wined3d_rendertarget_view_get_parent(const struct wined3d_rendertarget_view *view)
49{
50 TRACE("view %p.\n", view);
51
52 return view->parent;
53}
54
55struct wined3d_resource * CDECL wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view)
56{
57 TRACE("view %p.\n", view);
58
59 return view->resource;
60}
61
62static void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view,
63 struct wined3d_resource *resource, void *parent)
64{
65 view->refcount = 1;
66 view->resource = resource;
67 view->parent = parent;
68}
69
70HRESULT CDECL wined3d_rendertarget_view_create(struct wined3d_resource *resource,
71 void *parent, struct wined3d_rendertarget_view **rendertarget_view)
72{
73 struct wined3d_rendertarget_view *object;
74
75 TRACE("resource %p, parent %p, rendertarget_view %p.\n",
76 resource, parent, rendertarget_view);
77
78 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
79 if (!object)
80 return E_OUTOFMEMORY;
81
82 wined3d_rendertarget_view_init(object, resource, parent);
83
84 TRACE("Created render target view %p.\n", object);
85 *rendertarget_view = object;
86
87 return WINED3D_OK;
88}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette