Commit fd99ab78 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wined3d: Use draw_textured_quad in BltOverride.

parent 4bd627cc
......@@ -3964,7 +3964,6 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
return WINED3D_OK;
} else if(Src) {
/* Blit from offscreen surface to render target */
float glTexCoord[4];
DWORD oldCKeyFlags = Src->CKeyFlags;
WINEDDCOLORKEY oldBltCKey = Src->SrcBltCKey;
struct wined3d_context *context;
......@@ -4014,14 +4013,6 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
return WINED3D_OK;
}
if(!CalculateTexRect(Src, &SourceRectangle, glTexCoord)) {
/* Fall back to software */
WARN("(%p) Source texture area (%d,%d)-(%d,%d) is too big\n", Src,
SourceRectangle.left, SourceRectangle.top,
SourceRectangle.right, SourceRectangle.bottom);
return WINED3DERR_INVALIDCALL;
}
/* Color keying: Check if we have to do a color keyed blt,
* and if not check if a color key is activated.
*
......@@ -4083,22 +4074,6 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
ENTER_GL();
/* Bind the texture */
glBindTexture(Src->texture_target, Src->texture_name);
checkGLcall("glBindTexture");
/* Filtering for StretchRect */
glTexParameteri(Src->texture_target, GL_TEXTURE_MAG_FILTER,
wined3d_gl_mag_filter(magLookup, Filter));
checkGLcall("glTexParameteri");
glTexParameteri(Src->texture_target, GL_TEXTURE_MIN_FILTER,
wined3d_gl_min_mip_filter(minMipLookup, Filter, WINED3DTEXF_NONE));
checkGLcall("glTexParameteri");
glTexParameteri(Src->texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(Src->texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
checkGLcall("glTexEnvi");
/* This is for color keying */
if(Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) {
glEnable(GL_ALPHA_TEST);
......@@ -4119,32 +4094,13 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
/* Draw a textured quad
*/
glBegin(GL_QUADS);
glColor3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(glTexCoord[0], glTexCoord[2]);
glVertex3f(rect.x1, rect.y1, 0.0f);
glTexCoord2f(glTexCoord[0], glTexCoord[3]);
glVertex3f(rect.x1, rect.y2, 0.0f);
glTexCoord2f(glTexCoord[1], glTexCoord[3]);
glVertex3f(rect.x2, rect.y2, 0.0f);
glTexCoord2f(glTexCoord[1], glTexCoord[2]);
glVertex3f(rect.x2, rect.y1, 0.0f);
glEnd();
checkGLcall("glEnd");
draw_textured_quad(Src, &SourceRectangle, (RECT*)&rect, Filter);
if(Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) {
glDisable(GL_ALPHA_TEST);
checkGLcall("glDisable(GL_ALPHA_TEST)");
}
glBindTexture(Src->texture_target, 0);
checkGLcall("glBindTexture(Src->texture_target, 0)");
/* Restore the color key parameters */
Src->CKeyFlags = oldCKeyFlags;
Src->SrcBltCKey = oldBltCKey;
......
......@@ -2258,56 +2258,6 @@ DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) {
return size;
}
/***********************************************************************
* CalculateTexRect
*
* Calculates the dimensions of the opengl texture used for blits.
* Handled oversized opengl textures and updates the source rectangle
* accordingly
*
* Params:
* This: Surface to operate on
* Rect: Requested rectangle
*
* Returns:
* TRUE if the texture part can be loaded,
* FALSE otherwise
*
*********************************************************************/
BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4])
{
int x1 = Rect->left, x2 = Rect->right;
int y1 = Rect->top, y2 = Rect->bottom;
TRACE("(%p)->(%d,%d)-(%d,%d)\n", This,
Rect->left, Rect->top, Rect->right, Rect->bottom);
/* The sizes might be reversed */
if(Rect->left > Rect->right) {
x1 = Rect->right;
x2 = Rect->left;
}
if(Rect->top > Rect->bottom) {
y1 = Rect->bottom;
y2 = Rect->top;
}
/* Which rect from the texture do I need? */
if (This->texture_target == GL_TEXTURE_RECTANGLE_ARB)
{
glTexCoord[0] = (float) Rect->left;
glTexCoord[2] = (float) Rect->top;
glTexCoord[1] = (float) Rect->right;
glTexCoord[3] = (float) Rect->bottom;
} else {
glTexCoord[0] = (float) Rect->left / (float) This->pow2Width;
glTexCoord[2] = (float) Rect->top / (float) This->pow2Height;
glTexCoord[1] = (float) Rect->right / (float) This->pow2Width;
glTexCoord[3] = (float) Rect->bottom / (float) This->pow2Height;
}
return TRUE;
}
void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_settings *settings, BOOL ignore_textype) {
#define ARG1 0x01
#define ARG2 0x02
......
......@@ -2202,8 +2202,6 @@ void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back) DECLSPE
SFLAG_DS_OFFSCREEN)
#define SFLAG_DS_DISCARDED SFLAG_DS_LOCATIONS
BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]) DECLSPEC_HIDDEN;
typedef enum {
NO_CONVERSION,
CONVERT_PALETTED,
......
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