Commit 4beb9e59 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Move surface_get_drawable_size() to view.c file.

parent 9e443e95
......@@ -36,39 +36,6 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
static const DWORD surface_simple_locations = WINED3D_LOCATION_SYSMEM
| WINED3D_LOCATION_USER_MEMORY | WINED3D_LOCATION_BUFFER;
void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
unsigned int *width, unsigned int *height)
{
if (surface->container->swapchain)
{
/* The drawable size of an onscreen drawable is the surface size.
* (Actually: The window size, but the surface is created in window
* size.) */
*width = context->current_rt.texture->resource.width;
*height = context->current_rt.texture->resource.height;
}
else if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER)
{
const struct wined3d_swapchain *swapchain = context->swapchain;
/* The drawable size of a backbuffer / aux buffer offscreen target is
* the size of the current context's drawable, which is the size of
* the back buffer of the swapchain the active context belongs to. */
*width = swapchain->desc.backbuffer_width;
*height = swapchain->desc.backbuffer_height;
}
else
{
struct wined3d_surface *rt;
/* The drawable size of an FBO target is the OpenGL texture size,
* which is the power of two size. */
rt = context->current_rt.texture->sub_resources[context->current_rt.sub_resource_idx].u.surface;
*width = wined3d_texture_get_level_pow2_width(rt->container, rt->texture_level);
*height = wined3d_texture_get_level_pow2_height(rt->container, rt->texture_level);
}
}
struct blt_info
{
GLenum binding;
......
......@@ -94,6 +94,39 @@ struct wined3d_resource * CDECL wined3d_rendertarget_view_get_resource(const str
return view->resource;
}
void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
unsigned int *width, unsigned int *height)
{
if (surface->container->swapchain)
{
/* The drawable size of an onscreen drawable is the surface size.
* (Actually: The window size, but the surface is created in window
* size.) */
*width = context->current_rt.texture->resource.width;
*height = context->current_rt.texture->resource.height;
}
else if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER)
{
const struct wined3d_swapchain *swapchain = context->swapchain;
/* The drawable size of a backbuffer / aux buffer offscreen target is
* the size of the current context's drawable, which is the size of
* the back buffer of the swapchain the active context belongs to. */
*width = swapchain->desc.backbuffer_width;
*height = swapchain->desc.backbuffer_height;
}
else
{
struct wined3d_surface *rt;
/* The drawable size of an FBO target is the OpenGL texture size,
* which is the power of two size. */
rt = context->current_rt.texture->sub_resources[context->current_rt.sub_resource_idx].u.surface;
*width = wined3d_texture_get_level_pow2_width(rt->container, rt->texture_level);
*height = wined3d_texture_get_level_pow2_height(rt->container, rt->texture_level);
}
}
static HRESULT wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view,
const struct wined3d_rendertarget_view_desc *desc, struct wined3d_resource *resource,
void *parent, const struct wined3d_parent_ops *parent_ops)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment