Fix errors with -rol and -ror, nw

This commit is contained in:
therealmogminer@gmail.com 2016-02-15 20:22:04 +01:00
parent 249b5f0b96
commit 622df200de
3 changed files with 56 additions and 33 deletions

View File

@ -442,7 +442,7 @@ void render_texture::hq_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const
// get_scaled - get a scaled bitmap (if we can)
//-------------------------------------------------
void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, bool packable)
void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, UINT32 flags)
{
texinfo.hash = 0;
@ -524,11 +524,7 @@ void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &t
}
UINT32 hash = 0;
if (packable)
{
//printf("Packable, %d, %d\n", texinfo.width, texinfo.height);
}
if (packable && texinfo.width <= 128 && texinfo.height <= 128)
if ((flags & PRIMFLAG_PACKABLE) && texinfo.width <= 128 && texinfo.height <= 128)
{
hash = reinterpret_cast<UINT64>(texinfo.base) & 0xffffffff;
}
@ -1764,7 +1760,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const
width = MIN(width, m_maxtexwidth);
height = MIN(height, m_maxtexheight);
curitem->texture()->get_scaled(width, height, prim->texture, list, (curitem->flags() & PRIMFLAG_PACKABLE) ? true : false);
curitem->texture()->get_scaled(width, height, prim->texture, list, curitem->flags());
// set the palette
prim->texture.palette = curitem->texture()->get_adjusted_palette(container);
@ -1867,7 +1863,7 @@ void render_target::add_element_primitives(render_primitive_list &list, const ob
// get the scaled texture and append it
texture->get_scaled(width, height, prim->texture, list, (prim->flags & PRIMFLAG_PACKABLE) ? true : false);
texture->get_scaled(width, height, prim->texture, list, prim->flags);
// compute the clip rect
render_bounds cliprect;

View File

@ -436,7 +436,7 @@ public:
private:
// internal helpers
void get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, bool packable = false);
void get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, UINT32 flags = 0);
const rgb_t *get_adjusted_palette(render_container &container);
static const int MAX_TEXTURE_SCALES = 16;

View File

@ -283,47 +283,74 @@ void renderer_bgfx::put_packed_quad(render_primitive *prim, UINT32 hash, PosColo
float v1 = v0 + float(rect.height()) / float(CACHE_SIZE);
UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255);
vertex[0].m_x = prim->bounds.x0;
vertex[0].m_y = prim->bounds.y0;
float x[4] = { prim->bounds.x0, prim->bounds.x1, prim->bounds.x0, prim->bounds.x1 };
float y[4] = { prim->bounds.y0, prim->bounds.y0, prim->bounds.y1, prim->bounds.y1 };
float u[4] = { u0, u1, u0, u1 };
float v[4] = { v0, v0, v1, v1 };
if (PRIMFLAG_GET_TEXORIENT(prim->flags) & ORIENTATION_SWAP_XY)
{
std::swap(u[1], u[2]);
std::swap(v[1], v[2]);
}
if (PRIMFLAG_GET_TEXORIENT(prim->flags) & ORIENTATION_FLIP_X)
{
std::swap(u[0], u[1]);
std::swap(v[0], v[1]);
std::swap(u[2], u[3]);
std::swap(v[2], v[3]);
}
if (PRIMFLAG_GET_TEXORIENT(prim->flags) & ORIENTATION_FLIP_Y)
{
std::swap(u[0], u[2]);
std::swap(v[0], v[2]);
std::swap(u[1], u[3]);
std::swap(v[1], v[3]);
}
vertex[0].m_x = x[0]; // 0
vertex[0].m_y = y[0];
vertex[0].m_z = 0;
vertex[0].m_rgba = rgba;
vertex[0].m_u = u0;
vertex[0].m_v = v0;
vertex[0].m_u = u[0];
vertex[0].m_v = v[0];
vertex[1].m_x = prim->bounds.x1;
vertex[1].m_y = prim->bounds.y0;
vertex[1].m_x = x[1]; // 1
vertex[1].m_y = y[1];
vertex[1].m_z = 0;
vertex[1].m_rgba = rgba;
vertex[1].m_u = u1;
vertex[1].m_v = v0;
vertex[1].m_u = u[1];
vertex[1].m_v = v[1];
vertex[2].m_x = prim->bounds.x1;
vertex[2].m_y = prim->bounds.y1;
vertex[2].m_x = x[3]; // 3
vertex[2].m_y = y[3];
vertex[2].m_z = 0;
vertex[2].m_rgba = rgba;
vertex[2].m_u = u1;
vertex[2].m_v = v1;
vertex[2].m_u = u[3];
vertex[2].m_v = v[3];
vertex[3].m_x = prim->bounds.x1;
vertex[3].m_y = prim->bounds.y1;
vertex[3].m_x = x[3]; // 3
vertex[3].m_y = y[3];
vertex[3].m_z = 0;
vertex[3].m_rgba = rgba;
vertex[3].m_u = u1;
vertex[3].m_v = v1;
vertex[3].m_u = u[3];
vertex[3].m_v = v[3];
vertex[4].m_x = prim->bounds.x0;
vertex[4].m_y = prim->bounds.y1;
vertex[4].m_x = x[2]; // 2
vertex[4].m_y = y[2];
vertex[4].m_z = 0;
vertex[4].m_rgba = rgba;
vertex[4].m_u = u0;
vertex[4].m_v = v1;
vertex[4].m_u = u[2];
vertex[4].m_v = v[2];
vertex[5].m_x = prim->bounds.x0;
vertex[5].m_y = prim->bounds.y0;
vertex[5].m_x = x[0]; // 0
vertex[5].m_y = y[0];
vertex[5].m_z = 0;
vertex[5].m_rgba = rgba;
vertex[5].m_u = u0;
vertex[5].m_v = v0;
vertex[5].m_u = u[0];
vertex[5].m_v = v[0];
}
void renderer_bgfx::render_textured_quad(int view, render_primitive* prim)