wined3d: Use a format flag instead of a floating point comparison to determine if we need to apply heightscale.

This commit is contained in:
Henri Verbeet 2012-02-13 18:40:13 +01:00 committed by Alexandre Julliard
parent bea7032687
commit a4e5bcff4c
3 changed files with 6 additions and 3 deletions

View File

@ -2281,7 +2281,7 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
surface->flags |= SFLAG_PIN_SYSMEM;
}
if (format->heightscale != 1.0f && format->heightscale != 0.0f)
if (format->flags & WINED3DFMT_FLAG_HEIGHT_SCALE)
update_h *= format->heightscale;
ENTER_GL();
@ -2516,7 +2516,8 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru
internal = format->glInternal;
}
if (format->heightscale != 1.0f && format->heightscale != 0.0f) height *= format->heightscale;
if (format->flags & WINED3DFMT_FLAG_HEIGHT_SCALE)
height *= format->heightscale;
TRACE("(%p) : Creating surface (target %#x) level %d, d3d format %s, internal format %#x, width %d, height %d, gl format %#x, gl type=%#x\n",
surface, surface->texture_target, surface->texture_level, debug_d3dformat(format->id),

View File

@ -1580,6 +1580,7 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
}
idx = getFmtIdx(WINED3DFMT_YV12);
gl_info->formats[idx].flags |= WINED3DFMT_FLAG_HEIGHT_SCALE;
gl_info->formats[idx].heightscale = 1.5f;
gl_info->formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YV12);
@ -1705,7 +1706,7 @@ UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT ali
size = height * (((width * format->byte_count) + alignment - 1) & ~(alignment - 1));
}
if (format->heightscale != 0.0f)
if (format->flags & WINED3DFMT_FLAG_HEIGHT_SCALE)
{
/* The D3D format requirements make sure that the resulting format is an integer again */
size = (UINT) (size * format->heightscale);

View File

@ -2800,6 +2800,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_COMPRESSED 0x00008000
#define WINED3DFMT_FLAG_BROKEN_PITCH 0x00010000
#define WINED3DFMT_FLAG_BLOCKS 0x00020000
#define WINED3DFMT_FLAG_HEIGHT_SCALE 0x00040000
struct wined3d_format
{