diff options
author | 2016-05-28 16:33:41 +0200 | |
---|---|---|
committer | 2016-05-28 16:33:59 +0200 | |
commit | 6af3202119cf7ca821a6102012d8efd7250c76bb (patch) | |
tree | f8c5bbbc9ee6563cb301612dca78b8701cf41b97 /src/emu/render.cpp | |
parent | f37e28476652722cce7fd349400c98d10083f97f (diff) |
Fixed MT06222
- fixed offset of vector lines and clipping rectangle when vector primitives are prepared to be rendered into a texture (HLSL) instead of directly on the screen (GDI, D3D)
Diffstat (limited to 'src/emu/render.cpp')
-rw-r--r-- | src/emu/render.cpp | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 2a6bd7e4760..f8cc9529f42 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -1376,7 +1376,7 @@ render_primitive_list &render_target::get_primitives() // if there is no associated element, it must be a screen element if (curitem.screen() != nullptr) - add_container_primitives(list, item_xform, curitem.screen()->container(), blendmode); + add_container_primitives(list, root_xform, item_xform, curitem.screen()->container(), blendmode); else add_element_primitives(list, item_xform, *curitem.element(), curitem.state(), blendmode); } @@ -1418,7 +1418,7 @@ render_primitive_list &render_target::get_primitives() ui_xform.no_center = true; // add UI elements - add_container_primitives(list, ui_xform, debug, BLENDMODE_ALPHA); + add_container_primitives(list, root_xform, ui_xform, debug, BLENDMODE_ALPHA); } // process the UI if we are the UI target @@ -1435,7 +1435,7 @@ render_primitive_list &render_target::get_primitives() ui_xform.no_center = false; // add UI elements - add_container_primitives(list, ui_xform, m_manager.ui_container(), BLENDMODE_ALPHA); + add_container_primitives(list, root_xform, ui_xform, m_manager.ui_container(), BLENDMODE_ALPHA); } // optimize the list before handing it off @@ -1745,7 +1745,7 @@ bool render_target::load_layout_file(const char *dirname, const char *filename) // based on the container //------------------------------------------------- -void render_target::add_container_primitives(render_primitive_list &list, const object_transform &xform, render_container &container, int blendmode) +void render_target::add_container_primitives(render_primitive_list &list, const object_transform &root_xform, const object_transform &xform, render_container &container, int blendmode) { // first update the palette for the container, if it is dirty container.update_palette(); @@ -1758,6 +1758,16 @@ void render_target::add_container_primitives(render_primitive_list &list, const cliprect.y1 = xform.yoffs + xform.yscale; sect_render_bounds(&cliprect, &m_bounds); + float root_xoffs = root_xform.xoffs + abs(root_xform.xscale - xform.xscale) * 0.5f; + float root_yoffs = root_xform.yoffs + abs(root_xform.yscale - xform.yscale) * 0.5f; + + render_bounds root_cliprect; + root_cliprect.x0 = root_xoffs; + root_cliprect.y0 = root_yoffs; + root_cliprect.x1 = root_xoffs + root_xform.xscale; + root_cliprect.y1 = root_yoffs + root_xform.yscale; + sect_render_bounds(&root_cliprect, &m_bounds); + // compute the container transform object_transform container_xform; container_xform.orientation = orientation_add(container.orientation(), xform.orientation); @@ -1797,22 +1807,32 @@ void render_target::add_container_primitives(render_primitive_list &list, const render_bounds bounds = curitem.bounds(); apply_orientation(bounds, container_xform.orientation); + float xscale = container_xform.xscale; + float yscale = container_xform.yscale; + float xoffs = container_xform.xoffs; + float yoffs = container_xform.yoffs; + if (!m_transform_container && PRIMFLAG_GET_VECTOR(curitem.flags())) + { + xoffs = root_xoffs; + yoffs = root_yoffs; + } + // allocate the primitive and set the transformed bounds/color data render_primitive *prim = list.alloc(render_primitive::INVALID); prim->container = &container; /* pass the container along for access to user_settings */ - prim->bounds.x0 = render_round_nearest(container_xform.xoffs + bounds.x0 * container_xform.xscale); - prim->bounds.y0 = render_round_nearest(container_xform.yoffs + bounds.y0 * container_xform.yscale); + prim->bounds.x0 = render_round_nearest(xoffs + bounds.x0 * xscale); + prim->bounds.y0 = render_round_nearest(yoffs + bounds.y0 * yscale); if (curitem.internal() & INTERNAL_FLAG_CHAR) { - prim->bounds.x1 = prim->bounds.x0 + render_round_nearest((bounds.x1 - bounds.x0) * container_xform.xscale); - prim->bounds.y1 = prim->bounds.y0 + render_round_nearest((bounds.y1 - bounds.y0) * container_xform.yscale); + prim->bounds.x1 = prim->bounds.x0 + render_round_nearest((bounds.x1 - bounds.x0) * xscale); + prim->bounds.y1 = prim->bounds.y0 + render_round_nearest((bounds.y1 - bounds.y0) * yscale); } else { - prim->bounds.x1 = render_round_nearest(container_xform.xoffs + bounds.x1 * container_xform.xscale); - prim->bounds.y1 = render_round_nearest(container_xform.yoffs + bounds.y1 * container_xform.yscale); + prim->bounds.x1 = render_round_nearest(xoffs + bounds.x1 * xscale); + prim->bounds.y1 = render_round_nearest(yoffs + bounds.y1 * yscale); } // compute the color of the primitive @@ -1841,7 +1861,14 @@ void render_target::add_container_primitives(render_primitive_list &list, const prim->flags |= curitem.flags(); // clip the primitive - clipped = render_clip_line(&prim->bounds, &cliprect); + if (!m_transform_container && PRIMFLAG_GET_VECTOR(curitem.flags())) + { + clipped = render_clip_line(&prim->bounds, &root_cliprect); + } + else + { + clipped = render_clip_line(&prim->bounds, &cliprect); + } break; case CONTAINER_ITEM_QUAD: |