summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/render.c
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-01-28 09:20:10 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2015-01-28 09:20:10 +0100
commit26e7a17b6326aa5a75a6276e52cf84a94c16d7a0 (patch)
treebab4468226c59d590688e0ece892f5bfbca58736 /src/emu/render.c
parent13b862c4fae88f0f819c2c4416d49249e4de45b9 (diff)
Cleanups and version bumpmame0158
Diffstat (limited to 'src/emu/render.c')
-rw-r--r--src/emu/render.c310
1 files changed, 155 insertions, 155 deletions
diff --git a/src/emu/render.c b/src/emu/render.c
index 014f85f8903..2370d015a35 100644
--- a/src/emu/render.c
+++ b/src/emu/render.c
@@ -207,62 +207,62 @@ inline item_layer get_layer_and_blendmode(const layout_view &view, int index, in
render_texinfo &render_texinfo::operator=(const render_texinfo &src)
{
- free_palette();
- base = src.base;
- rowpixels = src.rowpixels;
- width = src.width;
- height = src.height;
- seqid = src.seqid;
- osddata = src.osddata;
- m_palette = src.m_palette;
- if (m_palette != NULL)
- {
- m_palette->ref_count++;
- }
- return *this;
+ free_palette();
+ base = src.base;
+ rowpixels = src.rowpixels;
+ width = src.width;
+ height = src.height;
+ seqid = src.seqid;
+ osddata = src.osddata;
+ m_palette = src.m_palette;
+ if (m_palette != NULL)
+ {
+ m_palette->ref_count++;
+ }
+ return *this;
}
render_texinfo::render_texinfo(const render_texinfo &src)
{
- base = src.base;
- rowpixels = src.rowpixels;
- width = src.width;
- height = src.height;
- seqid = src.seqid;
- osddata = src.osddata;
- m_palette = src.m_palette;
- if (m_palette != NULL)
- {
- m_palette->ref_count++;
- }
+ base = src.base;
+ rowpixels = src.rowpixels;
+ width = src.width;
+ height = src.height;
+ seqid = src.seqid;
+ osddata = src.osddata;
+ m_palette = src.m_palette;
+ if (m_palette != NULL)
+ {
+ m_palette->ref_count++;
+ }
}
void render_texinfo::set_palette(const dynamic_array<rgb_t> *source)
{
- free_palette();
- if (source != NULL)
- {
- m_palette = global_alloc(render_palette_copy);
- m_palette->palette.copyfrom(*source);
- m_palette->ref_count = 1;
- }
- else
- {
- m_palette = NULL;
- }
+ free_palette();
+ if (source != NULL)
+ {
+ m_palette = global_alloc(render_palette_copy);
+ m_palette->palette.copyfrom(*source);
+ m_palette->ref_count = 1;
+ }
+ else
+ {
+ m_palette = NULL;
+ }
}
void render_texinfo::free_palette()
{
- if (m_palette != NULL)
- {
- m_palette->ref_count--;
- if (m_palette->ref_count == 0)
- {
- global_free(m_palette);
- }
- }
- m_palette = NULL;
+ if (m_palette != NULL)
+ {
+ m_palette->ref_count--;
+ if (m_palette->ref_count == 0)
+ {
+ global_free(m_palette);
+ }
+ }
+ m_palette = NULL;
}
@@ -277,31 +277,31 @@ void render_texinfo::free_palette()
void render_primitive::reset()
{
- // public state
- type = INVALID;
- bounds.x0 = 0;
- bounds.y0 = 0;
- bounds.x1 = 0;
- bounds.y1 = 0;
- color.a = 0;
- color.r = 0;
- color.g = 0;
- color.b = 0;
- flags = 0;
- width = 0.0f;
- texture.set_palette(NULL);
- texture = render_texinfo();
- texcoords.bl.u = 0.0f;
- texcoords.bl.v = 0.0f;
- texcoords.br.u = 0.0f;
- texcoords.br.v = 0.0f;
- texcoords.tl.u = 0.0f;
- texcoords.tl.v = 0.0f;
- texcoords.tr.u = 0.0f;
- texcoords.tr.v = 0.0f;
-
- // do not clear m_next!
- // memset(&type, 0, FPTR(&texcoords + 1) - FPTR(&type));
+ // public state
+ type = INVALID;
+ bounds.x0 = 0;
+ bounds.y0 = 0;
+ bounds.x1 = 0;
+ bounds.y1 = 0;
+ color.a = 0;
+ color.r = 0;
+ color.g = 0;
+ color.b = 0;
+ flags = 0;
+ width = 0.0f;
+ texture.set_palette(NULL);
+ texture = render_texinfo();
+ texcoords.bl.u = 0.0f;
+ texcoords.bl.v = 0.0f;
+ texcoords.br.u = 0.0f;
+ texcoords.br.v = 0.0f;
+ texcoords.tl.u = 0.0f;
+ texcoords.tl.v = 0.0f;
+ texcoords.tr.u = 0.0f;
+ texcoords.tr.v = 0.0f;
+
+ // do not clear m_next!
+ // memset(&type, 0, FPTR(&texcoords + 1) - FPTR(&type));
}
@@ -556,63 +556,63 @@ void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &t
texinfo.width = swidth;
texinfo.height = sheight;
// will be set later
- texinfo.set_palette(NULL);
+ texinfo.set_palette(NULL);
texinfo.seqid = ++m_curseq;
}
else
{
- // make sure we can recover the original argb32 bitmap
- bitmap_argb32 dummy;
- bitmap_argb32 &srcbitmap = (m_bitmap != NULL) ? downcast<bitmap_argb32 &>(*m_bitmap) : dummy;
-
- // is it a size we already have?
- scaled_texture *scaled = NULL;
- int scalenum;
- for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
- {
- scaled = &m_scaled[scalenum];
-
- // we need a non-NULL bitmap with matching dest size
- if (scaled->bitmap != NULL && dwidth == scaled->bitmap->width() && dheight == scaled->bitmap->height())
- break;
- }
-
- // did we get one?
- if (scalenum == ARRAY_LENGTH(m_scaled))
- {
- int lowest = -1;
-
- // didn't find one -- take the entry with the lowest seqnum
- for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
- if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap))
- lowest = scalenum;
- assert_always(lowest != -1, "Too many live texture instances!");
-
- // throw out any existing entries
- scaled = &m_scaled[lowest];
- if (scaled->bitmap != NULL)
- {
- m_manager->invalidate_all(scaled->bitmap);
- global_free(scaled->bitmap);
- }
-
- // allocate a new bitmap
- scaled->bitmap = global_alloc(bitmap_argb32(dwidth, dheight));
- scaled->seqid = ++m_curseq;
-
- // let the scaler do the work
- (*m_scaler)(*scaled->bitmap, srcbitmap, m_sbounds, m_param);
- }
-
- // finally fill out the new info
- primlist.add_reference(scaled->bitmap);
- texinfo.base = &scaled->bitmap->pix32(0);
- texinfo.rowpixels = scaled->bitmap->rowpixels();
- texinfo.width = dwidth;
- texinfo.height = dheight;
- // will be set later
- texinfo.set_palette(NULL);
- texinfo.seqid = scaled->seqid;
+ // make sure we can recover the original argb32 bitmap
+ bitmap_argb32 dummy;
+ bitmap_argb32 &srcbitmap = (m_bitmap != NULL) ? downcast<bitmap_argb32 &>(*m_bitmap) : dummy;
+
+ // is it a size we already have?
+ scaled_texture *scaled = NULL;
+ int scalenum;
+ for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
+ {
+ scaled = &m_scaled[scalenum];
+
+ // we need a non-NULL bitmap with matching dest size
+ if (scaled->bitmap != NULL && dwidth == scaled->bitmap->width() && dheight == scaled->bitmap->height())
+ break;
+ }
+
+ // did we get one?
+ if (scalenum == ARRAY_LENGTH(m_scaled))
+ {
+ int lowest = -1;
+
+ // didn't find one -- take the entry with the lowest seqnum
+ for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
+ if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap))
+ lowest = scalenum;
+ assert_always(lowest != -1, "Too many live texture instances!");
+
+ // throw out any existing entries
+ scaled = &m_scaled[lowest];
+ if (scaled->bitmap != NULL)
+ {
+ m_manager->invalidate_all(scaled->bitmap);
+ global_free(scaled->bitmap);
+ }
+
+ // allocate a new bitmap
+ scaled->bitmap = global_alloc(bitmap_argb32(dwidth, dheight));
+ scaled->seqid = ++m_curseq;
+
+ // let the scaler do the work
+ (*m_scaler)(*scaled->bitmap, srcbitmap, m_sbounds, m_param);
+ }
+
+ // finally fill out the new info
+ primlist.add_reference(scaled->bitmap);
+ texinfo.base = &scaled->bitmap->pix32(0);
+ texinfo.rowpixels = scaled->bitmap->rowpixels();
+ texinfo.width = dwidth;
+ texinfo.height = dheight;
+ // will be set later
+ texinfo.set_palette(NULL);
+ texinfo.seqid = scaled->seqid;
}
}
@@ -1817,26 +1817,26 @@ void render_target::add_container_primitives(render_primitive_list &list, const
height = MIN(height, m_maxtexheight);
curitem->texture()->get_scaled(width, height, prim->texture, list);
- // set the palette
+ // set the palette
#if 1
const dynamic_array<rgb_t> *adjusted_pal = curitem->texture()->get_adjusted_palette(container);
- prim->texture.set_palette(adjusted_pal);
+ prim->texture.set_palette(adjusted_pal);
#else
- prim->texture.palette = curitem->texture()->get_adjusted_palette(container);
+ prim->texture.palette = curitem->texture()->get_adjusted_palette(container);
#endif
- // determine UV coordinates and apply clipping
- prim->texcoords = oriented_texcoords[finalorient];
- clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
-
- // apply the final orientation from the quad flags and then build up the final flags
- prim->flags = (curitem->flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) |
- PRIMFLAG_TEXORIENT(finalorient) |
- PRIMFLAG_TEXFORMAT(curitem->texture()->format());
- if (blendmode != -1)
- prim->flags |= PRIMFLAG_BLENDMODE(blendmode);
- else
- prim->flags |= PRIMFLAG_BLENDMODE(PRIMFLAG_GET_BLENDMODE(curitem->flags()));
+ // determine UV coordinates and apply clipping
+ prim->texcoords = oriented_texcoords[finalorient];
+ clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
+
+ // apply the final orientation from the quad flags and then build up the final flags
+ prim->flags = (curitem->flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) |
+ PRIMFLAG_TEXORIENT(finalorient) |
+ PRIMFLAG_TEXFORMAT(curitem->texture()->format());
+ if (blendmode != -1)
+ prim->flags |= PRIMFLAG_BLENDMODE(blendmode);
+ else
+ prim->flags |= PRIMFLAG_BLENDMODE(PRIMFLAG_GET_BLENDMODE(curitem->flags()));
}
else
{
@@ -1876,15 +1876,15 @@ void render_target::add_container_primitives(render_primitive_list &list, const
(container_xform.orientation & ORIENTATION_SWAP_XY) ? width : height, prim->texture, list);
// determine UV coordinates
- prim->texcoords = oriented_texcoords[container_xform.orientation];
+ prim->texcoords = oriented_texcoords[container_xform.orientation];
- // set the flags and add it to the list
- prim->flags = PRIMFLAG_TEXORIENT(container_xform.orientation) |
- PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY) |
- PRIMFLAG_TEXFORMAT(container.overlay()->format()) |
- PRIMFLAG_TEXSHADE(1);
+ // set the flags and add it to the list
+ prim->flags = PRIMFLAG_TEXORIENT(container_xform.orientation) |
+ PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY) |
+ PRIMFLAG_TEXFORMAT(container.overlay()->format()) |
+ PRIMFLAG_TEXSHADE(1);
- list.append_or_return(*prim, false);
+ list.append_or_return(*prim, false);
}
}
@@ -1925,17 +1925,17 @@ void render_target::add_element_primitives(render_primitive_list &list, const ob
texture->get_scaled(width, height, prim->texture, list);
- // compute the clip rect
- render_bounds cliprect;
- cliprect.x0 = render_round_nearest(xform.xoffs);
- cliprect.y0 = render_round_nearest(xform.yoffs);
- cliprect.x1 = render_round_nearest(xform.xoffs + xform.xscale);
- cliprect.y1 = render_round_nearest(xform.yoffs + xform.yscale);
- sect_render_bounds(&cliprect, &m_bounds);
-
- // determine UV coordinates and apply clipping
- prim->texcoords = oriented_texcoords[xform.orientation];
- bool clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
+ // compute the clip rect
+ render_bounds cliprect;
+ cliprect.x0 = render_round_nearest(xform.xoffs);
+ cliprect.y0 = render_round_nearest(xform.yoffs);
+ cliprect.x1 = render_round_nearest(xform.xoffs + xform.xscale);
+ cliprect.y1 = render_round_nearest(xform.yoffs + xform.yscale);
+ sect_render_bounds(&cliprect, &m_bounds);
+
+ // determine UV coordinates and apply clipping
+ prim->texcoords = oriented_texcoords[xform.orientation];
+ bool clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
// add to the list or free if we're clipped out
list.append_or_return(*prim, clipped);