Module: wine Branch: master Commit: a4e5bcff4c66aa1041ea32f971b92b40d73e7d72 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a4e5bcff4c66aa1041ea32f971...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Feb 13 18:40:13 2012 +0100
wined3d: Use a format flag instead of a floating point comparison to determine if we need to apply heightscale.
---
dlls/wined3d/surface.c | 5 +++-- dlls/wined3d/utils.c | 3 ++- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 30dc63e..ac44194 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -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), diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 2ade261..e570a13 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -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); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 416d970..3cabe76 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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 {