ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

view.c
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009, 2011 Henri Verbeet for CodeWeavers
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  *
00018  */
00019 
00020 #include "config.h"
00021 #include "wine/port.h"
00022 
00023 #include "wined3d_private.h"
00024 
00025 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
00026 
00027 ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view)
00028 {
00029     ULONG refcount = InterlockedIncrement(&view->refcount);
00030 
00031     TRACE("%p increasing refcount to %u.\n", view, refcount);
00032 
00033     return refcount;
00034 }
00035 
00036 ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view)
00037 {
00038     ULONG refcount = InterlockedDecrement(&view->refcount);
00039 
00040     TRACE("%p decreasing refcount to %u.\n", view, refcount);
00041 
00042     if (!refcount)
00043         HeapFree(GetProcessHeap(), 0, view);
00044 
00045     return refcount;
00046 }
00047 
00048 void * CDECL wined3d_rendertarget_view_get_parent(const struct wined3d_rendertarget_view *view)
00049 {
00050     TRACE("view %p.\n", view);
00051 
00052     return view->parent;
00053 }
00054 
00055 struct wined3d_resource * CDECL wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view)
00056 {
00057     TRACE("view %p.\n", view);
00058 
00059     return view->resource;
00060 }
00061 
00062 static void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view,
00063         struct wined3d_resource *resource, void *parent)
00064 {
00065     view->refcount = 1;
00066     view->resource = resource;
00067     view->parent = parent;
00068 }
00069 
00070 HRESULT CDECL wined3d_rendertarget_view_create(struct wined3d_resource *resource,
00071         void *parent, struct wined3d_rendertarget_view **rendertarget_view)
00072 {
00073     struct wined3d_rendertarget_view *object;
00074 
00075     TRACE("resource %p, parent %p, rendertarget_view %p.\n",
00076             resource, parent, rendertarget_view);
00077 
00078     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
00079     if (!object)
00080     {
00081         ERR("Failed to allocate memory\n");
00082         return E_OUTOFMEMORY;
00083     }
00084 
00085     wined3d_rendertarget_view_init(object, resource, parent);
00086 
00087     TRACE("Created render target view %p.\n", object);
00088     *rendertarget_view = object;
00089 
00090     return WINED3D_OK;
00091 }

Generated on Sun May 27 2012 04:22:20 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.