Previous 199869 Revisions Next

r17670 Thursday 6th September, 2012 at 06:19:32 UTC by Aaron Giles
gfx_element is now a class. Accessors are provided for all
necessary elements. Updated some of the more, ah, creative
uses/abuses of the gfx_elements. [Aaron Giles]
[src/emu]drawgfx.c drawgfx.h drawgfxm.h emupal.c emupal.h tilemap.c tilemap.h uigfx.c video.c
[src/emu/machine]tc009xlvc.c
[src/mame/drivers]1945kiii.c ace.c acefruit.c amaticmg.c aristmk4.c avt.c blackt96.c bmcpokr.c bnstars.c buster.c chsuper.c cmmb.c coinmvga.c coolridr.c cps3.c cvs.c cybertnk.c cyclemb.c ddealer.c deco_ld.c dmndrby.c dominob.c dreamwld.c drtomy.c fastfred.c flipjack.c galaxian.c gamecstl.c igs017.c jackpool.c jclub2.c liberate.c limenko.c mastboy.c mediagx.c mirax.c mogura.c mpoker.c mpu4vid.c murogmbl.c mwarr.c namcoic.c namcos23.c neoprint.c pgm.c pinkiri8.c poo.c powerbal.c rabbit.c raiden2.c rgum.c segas16b.c segas18.c srmp5.c srmp6.c ssv.c sub.c summit.c suprnova.c taito_l.c tasman.c tmmjprd.c trvmadns.c vamphalf.c vpoker.c
[src/mame/includes]namcos2.h
[src/mame/machine]atarigen.c megacd.c
[src/mame/video]aerofgt.c angelkds.c appoooh.c arcadecl.c armedf.c atarimo.c atarisy1.c bankp.c battlera.c battlex.c bbusters.c bigstrkb.c bionicc.c btime.c buggychl.c bwing.c cave.c cclimber.c champbas.c cheekyms.c circus.c combatsc.c ddragon.c deco32.c deco_mlc.c decocass.c djmain.c docastle.c drgnmst.c equites.c exerion.c f1gp.c fcombat.c finalizr.c fitfight.c flower.c foodf.c fuukifg2.c fuukifg3.c gaelco.c gaelco2.c gaiden.c galaxold.c gaplus.c glass.c gng.c goldstar.c gottlieb.c gp9001.c gradius3.c grchamp.c hng64.c hyprduel.c jalblend.c jalblend.h kaneko_spr.c kaneko_spr.h kickgoal.c kncljoe.c konamigx.c konamiic.c konicdev.c lemmings.c m10.c m52.c macrossp.c madalien.c mainsnk.c marineb.c mcr.c mcr68.c mermaid.c metro.c mrflea.c ms32.c mugsmash.c munchmo.c mustache.c mystston.c mystwarr.c namcona1.c namcos1.c namcos22.c namcos86.c nemesis.c ninjakd2.c nova2001.c oneshot.c othunder.c pacland.c pirates.c playmark.c plygonet.c polepos.c polyplay.c psikyo4.c psikyosh.c rainbow.c relief.c rungun.c sderby.c segag80r.c segaic24.c seibuspi.c seta.c seta2.c shadfrce.c shangkid.c shootout.c sidearms.c silkroad.c slapshot.c snk.c snk6502.c snk68.c spbactn.c spdodgeb.c speedspn.c splash.c sprint2.c sprint4.c sslam.c ssv.c st0016.c st0020.c starshp1.c stlforce.c stvvdp2.c suprnova.c suprslam.c tail2nos.c taito_f2.c taito_f3.c taito_l.c taitoic.c taitojc.c taitosj.c taotaido.c targeth.c tatsumi.c tceptor.c tecmo16.c terracre.c tetrisp2.c thepit.c thoop2.c tiamc1.c toaplan1.c toaplan2.c tryout.c ultratnk.c usgames.c vball.c vulgus.c wecleman.c wgp.c williams.c wrally.c wwfsstar.c wwfwfest.c xevious.c xxmissio.c zac2650.c zaxxon.c
[src/mess/drivers]a5105.c b16.c fp6000.c jr200.c mz2500.c paso1600.c pc88va.c pv1000.c smc777.c supracan.c vboy.c x1.c
[src/mess/machine]cgenie.c
[src/mess/video]911_vdt.c apple1.c cbmb.c iq151_video32.c iq151_video64.c mz700.c vdc8563.c x68k.c

trunk/src/mame/machine/megacd.c
r17669r17670
19111911
19121912static void segacd_mark_tiles_dirty(running_machine& machine, int offset)
19131913{
1914   gfx_element_mark_dirty(machine.gfx[0], (offset*2)/(SEGACD_BYTES_PER_TILE16));
1915   gfx_element_mark_dirty(machine.gfx[1], (offset*2)/(SEGACD_BYTES_PER_TILE16));
1916   gfx_element_mark_dirty(machine.gfx[2], (offset*2)/(SEGACD_BYTES_PER_TILE16));
1917   gfx_element_mark_dirty(machine.gfx[3], (offset*2)/(SEGACD_BYTES_PER_TILE16));
1918   gfx_element_mark_dirty(machine.gfx[4], (offset*2)/(SEGACD_BYTES_PER_TILE16));
1919   gfx_element_mark_dirty(machine.gfx[5], (offset*2)/(SEGACD_BYTES_PER_TILE16));
1920   gfx_element_mark_dirty(machine.gfx[6], (offset*2)/(SEGACD_BYTES_PER_TILE16));
1921   gfx_element_mark_dirty(machine.gfx[7], (offset*2)/(SEGACD_BYTES_PER_TILE16));
1914   machine.gfx[0]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16));
1915   machine.gfx[1]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16));
1916   machine.gfx[2]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16));
1917   machine.gfx[3]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16));
1918   machine.gfx[4]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16));
1919   machine.gfx[5]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16));
1920   machine.gfx[6]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16));
1921   machine.gfx[7]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE16));
19221922
1923   gfx_element_mark_dirty(machine.gfx[8], (offset*2)/(SEGACD_BYTES_PER_TILE32));
1924   gfx_element_mark_dirty(machine.gfx[9], (offset*2)/(SEGACD_BYTES_PER_TILE32));
1925   gfx_element_mark_dirty(machine.gfx[10],(offset*2)/(SEGACD_BYTES_PER_TILE32));
1926   gfx_element_mark_dirty(machine.gfx[11],(offset*2)/(SEGACD_BYTES_PER_TILE32));
1927   gfx_element_mark_dirty(machine.gfx[12],(offset*2)/(SEGACD_BYTES_PER_TILE32));
1928   gfx_element_mark_dirty(machine.gfx[13],(offset*2)/(SEGACD_BYTES_PER_TILE32));
1929   gfx_element_mark_dirty(machine.gfx[14],(offset*2)/(SEGACD_BYTES_PER_TILE32));
1930   gfx_element_mark_dirty(machine.gfx[15],(offset*2)/(SEGACD_BYTES_PER_TILE32));
1923   machine.gfx[8]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32));
1924   machine.gfx[9]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32));
1925   machine.gfx[10]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32));
1926   machine.gfx[11]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32));
1927   machine.gfx[12]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32));
1928   machine.gfx[13]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32));
1929   machine.gfx[14]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32));
1930   machine.gfx[15]->mark_dirty((offset*2)/(SEGACD_BYTES_PER_TILE32));
19311931}
19321932
19331933
r17669r17670
20722072   int tile_region, tileno;
20732073   SCD_GET_TILE_INFO_16x16_1x1(tile_region,tileno,(int)tile_index);
20742074
2075   const gfx_element *gfx = machine.gfx[tile_region];
2076   tileno %= gfx->total_elements;
2075   gfx_element *gfx = machine.gfx[tile_region];
2076   tileno %= gfx->elements();
20772077
20782078   if (tileno==0) return 0x00;
20792079
2080   const UINT8* srcdata = gfx_element_get_data(gfx, tileno);
2080   const UINT8* srcdata = gfx->get_data(tileno);
20812081   return srcdata[((ypos&((1<<tilesize)-1))*(1<<tilesize))+(xpos&((1<<tilesize)-1))];
20822082}
20832083
r17669r17670
21112111   int tile_region, tileno;
21122112   SCD_GET_TILE_INFO_32x32_1x1(tile_region,tileno,(int)tile_index);
21132113
2114   const gfx_element *gfx = machine.gfx[tile_region];
2115   tileno %= gfx->total_elements;
2114   gfx_element *gfx = machine.gfx[tile_region];
2115   tileno %= gfx->elements();
21162116
21172117   if (tileno==0) return 0x00; // does this apply in this mode?
21182118
2119   const UINT8* srcdata = gfx_element_get_data(gfx, tileno);
2119   const UINT8* srcdata = gfx->get_data(tileno);
21202120   return srcdata[((ypos&((1<<tilesize)-1))*(1<<tilesize))+(xpos&((1<<tilesize)-1))];
21212121}
21222122
r17669r17670
21502150   int tile_region, tileno;
21512151   SCD_GET_TILE_INFO_16x16_16x16(tile_region,tileno,(int)tile_index);
21522152
2153   const gfx_element *gfx = machine.gfx[tile_region];
2154   tileno %= gfx->total_elements;
2153   gfx_element *gfx = machine.gfx[tile_region];
2154   tileno %= gfx->elements();
21552155
21562156   if (tileno==0) return 0x00; // does this apply in this mode
21572157
2158   const UINT8* srcdata = gfx_element_get_data(gfx, tileno);
2158   const UINT8* srcdata = gfx->get_data(tileno);
21592159   return srcdata[((ypos&((1<<tilesize)-1))*(1<<tilesize))+(xpos&((1<<tilesize)-1))];
21602160}
21612161
r17669r17670
21892189   int tile_region, tileno;
21902190   SCD_GET_TILE_INFO_32x32_16x16(tile_region,tileno,(int)tile_index);
21912191
2192   const gfx_element *gfx = machine.gfx[tile_region];
2193   tileno %= gfx->total_elements;
2192   gfx_element *gfx = machine.gfx[tile_region];
2193   tileno %= gfx->elements();
21942194
21952195   if (tileno==0) return 0x00;
21962196
2197   const UINT8* srcdata = gfx_element_get_data(gfx, tileno);
2197   const UINT8* srcdata = gfx->get_data(tileno);
21982198   return srcdata[((ypos&((1<<tilesize)-1))*(1<<tilesize))+(xpos&((1<<tilesize)-1))];
21992199}
22002200
r17669r17670
22862286
22872287
22882288   /* create the char set (gfx will then be updated dynamically from RAM) */
2289   machine.gfx[0] = gfx_element_alloc(machine, &sega_16x16_r00_f0_layout, (UINT8 *)segacd_dataram, 0, 0);
2290   machine.gfx[1] = gfx_element_alloc(machine, &sega_16x16_r01_f0_layout, (UINT8 *)segacd_dataram, 0, 0);
2291   machine.gfx[2] = gfx_element_alloc(machine, &sega_16x16_r10_f0_layout, (UINT8 *)segacd_dataram, 0, 0);
2292   machine.gfx[3] = gfx_element_alloc(machine, &sega_16x16_r11_f0_layout, (UINT8 *)segacd_dataram, 0, 0);
2293   machine.gfx[4] = gfx_element_alloc(machine, &sega_16x16_r00_f1_layout, (UINT8 *)segacd_dataram, 0, 0);
2294   machine.gfx[5] = gfx_element_alloc(machine, &sega_16x16_r11_f1_layout, (UINT8 *)segacd_dataram, 0, 0);
2295   machine.gfx[6] = gfx_element_alloc(machine, &sega_16x16_r10_f1_layout, (UINT8 *)segacd_dataram, 0, 0);
2296   machine.gfx[7] = gfx_element_alloc(machine, &sega_16x16_r01_f1_layout, (UINT8 *)segacd_dataram, 0, 0);
2289   machine.gfx[0] = auto_alloc(machine, gfx_element(machine, sega_16x16_r00_f0_layout, (UINT8 *)segacd_dataram, 0, 0));
2290   machine.gfx[1] = auto_alloc(machine, gfx_element(machine, sega_16x16_r01_f0_layout, (UINT8 *)segacd_dataram, 0, 0));
2291   machine.gfx[2] = auto_alloc(machine, gfx_element(machine, sega_16x16_r10_f0_layout, (UINT8 *)segacd_dataram, 0, 0));
2292   machine.gfx[3] = auto_alloc(machine, gfx_element(machine, sega_16x16_r11_f0_layout, (UINT8 *)segacd_dataram, 0, 0));
2293   machine.gfx[4] = auto_alloc(machine, gfx_element(machine, sega_16x16_r00_f1_layout, (UINT8 *)segacd_dataram, 0, 0));
2294   machine.gfx[5] = auto_alloc(machine, gfx_element(machine, sega_16x16_r11_f1_layout, (UINT8 *)segacd_dataram, 0, 0));
2295   machine.gfx[6] = auto_alloc(machine, gfx_element(machine, sega_16x16_r10_f1_layout, (UINT8 *)segacd_dataram, 0, 0));
2296   machine.gfx[7] = auto_alloc(machine, gfx_element(machine, sega_16x16_r01_f1_layout, (UINT8 *)segacd_dataram, 0, 0));
22972297
2298   machine.gfx[8] = gfx_element_alloc(machine, &sega_32x32_r00_f0_layout, (UINT8 *)segacd_dataram, 0, 0);
2299   machine.gfx[9] = gfx_element_alloc(machine, &sega_32x32_r01_f0_layout, (UINT8 *)segacd_dataram, 0, 0);
2300   machine.gfx[10]= gfx_element_alloc(machine, &sega_32x32_r10_f0_layout, (UINT8 *)segacd_dataram, 0, 0);
2301   machine.gfx[11]= gfx_element_alloc(machine, &sega_32x32_r11_f0_layout, (UINT8 *)segacd_dataram, 0, 0);
2302   machine.gfx[12]= gfx_element_alloc(machine, &sega_32x32_r00_f1_layout, (UINT8 *)segacd_dataram, 0, 0);
2303   machine.gfx[13]= gfx_element_alloc(machine, &sega_32x32_r11_f1_layout, (UINT8 *)segacd_dataram, 0, 0);
2304   machine.gfx[14]= gfx_element_alloc(machine, &sega_32x32_r10_f1_layout, (UINT8 *)segacd_dataram, 0, 0);
2305   machine.gfx[15]= gfx_element_alloc(machine, &sega_32x32_r01_f1_layout, (UINT8 *)segacd_dataram, 0, 0);
2298   machine.gfx[8] = auto_alloc(machine, gfx_element(machine, sega_32x32_r00_f0_layout, (UINT8 *)segacd_dataram, 0, 0));
2299   machine.gfx[9] = auto_alloc(machine, gfx_element(machine, sega_32x32_r01_f0_layout, (UINT8 *)segacd_dataram, 0, 0));
2300   machine.gfx[10]= auto_alloc(machine, gfx_element(machine, sega_32x32_r10_f0_layout, (UINT8 *)segacd_dataram, 0, 0));
2301   machine.gfx[11]= auto_alloc(machine, gfx_element(machine, sega_32x32_r11_f0_layout, (UINT8 *)segacd_dataram, 0, 0));
2302   machine.gfx[12]= auto_alloc(machine, gfx_element(machine, sega_32x32_r00_f1_layout, (UINT8 *)segacd_dataram, 0, 0));
2303   machine.gfx[13]= auto_alloc(machine, gfx_element(machine, sega_32x32_r11_f1_layout, (UINT8 *)segacd_dataram, 0, 0));
2304   machine.gfx[14]= auto_alloc(machine, gfx_element(machine, sega_32x32_r10_f1_layout, (UINT8 *)segacd_dataram, 0, 0));
2305   machine.gfx[15]= auto_alloc(machine, gfx_element(machine, sega_32x32_r01_f1_layout, (UINT8 *)segacd_dataram, 0, 0));
23062306
23072307   segacd_stampmap[0] = tilemap_create(machine, get_stampmap_16x16_1x1_tile_info, TILEMAP_SCAN_ROWS, 16, 16, 16, 16);
23082308   segacd_stampmap[1] = tilemap_create(machine, get_stampmap_32x32_1x1_tile_info, TILEMAP_SCAN_ROWS, 32, 32, 8, 8);
trunk/src/mame/machine/atarigen.c
r17669r17670
15161516   int c, x, y;
15171517
15181518   /* allocate memory for the assembled data */
1519   srcdata = auto_alloc_array(machine, UINT8, gx0->total_elements * gx0->width * gx0->height);
1519   srcdata = auto_alloc_array(machine, UINT8, gx0->elements() * gx0->width() * gx0->height());
15201520
15211521   /* loop over elements */
15221522   dest = srcdata;
1523   for (c = 0; c < gx0->total_elements; c++)
1523   for (c = 0; c < gx0->elements(); c++)
15241524   {
1525      const UINT8 *c0base = gfx_element_get_data(gx0, c);
1526      const UINT8 *c1base = gfx_element_get_data(gx1, c);
1525      const UINT8 *c0base = gx0->get_data(c);
1526      const UINT8 *c1base = gx1->get_data(c);
15271527
15281528      /* loop over height */
1529      for (y = 0; y < gx0->height; y++)
1529      for (y = 0; y < gx0->height(); y++)
15301530      {
15311531         const UINT8 *c0 = c0base;
15321532         const UINT8 *c1 = c1base;
15331533
1534         for (x = 0; x < gx0->width; x++)
1534         for (x = 0; x < gx0->width(); x++)
15351535            *dest++ = (*c0++ & mask0) | (*c1++ & mask1);
1536         c0base += gx0->line_modulo;
1537         c1base += gx1->line_modulo;
1536         c0base += gx0->rowbytes();
1537         c1base += gx1->rowbytes();
15381538      }
15391539   }
1540   
1541//   int newdepth = gx0->depth() * gx1->depth();
1542   int granularity = gx0->granularity();
1543   gx0->set_raw_layout(srcdata, gx0->width(), gx0->height(), gx0->elements(), 8 * gx0->width(), 8 * gx0->width() * gx0->height());
1544   gx0->set_granularity(granularity);
15401545
15411546   /* free the second graphics element */
1542   gfx_element_free(gx1);
15431547   machine.gfx[gfx1] = NULL;
1544
1545   /* create a simple target layout */
1546   gx0->layout.planes = 8;
1547   for (x = 0; x < 8; x++)
1548      gx0->layout.planeoffset[x] = x;
1549   for (x = 0; x < gx0->width; x++)
1550      gx0->layout.xoffset[x] = 8 * x;
1551   for (y = 0; y < gx0->height; y++)
1552      gx0->layout.yoffset[y] = 8 * y * gx0->width;
1553   gx0->layout.charincrement = 8 * gx0->width * gx0->height;
1554
1555   /* make the assembled data our new source data */
1556   gfx_element_set_source(gx0, srcdata);
1548   auto_free(machine, gx1);
15571549}
15581550
15591551
trunk/src/mame/includes/namcos2.h
r17669r17670
170170
171171public:
172172   // general
173   void zdrawgfxzoom(bitmap_ind16 &dest_bmp, const rectangle &clip, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy, int scalex, int scaley, int zpos);
174   void zdrawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangle &clip, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy, int scalex, int scaley, int zpos);
173   void zdrawgfxzoom(bitmap_ind16 &dest_bmp, const rectangle &clip, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy, int scalex, int scaley, int zpos);
174   void zdrawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangle &clip, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy, int scalex, int scaley, int zpos);
175175};
176176
177177class namcos2_state : public namcos2_shared_state
trunk/src/mame/video/targeth.c
r17669r17670
108108{
109109   targeth_state *state = machine.driver_data<targeth_state>();
110110   int i;
111   const gfx_element *gfx = machine.gfx[0];
111   gfx_element *gfx = machine.gfx[0];
112112
113113   for (i = 3; i < (0x1000 - 6)/2; i += 4){
114114      int sx = state->m_spriteram[i+2] & 0x03ff;
trunk/src/mame/video/rainbow.c
r17669r17670
108108   for (offs = state->m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8)
109109   {
110110      int tile = spriteram[offs];
111      if (tile < screen.machine().gfx[1]->total_elements)
111      if (tile < screen.machine().gfx[1]->elements())
112112      {
113113         int sx,sy,color,data1;
114114
trunk/src/mame/video/xevious.c
r17669r17670
2828{
2929   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3030   int i;
31   #define TOTAL_COLORS(gfxn) (machine.gfx[gfxn]->total_colors * machine.gfx[gfxn]->color_granularity)
31   #define TOTAL_COLORS(gfxn) (machine.gfx[gfxn]->colors() * machine.gfx[gfxn]->granularity())
3232
3333   machine.colortable = colortable_alloc(machine, 128+1);
3434
r17669r17670
6969   /* background tiles */
7070   for (i = 0;i < TOTAL_COLORS(1);i++)
7171   {
72      colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + i,
72      colortable_entry_set_value(machine.colortable, machine.gfx[1]->colorbase() + i,
7373            (color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(1)] & 0x0f) << 4));
7474
7575      color_prom++;
r17669r17670
8181   {
8282      int c = (color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(2)] & 0x0f) << 4);
8383
84      colortable_entry_set_value(machine.colortable, machine.gfx[2]->color_base + i,
84      colortable_entry_set_value(machine.colortable, machine.gfx[2]->colorbase() + i,
8585            (c & 0x80) ? (c & 0x7f) : 0x80);
8686
8787      color_prom++;
r17669r17670
9191   /* foreground characters */
9292   for (i = 0;i < TOTAL_COLORS(0);i++)
9393   {
94      colortable_entry_set_value(machine.colortable, machine.gfx[0]->color_base + i,
94      colortable_entry_set_value(machine.colortable, machine.gfx[0]->colorbase() + i,
9595            (i % 2 != 0) ? (i / 2) : 0x80);
9696   }
9797}
r17669r17670
142142   /* background tiles */
143143   for (i = 0;i < TOTAL_COLORS(1);i++)
144144   {
145      colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + i,
145      colortable_entry_set_value(machine.colortable, machine.gfx[1]->colorbase() + i,
146146            (color_prom[0] & 0x0f) | ((color_prom[0x400] & 0x0f) << 4));
147147
148148      color_prom++;
r17669r17670
154154   {
155155      int c = (color_prom[0] & 0x0f) | ((color_prom[0x400] & 0x0f) << 4);
156156
157      colortable_entry_set_value(machine.colortable, machine.gfx[2]->color_base + i,
157      colortable_entry_set_value(machine.colortable, machine.gfx[2]->colorbase() + i,
158158            (c & 0x80) ? (c & 0x7f) : 0x80);
159159
160160      color_prom++;
r17669r17670
163163   /* foreground characters */
164164   for (i = 0;i < TOTAL_COLORS(0);i++)
165165   {
166      colortable_entry_set_value(machine.colortable, machine.gfx[0]->color_base + i,
166      colortable_entry_set_value(machine.colortable, machine.gfx[0]->colorbase() + i,
167167            (i % 2 != 0) ? (i / 2) : 0x80);
168168   }
169169}
trunk/src/mame/video/deco_mlc.c
r17669r17670
2020VIDEO_START( mlc )
2121{
2222   deco_mlc_state *state = machine.driver_data<deco_mlc_state>();
23   if (machine.gfx[0]->color_granularity==16)
23   if (machine.gfx[0]->granularity()==16)
2424      state->m_colour_mask=0x7f;
25   else if (machine.gfx[0]->color_granularity==32)
25   else if (machine.gfx[0]->granularity()==32)
2626      state->m_colour_mask=0x3f;
2727   else
2828      state->m_colour_mask=0x1f;
r17669r17670
6262#endif
6363
6464static void mlc_drawgfxzoom(
65      bitmap_rgb32 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
65      bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
6666      UINT32 code1,UINT32 code2, UINT32 color,int flipx,int flipy,int sx,int sy,
6767      int transparent_color,int use8bpp,
6868      int scalex, int scaley,int alpha)
r17669r17670
8585   {
8686      if( gfx )
8787      {
88         const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
89         const UINT8 *code_base1 = gfx_element_get_data(gfx, code1 % gfx->total_elements);
90         const UINT8 *code_base2 = gfx_element_get_data(gfx, code2 % gfx->total_elements);
88         const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
89         const UINT8 *code_base1 = gfx->get_data(code1 % gfx->elements());
90         const UINT8 *code_base2 = gfx->get_data(code2 % gfx->elements());
9191
92         int sprite_screen_height = (scaley*gfx->height+(sy&0xffff))>>16;
93         int sprite_screen_width = (scalex*gfx->width+(sx&0xffff))>>16;
92         int sprite_screen_height = (scaley*gfx->height()+(sy&0xffff))>>16;
93         int sprite_screen_width = (scalex*gfx->width()+(sx&0xffff))>>16;
9494
9595         sx>>=16;
9696         sy>>=16;
r17669r17670
9898         if (sprite_screen_width && sprite_screen_height)
9999         {
100100            /* compute sprite increment per screen pixel */
101            int dx = (gfx->width<<16)/sprite_screen_width;
102            int dy = (gfx->height<<16)/sprite_screen_height;
101            int dx = (gfx->width()<<16)/sprite_screen_width;
102            int dy = (gfx->height()<<16)/sprite_screen_height;
103103
104104            int ex = sx+sprite_screen_width;
105105            int ey = sy+sprite_screen_height;
r17669r17670
161161                  {
162162                     for( y=sy; y<ey; y++ )
163163                     {
164                        const UINT8 *source1 = code_base1 + (y_index>>16) * gfx->line_modulo;
165                        const UINT8 *source2 = code_base2 + (y_index>>16) * gfx->line_modulo;
164                        const UINT8 *source1 = code_base1 + (y_index>>16) * gfx->rowbytes();
165                        const UINT8 *source2 = code_base2 + (y_index>>16) * gfx->rowbytes();
166166                        UINT32 *dest = &dest_bmp.pix32(y);
167167
168168                        int x, x_index = x_index_base;
r17669r17670
189189                  {
190190                     for( y=sy; y<ey; y++ )
191191                     {
192                        const UINT8 *source = code_base1 + (y_index>>16) * gfx->line_modulo;
192                        const UINT8 *source = code_base1 + (y_index>>16) * gfx->rowbytes();
193193                        UINT32 *dest = &dest_bmp.pix32(y);
194194
195195                        int x, x_index = x_index_base;
trunk/src/mame/video/tryout.c
r17669r17670
135135      break;
136136   }
137137
138   gfx_element_mark_dirty(machine().gfx[2], (offset-0x400/64)&0x7f);
138   machine().gfx[2]->mark_dirty((offset-0x400/64)&0x7f);
139139}
140140
141141WRITE8_MEMBER(tryout_state::tryout_vram_bankswitch_w)
r17669r17670
174174   state->m_vram=auto_alloc_array(machine, UINT8, 8 * 0x800);
175175   state->m_vram_gfx=auto_alloc_array(machine, UINT8, 0x6000);
176176
177   gfx_element_set_source(machine.gfx[2], state->m_vram_gfx);
177   machine.gfx[2]->set_source(state->m_vram_gfx);
178178
179179   state->m_fg_tilemap->set_transparent_pen(0);
180180}
trunk/src/mame/video/rungun.c
r17669r17670
8989   assert(gfx_index != MAX_GFX_ELEMENTS);
9090
9191   // decode the ttl layer's gfx
92   machine.gfx[gfx_index] = gfx_element_alloc(machine, &charlayout, state->memregion("gfx3")->base(), machine.total_colors() / 16, 0);
92   machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, charlayout, state->memregion("gfx3")->base(), machine.total_colors() / 16, 0));
9393   state->m_ttl_gfx_index = gfx_index;
9494
9595   // create the tilemap
trunk/src/mame/video/aerofgt.c
r17669r17670
863863   int i, scrolly;
864864   int y, x;
865865   int count;
866   const gfx_element *gfx = screen.machine().gfx[0];
866   gfx_element *gfx = screen.machine().gfx[0];
867867
868868   state->m_bg1_tilemap->set_scroll_rows(256);
869869   scrolly = state->m_bg1scrolly;
trunk/src/mame/video/docastle.c
r17669r17670
138138   {
139139      int sx, sy, flipx, flipy, code, color;
140140
141      if (machine.gfx[1]->total_elements > 256)
141      if (machine.gfx[1]->elements() > 256)
142142      {
143143         /* spriteram
144144
trunk/src/mame/video/mainsnk.c
r17669r17670
8787WRITE8_MEMBER(mainsnk_state::mainsnk_c600_w)
8888{
8989   int bank;
90   int total_elements = machine().gfx[0]->total_elements;
90   int total_elements = machine().gfx[0]->elements();
9191
9292   flip_screen_set(~data & 0x80);
9393
r17669r17670
126126static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int scrollx, int scrolly )
127127{
128128   mainsnk_state *state = machine.driver_data<mainsnk_state>();
129   const gfx_element *gfx = machine.gfx[1];
129   gfx_element *gfx = machine.gfx[1];
130130   const UINT8 *source, *finish;
131131   source =  state->m_spriteram;
132132   finish =  source + 25*4;
trunk/src/mame/video/mystston.c
r17669r17670
178178 *
179179 *************************************/
180180
181static void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const gfx_element *gfx, int flip)
181static void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip)
182182{
183183   mystston_state *state = gfx->machine().driver_data<mystston_state>();
184184   int offs;
trunk/src/mame/video/sslam.c
r17669r17670
2525static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
2626{
2727   sslam_state *state = machine.driver_data<sslam_state>();
28   const gfx_element *gfx = machine.gfx[0];
28   gfx_element *gfx = machine.gfx[0];
2929   UINT16 *source = state->m_spriteram;
3030   UINT16 *finish = source + 0x1000/2;
3131
trunk/src/mame/video/sprint2.c
r17669r17670
164164
165165         rect.min_x = get_sprite_x(video_ram, i);
166166         rect.min_y = get_sprite_y(video_ram, i);
167         rect.max_x = get_sprite_x(video_ram, i) + screen.machine().gfx[1]->width - 1;
168         rect.max_y = get_sprite_y(video_ram, i) + screen.machine().gfx[1]->height - 1;
167         rect.max_x = get_sprite_x(video_ram, i) + screen.machine().gfx[1]->width() - 1;
168         rect.max_y = get_sprite_y(video_ram, i) + screen.machine().gfx[1]->height() - 1;
169169
170170         rect &= visarea;
171171
trunk/src/mame/video/seibuspi.c
r17669r17670
209209   COMBINE_DATA( &m_video_dma_address );
210210}
211211
212static void drawgfx_blend(bitmap_rgb32 &bitmap, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy)
212static void drawgfx_blend(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy)
213213{
214214   seibuspi_state *state = gfx->machine().driver_data<seibuspi_state>();
215   const pen_t *pens = &gfx->machine().pens[gfx->color_base];
215   const pen_t *pens = &gfx->machine().pens[gfx->colorbase()];
216216   const UINT8 *dp;
217217   int i, j;
218218   int x1, x2;
r17669r17670
220220   int px, py;
221221   int xd = 1, yd = 1;
222222
223   int width = gfx->width;
224   int height = gfx->height;
223   int width = gfx->width();
224   int height = gfx->height();
225225
226226   x1 = sx;
227227   x2 = sx + width - 1;
r17669r17670
287287      y2 = cliprect.max_y;
288288   }
289289
290   if (gfx->total_elements <= 0x10000)
290   if (gfx->elements() <= 0x10000)
291291   {
292292      code &= 0xffff;
293293   }
294294
295   dp = gfx_element_get_data(gfx, code);
295   dp = gfx->get_data(code);
296296
297297   // draw
298298   for (j=y1; j <= y2; j++)
r17669r17670
344344   int a;
345345   int priority;
346346   int x,y, x1, y1;
347   const gfx_element *gfx = machine.gfx[2];
347   gfx_element *gfx = machine.gfx[2];
348348
349349   if( state->m_layer_enable & 0x10 )
350350      return;
trunk/src/mame/video/st0020.c
r17669r17670
5656      if (machine().gfx[m_gfx_index] == 0)
5757         break;
5858
59   machine().gfx[m_gfx_index] = gfx_element_alloc(machine(), &layout_16x8x8_2, (UINT8 *)m_st0020_gfxram, machine().total_colors() / 64, 0);
59   machine().gfx[m_gfx_index] = auto_alloc(machine(), gfx_element(machine(), layout_16x8x8_2, (UINT8 *)m_st0020_gfxram, machine().total_colors() / 64, 0));
6060
61   machine().gfx[m_gfx_index]->color_granularity = 64; /* 256 colour sprites with palette selectable on 64 colour boundaries */
61   machine().gfx[m_gfx_index]->set_granularity(64); /* 256 colour sprites with palette selectable on 64 colour boundaries */
6262
6363   save_pointer(NAME(m_st0020_gfxram), 4 * 0x100000/2);
6464   save_pointer(NAME(m_st0020_spriteram), 0x80000/2);
r17669r17670
8989
9090   offset += m_st0020_gfxram_bank * 0x100000/2;
9191   COMBINE_DATA(&m_st0020_gfxram[offset]);
92   gfx_element_mark_dirty(machine().gfx[m_gfx_index], offset / (16*8/2));
92   machine().gfx[m_gfx_index]->mark_dirty(offset / (16*8/2));
9393}
9494
9595READ16_MEMBER(st0020_device::st0020_sprram_r)
r17669r17670
178178            dst /= 16*8;
179179            while (len--)
180180            {
181               gfx_element_mark_dirty(machine().gfx[m_gfx_index], dst);
181               machine().gfx[m_gfx_index]->mark_dirty(dst);
182182               dst++;
183183            }
184184         }
trunk/src/mame/video/gaplus.c
r17669r17670
6161   /* color_prom now points to the beginning of the lookup table */
6262
6363   /* characters use colors 0xf0-0xff */
64   for (i = 0;i < machine.gfx[0]->total_colors * machine.gfx[0]->color_granularity;i++)
65      colortable_entry_set_value(machine.colortable, machine.gfx[0]->color_base + i, 0xf0 + (*color_prom++ & 0x0f));
64   for (i = 0;i < machine.gfx[0]->colors() * machine.gfx[0]->granularity();i++)
65      colortable_entry_set_value(machine.colortable, machine.gfx[0]->colorbase() + i, 0xf0 + (*color_prom++ & 0x0f));
6666
6767   /* sprites */
68   for (i = 0;i < machine.gfx[1]->total_colors * machine.gfx[1]->color_granularity;i++)
68   for (i = 0;i < machine.gfx[1]->colors() * machine.gfx[1]->granularity();i++)
6969   {
70      colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + i, (color_prom[0] & 0x0f) + ((color_prom[0x200] & 0x0f) << 4));
70      colortable_entry_set_value(machine.colortable, machine.gfx[1]->colorbase() + i, (color_prom[0] & 0x0f) + ((color_prom[0x200] & 0x0f) << 4));
7171      color_prom++;
7272   }
7373}
trunk/src/mame/video/stvvdp2.c
r17669r17670
24432443}
24442444
24452445static void stv_vdp2_drawgfxzoom(
2446      bitmap_rgb32 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
2446      bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
24472447      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
24482448      int transparency,int transparent_color,int scalex, int scaley,
24492449      int sprite_screen_width, int sprite_screen_height, int alpha)
r17669r17670
24522452
24532453   if (!scalex || !scaley) return;
24542454
2455   if (gfx->pen_usage && transparency == STV_TRANSPARENCY_PEN)
2455   if (gfx->has_pen_usage() && transparency == STV_TRANSPARENCY_PEN)
24562456   {
24572457      int transmask = 0;
24582458
24592459      transmask = 1 << (transparent_color & 0xff);
24602460
2461      if ((gfx->pen_usage[code] & ~transmask) == 0)
2461      if ((gfx->pen_usage(code) & ~transmask) == 0)
24622462         /* character is totally transparent, no need to draw */
24632463         return;
2464      else if ((gfx->pen_usage[code] & transmask) == 0)
2464      else if ((gfx->pen_usage(code) & transmask) == 0)
24652465         /* character is totally opaque, can disable transparency */
24662466         transparency = STV_TRANSPARENCY_NONE;
24672467   }
r17669r17670
24802480
24812481   if( gfx )
24822482   {
2483      const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
2484      const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
2483      const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
2484      const UINT8 *source_base = gfx->get_data(code % gfx->elements());
24852485
2486      //int sprite_screen_height = (scaley*gfx->height+0x8000)>>16;
2487      //int sprite_screen_width = (scalex*gfx->width+0x8000)>>16;
2486      //int sprite_screen_height = (scaley*gfx->height()+0x8000)>>16;
2487      //int sprite_screen_width = (scalex*gfx->width()+0x8000)>>16;
24882488
24892489      if (sprite_screen_width && sprite_screen_height)
24902490      {
24912491         /* compute sprite increment per screen pixel */
2492         //int dx = (gfx->width<<16)/sprite_screen_width;
2493         //int dy = (gfx->height<<16)/sprite_screen_height;
2492         //int dx = (gfx->width()<<16)/sprite_screen_width;
2493         //int dy = (gfx->height()<<16)/sprite_screen_height;
24942494         int dx = stv2_current_tilemap.incx;
24952495         int dy = stv2_current_tilemap.incy;
24962496
r17669r17670
25532553            {
25542554               for( y=sy; y<ey; y++ )
25552555               {
2556                  const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
2556                  const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
25572557                  UINT32 *dest = &dest_bmp.pix32(y);
25582558
25592559                  int x, x_index = x_index_base;
r17669r17670
25722572            {
25732573               for( y=sy; y<ey; y++ )
25742574               {
2575                  const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
2575                  const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
25762576                  UINT32 *dest = &dest_bmp.pix32(y);
25772577
25782578                  int x, x_index = x_index_base;
r17669r17670
25922592            {
25932593               for( y=sy; y<ey; y++ )
25942594               {
2595                  const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
2595                  const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
25962596                  UINT32 *dest = &dest_bmp.pix32(y);
25972597
25982598                  int x, x_index = x_index_base;
r17669r17670
26122612            {
26132613               for( y=sy; y<ey; y++ )
26142614               {
2615                  const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
2615                  const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
26162616                  UINT32 *dest = &dest_bmp.pix32(y);
26172617
26182618                  int x, x_index = x_index_base;
r17669r17670
53735373   gfxdata[offset*4+2] = (data & 0x0000ff00) >> 8;
53745374   gfxdata[offset*4+3] = (data & 0x000000ff) >> 0;
53755375
5376   gfx_element_mark_dirty(space->machine().gfx[0], offset/8);
5377   gfx_element_mark_dirty(space->machine().gfx[1], offset/8);
5378   gfx_element_mark_dirty(space->machine().gfx[2], offset/8);
5379   gfx_element_mark_dirty(space->machine().gfx[3], offset/8);
5376   space->machine().gfx[0]->mark_dirty(offset/8);
5377   space->machine().gfx[1]->mark_dirty(offset/8);
5378   space->machine().gfx[2]->mark_dirty(offset/8);
5379   space->machine().gfx[3]->mark_dirty(offset/8);
53805380
53815381   /* 8-bit tiles overlap, so this affects the previous one as well */
53825382   if (offset/8 != 0)
53835383   {
5384      gfx_element_mark_dirty(space->machine().gfx[2], offset/8 - 1);
5385      gfx_element_mark_dirty(space->machine().gfx[3], offset/8 - 1);
5384      space->machine().gfx[2]->mark_dirty(offset/8 - 1);
5385      space->machine().gfx[3]->mark_dirty(offset/8 - 1);
53865386   }
53875387
53885388   if ( stv_rbg_cache_data.watch_vdp2_vram_writes )
r17669r17670
57615761      gfxdata[offset*4+2] = (data & 0x0000ff00) >> 8;
57625762      gfxdata[offset*4+3] = (data & 0x000000ff) >> 0;
57635763
5764      gfx_element_mark_dirty(machine.gfx[0], offset/8);
5765      gfx_element_mark_dirty(machine.gfx[1], offset/8);
5766      gfx_element_mark_dirty(machine.gfx[2], offset/8);
5767      gfx_element_mark_dirty(machine.gfx[3], offset/8);
5764      machine.gfx[0]->mark_dirty(offset/8);
5765      machine.gfx[1]->mark_dirty(offset/8);
5766      machine.gfx[2]->mark_dirty(offset/8);
5767      machine.gfx[3]->mark_dirty(offset/8);
57685768
57695769      /* 8-bit tiles overlap, so this affects the previous one as well */
57705770      if (offset/8 != 0)
57715771      {
5772         gfx_element_mark_dirty(machine.gfx[2], offset/8 - 1);
5773         gfx_element_mark_dirty(machine.gfx[3], offset/8 - 1);
5772         machine.gfx[2]->mark_dirty(offset/8 - 1);
5773         machine.gfx[3]->mark_dirty(offset/8 - 1);
57745774      }
57755775
57765776   }
r17669r17670
57995799   state->m_vdp2_cram = auto_alloc_array_clear(machine, UINT32, 0x080000/4 );
58005800   state->m_vdp2.gfx_decode = auto_alloc_array(machine, UINT8, 0x100000 );
58015801
5802//  machine.gfx[0]->color_granularity=4;
5803//  machine.gfx[1]->color_granularity=4;
5802//  machine.gfx[0]->granularity()=4;
5803//  machine.gfx[1]->granularity()=4;
58045804
58055805   memset( &stv_rbg_cache_data, 0, sizeof(stv_rbg_cache_data));
58065806   stv_rbg_cache_data.is_cache_dirty = 3;
r17669r17670
58245824   debug.l_en = 0xff;
58255825   debug.error = 0xffffffff;
58265826   debug.roz = 0;
5827   gfx_element_set_source(machine.gfx[0], state->m_vdp2.gfx_decode);
5828   gfx_element_set_source(machine.gfx[1], state->m_vdp2.gfx_decode);
5829   gfx_element_set_source(machine.gfx[2], state->m_vdp2.gfx_decode);
5830   gfx_element_set_source(machine.gfx[3], state->m_vdp2.gfx_decode);
5831   gfx_element_set_source(machine.gfx[4], state->m_vdp1.gfx_decode);
5832   gfx_element_set_source(machine.gfx[5], state->m_vdp1.gfx_decode);
5833   gfx_element_set_source(machine.gfx[6], state->m_vdp1.gfx_decode);
5834   gfx_element_set_source(machine.gfx[7], state->m_vdp1.gfx_decode);
5827   machine.gfx[0]->set_source(state->m_vdp2.gfx_decode);
5828   machine.gfx[1]->set_source(state->m_vdp2.gfx_decode);
5829   machine.gfx[2]->set_source(state->m_vdp2.gfx_decode);
5830   machine.gfx[3]->set_source(state->m_vdp2.gfx_decode);
5831   machine.gfx[4]->set_source(state->m_vdp1.gfx_decode);
5832   machine.gfx[5]->set_source(state->m_vdp1.gfx_decode);
5833   machine.gfx[6]->set_source(state->m_vdp1.gfx_decode);
5834   machine.gfx[7]->set_source(state->m_vdp1.gfx_decode);
58355835}
58365836
58375837void stv_vdp2_dynamic_res_change(running_machine &machine)
r17669r17670
67116711
67126712      for (tilecode = 0;tilecode<0x8000;tilecode++)
67136713      {
6714         gfx_element_mark_dirty(screen.machine().gfx[0], tilecode);
6714         screen.machine().gfx[0]->mark_dirty(tilecode);
67156715      }
67166716
67176717      for (tilecode = 0;tilecode<0x2000;tilecode++)
67186718      {
6719         gfx_element_mark_dirty(screen.machine().gfx[1], tilecode);
6719         screen.machine().gfx[1]->mark_dirty(tilecode);
67206720      }
67216721
67226722      for (tilecode = 0;tilecode<0x4000;tilecode++)
67236723      {
6724         gfx_element_mark_dirty(screen.machine().gfx[2], tilecode);
6724         screen.machine().gfx[2]->mark_dirty(tilecode);
67256725      }
67266726
67276727      for (tilecode = 0;tilecode<0x1000;tilecode++)
67286728      {
6729         gfx_element_mark_dirty(screen.machine().gfx[3], tilecode);
6729         screen.machine().gfx[3]->mark_dirty(tilecode);
67306730      }
67316731
67326732      /* vdp 1 ... doesn't have to be tile based */
67336733
67346734      for (tilecode = 0;tilecode<0x8000;tilecode++)
67356735      {
6736         gfx_element_mark_dirty(screen.machine().gfx[4], tilecode);
6736         screen.machine().gfx[4]->mark_dirty(tilecode);
67376737      }
67386738      for (tilecode = 0;tilecode<0x2000;tilecode++)
67396739      {
6740         gfx_element_mark_dirty(screen.machine().gfx[5], tilecode);
6740         screen.machine().gfx[5]->mark_dirty(tilecode);
67416741      }
67426742      for (tilecode = 0;tilecode<0x4000;tilecode++)
67436743      {
6744         gfx_element_mark_dirty(screen.machine().gfx[6], tilecode);
6744         screen.machine().gfx[6]->mark_dirty(tilecode);
67456745      }
67466746      for (tilecode = 0;tilecode<0x1000;tilecode++)
67476747      {
6748         gfx_element_mark_dirty(screen.machine().gfx[7], tilecode);
6748         screen.machine().gfx[7]->mark_dirty(tilecode);
67496749      }
67506750   }
67516751
trunk/src/mame/video/suprnova.c
r17669r17670
368368   state->m_tilemap_bitmap_higher.allocate(320,240);
369369   state->m_tilemap_bitmapflags_higher.allocate(320,240);
370370
371   machine.gfx[2]->color_granularity=256;
372   machine.gfx[3]->color_granularity=256;
371   machine.gfx[2]->set_granularity(256);
372   machine.gfx[3]->set_granularity(256);
373373}
374374
375375VIDEO_RESET( skns )
trunk/src/mame/video/seta2.c
r17669r17670
160160
161161***************************************************************************/
162162
163static void seta_drawgfx(   bitmap_ind16 &bitmap, const rectangle &cliprect, const gfx_element *gfx,
163static void seta_drawgfx(   bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx,
164164                     UINT32 code,UINT32 color,int flipx,int flipy,int x0,int y0,
165165                     int shadow_depth )
166166{
r17669r17670
170170   int sx, x1, dx;
171171   int sy, y1, dy;
172172
173   addr   =   gfx_element_get_data(gfx, code  % gfx->total_elements);
174   color   =   gfx->color_granularity * (color % gfx->total_colors);
173   addr   =   gfx->get_data(code  % gfx->elements());
174   color   =   gfx->granularity() * (color % gfx->colors());
175175
176   if ( flipx )   {   x1 = x0-1;            x0 += gfx->width-1;      dx = -1;   }
177   else         {   x1 = x0 + gfx->width;                     dx =  1;   }
176   if ( flipx )   {   x1 = x0-1;            x0 += gfx->width()-1;      dx = -1;   }
177   else         {   x1 = x0 + gfx->width();                     dx =  1;   }
178178
179   if ( flipy )   {   y1 = y0-1;            y0 += gfx->height-1;   dy = -1;   }
180   else         {   y1 = y0 + gfx->height;                     dy =  1;   }
179   if ( flipy )   {   y1 = y0-1;            y0 += gfx->height()-1;   dy = -1;   }
180   else         {   y1 = y0 + gfx->height();                     dy =  1;   }
181181
182182#define SETA_DRAWGFX(SETPIXELCOLOR)                                    \
183183   for ( sy = y0; sy != y1; sy += dy )                                 \
r17669r17670
196196         }                                                   \
197197      }                                                      \
198198                                                            \
199      addr   +=   gfx->line_modulo;                                 \
199      addr   +=   gfx->rowbytes();                                 \
200200   }
201201
202202   if (shadow_depth)
r17669r17670
224224//  for ( ; s1 < end; s1+=4 )
225225   for ( ; s1 < buffered_spriteram16 + 0x4000/2; s1+=4 )   // more reasonable (and it cures MAME lockup in e.g. funcube3 boot)
226226   {
227      const gfx_element *gfx;
227      gfx_element *gfx;
228228      int num      = s1[0];
229229      int xoffs   = s1[1];
230230      int yoffs   = s1[2];
r17669r17670
446446{
447447   seta2_state *state = machine.driver_data<seta2_state>();
448448
449   machine.gfx[2]->color_granularity = 16;
450   machine.gfx[3]->color_granularity = 16;
451   machine.gfx[4]->color_granularity = 16;
452   machine.gfx[5]->color_granularity = 16;
449   machine.gfx[2]->set_granularity(16);
450   machine.gfx[3]->set_granularity(16);
451   machine.gfx[4]->set_granularity(16);
452   machine.gfx[5]->set_granularity(16);
453453
454454   state->m_buffered_spriteram = auto_alloc_array(machine, UINT16, state->m_spriteram.bytes()/2);
455455
trunk/src/mame/video/shootout.c
r17669r17670
9494{
9595   shootout_state *state = machine.driver_data<shootout_state>();
9696   UINT8 *spriteram = state->m_spriteram;
97   const gfx_element *gfx = machine.gfx[1];
97   gfx_element *gfx = machine.gfx[1];
9898   const UINT8 *source = spriteram+127*4;
9999   int count;
100100
trunk/src/mame/video/fitfight.c
r17669r17670
77static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer )
88{
99   fitfight_state *state = machine.driver_data<fitfight_state>();
10   const gfx_element *gfx = machine.gfx[3];
10   gfx_element *gfx = machine.gfx[3];
1111   UINT16 *source = state->m_spriteram;
1212   UINT16 *finish = source + 0x800 / 2;
1313
trunk/src/mame/video/terracre.c
r17669r17670
3535{
3636   terracre_state *state = machine.driver_data<terracre_state>();
3737   const UINT8 *spritepalettebank = state->memregion("user1")->base();
38   const gfx_element *pGfx = machine.gfx[2];
38   gfx_element *pGfx = machine.gfx[2];
3939   const UINT16 *pSource = state->m_spriteram;
4040   int i;
4141   int transparent_pen;
4242
43   if( pGfx->total_elements > 0x200 )
43   if( pGfx->elements() > 0x200 )
4444   { /* HORE HORE Kid */
4545      transparent_pen = 0xf;
4646   }
trunk/src/mame/video/deco32.c
r17669r17670
147147
148148
149149INLINE void dragngun_drawgfxzoom(
150      bitmap_rgb32 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
150      bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
151151      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
152152      int transparent_color,
153153      int scalex, int scaley,bitmap_ind8 *pri_buffer,UINT32 pri_mask, int sprite_screen_width, int  sprite_screen_height, UINT8 alpha )
r17669r17670
170170   {
171171      if( gfx )
172172      {
173         const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
174         const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements);
173         const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
174         const UINT8 *code_base = gfx->get_data(code % gfx->elements());
175175
176176         if (sprite_screen_width && sprite_screen_height)
177177         {
178178            /* compute sprite increment per screen pixel */
179            int dx = (gfx->width<<16)/sprite_screen_width;
180            int dy = (gfx->height<<16)/sprite_screen_height;
179            int dx = (gfx->width()<<16)/sprite_screen_width;
180            int dy = (gfx->height()<<16)/sprite_screen_height;
181181
182182            int ex = sx+sprite_screen_width;
183183            int ey = sy+sprite_screen_height;
r17669r17670
240240                  {
241241                     for( y=sy; y<ey; y++ )
242242                     {
243                        const UINT8 *source = code_base + (y_index>>16) * gfx->line_modulo;
243                        const UINT8 *source = code_base + (y_index>>16) * gfx->rowbytes();
244244                        UINT32 *dest = &dest_bmp.pix32(y);
245245                        UINT8 *pri = &pri_buffer->pix8(y);
246246
r17669r17670
264264                  {
265265                     for( y=sy; y<ey; y++ )
266266                     {
267                        const UINT8 *source = code_base + (y_index>>16) * gfx->line_modulo;
267                        const UINT8 *source = code_base + (y_index>>16) * gfx->rowbytes();
268268                        UINT32 *dest = &dest_bmp.pix32(y);
269269
270270                        int x, x_index = x_index_base;
r17669r17670
287287                  {
288288                     for( y=sy; y<ey; y++ )
289289                     {
290                        const UINT8 *source = code_base + (y_index>>16) * gfx->line_modulo;
290                        const UINT8 *source = code_base + (y_index>>16) * gfx->rowbytes();
291291                        UINT32 *dest = &dest_bmp.pix32(y);
292292                        UINT8 *pri = &pri_buffer->pix8(y);
293293
r17669r17670
311311                  {
312312                     for( y=sy; y<ey; y++ )
313313                     {
314                        const UINT8 *source = code_base + (y_index>>16) * gfx->line_modulo;
314                        const UINT8 *source = code_base + (y_index>>16) * gfx->rowbytes();
315315                        UINT32 *dest = &dest_bmp.pix32(y);
316316
317317                        int x, x_index = x_index_base;
r17669r17670
697697    blending support - it can't be done in-place on the final framebuffer
698698    without a lot of support bitmaps.
699699*/
700static void mixDualAlphaSprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, const gfx_element *gfx0, const gfx_element *gfx1, int mixAlphaTilemap)
700static void mixDualAlphaSprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx0, gfx_element *gfx1, int mixAlphaTilemap)
701701{
702702   deco32_state *state = gfx0->machine().driver_data<deco32_state>();
703703   running_machine &machine = gfx0->machine();
704704   const pen_t *pens = machine.pens;
705   const pen_t *pal0 = &pens[gfx0->color_base];
706   const pen_t *pal1 = &pens[gfx1->color_base];
707   const pen_t *pal2 = &pens[machine.gfx[(state->m_pri&1) ? 1 : 2]->color_base];
705   const pen_t *pal0 = &pens[gfx0->colorbase()];
706   const pen_t *pal1 = &pens[gfx1->colorbase()];
707   const pen_t *pal2 = &pens[machine.gfx[(state->m_pri&1) ? 1 : 2]->colorbase()];
708708   int x,y;
709709   bitmap_ind16& sprite0_mix_bitmap = machine.device<decospr_device>("spritegen1")->get_sprite_temp_bitmap();
710710   bitmap_ind16& sprite1_mix_bitmap = machine.device<decospr_device>("spritegen2")->get_sprite_temp_bitmap();
r17669r17670
723723         UINT16 priColAlphaPal1=sprite1[x];
724724         UINT16 pri0=(priColAlphaPal0&0x6000)>>13;
725725         UINT16 pri1=(priColAlphaPal1&0x6000)>>13;
726         UINT16 col0=((priColAlphaPal0&0x1f00)>>8) % gfx0->total_colors;
727         UINT16 col1=((priColAlphaPal1&0x0f00)>>8) % gfx1->total_colors;
726         UINT16 col0=((priColAlphaPal0&0x1f00)>>8) % gfx0->colors();
727         UINT16 col1=((priColAlphaPal1&0x0f00)>>8) % gfx1->colors();
728728         UINT16 alpha1=priColAlphaPal1&0x8000;
729729
730730         // Apply sprite bitmap 0 according to priority rules
r17669r17670
740740                */
741741            if ((pri0&0x3)==0 || (pri0&0x3)==1 || ((pri0&0x3)==2 && mixAlphaTilemap)) // Spri0 on top of everything, or under alpha playfield
742742            {
743               destLine[x]=pal0[(priColAlphaPal0&0xff) + (gfx0->color_granularity * col0)];
743               destLine[x]=pal0[(priColAlphaPal0&0xff) + (gfx0->granularity() * col0)];
744744            }
745745            else if ((pri0&0x3)==2) // Spri0 under top playfield
746746            {
747747               if (tilemapPri[x]<4)
748                  destLine[x]=pal0[(priColAlphaPal0&0xff) + (gfx0->color_granularity * col0)];
748                  destLine[x]=pal0[(priColAlphaPal0&0xff) + (gfx0->granularity() * col0)];
749749            }
750750            else // Spri0 under top & middle playfields
751751            {
752752               if (tilemapPri[x]<2)
753                  destLine[x]=pal0[(priColAlphaPal0&0xff) + (gfx0->color_granularity * col0)];
753                  destLine[x]=pal0[(priColAlphaPal0&0xff) + (gfx0->granularity() * col0)];
754754            }
755755         }
756756
r17669r17670
780780               if (pri1==0 && (((priColAlphaPal0&0xff)==0 || ((pri0&0x3)!=0 && (pri0&0x3)!=1 && (pri0&0x3)!=2))))
781781               {
782782                  if ((state->m_pri&1)==0 || ((state->m_pri&1)==1 && tilemapPri[x]<4) || ((state->m_pri&1)==1 && mixAlphaTilemap))
783                     destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)], 0x80);
783                     destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->granularity() * col1)], 0x80);
784784               }
785785               else if (pri1==1 && ((priColAlphaPal0&0xff)==0 || ((pri0&0x3)!=0 && (pri0&0x3)!=1 && (pri0&0x3)!=2)))
786                  destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)], 0x80);
786                  destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->granularity() * col1)], 0x80);
787787               else if (pri1==2)// TOdo
788                  destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)], 0x80);
788                  destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->granularity() * col1)], 0x80);
789789               else if (pri1==3)// TOdo
790                  destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)], 0x80);
790                  destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->granularity() * col1)], 0x80);
791791            }
792792            else
793793            {
r17669r17670
797797                        Pri 0 - Under sprite 0 pri 0, over all tilemaps
798798                    */
799799               if (pri1==0 && ((priColAlphaPal0&0xff)==0 || ((pri0&0x3)!=0)))
800                  destLine[x]=pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)];
800                  destLine[x]=pal1[(priColAlphaPal1&0xff) + (gfx1->granularity() * col1)];
801801               else if (pri1==1) // todo
802                  destLine[x]=pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)];
802                  destLine[x]=pal1[(priColAlphaPal1&0xff) + (gfx1->granularity() * col1)];
803803               else if (pri1==2) // todo
804                  destLine[x]=pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)];
804                  destLine[x]=pal1[(priColAlphaPal1&0xff) + (gfx1->granularity() * col1)];
805805               else if (pri1==3) // todo
806                  destLine[x]=pal1[(priColAlphaPal1&0xff) + (gfx1->color_granularity * col1)];
806                  destLine[x]=pal1[(priColAlphaPal1&0xff) + (gfx1->granularity() * col1)];
807807            }
808808         }
809809
trunk/src/mame/video/grchamp.c
r17669r17670
184184
185185static void draw_sprites(running_machine &machine, grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect)
186186{
187   const gfx_element *gfx = machine.gfx[5];
187   gfx_element *gfx = machine.gfx[5];
188188   int bank = (state->m_cpu0_out[0] & 0x20) ? 0x40 : 0x00;
189189   const UINT8 *source = state->m_spriteram + 0x40;
190190   const UINT8 *finish = source + 0x40;
r17669r17670
246246
247247*/
248248   const UINT8 *prom = machine.root_device().memregion("proms")->base() + 0x20;
249   const gfx_element *gfx;
249   gfx_element *gfx;
250250   int change = (state->m_cpu0_out[0] & 0x20) << 3;
251251   int num;
252252
r17669r17670
278278         int code = (codeflip & 0x3f) + (change >> 2);
279279         int yflip = (codeflip & 0x80) ? 0x0f : 0x00;
280280         int xflip = (codeflip & 0x40) ? 0x0f : 0x00;
281         const UINT8 *src = gfx_element_get_data(gfx, code) + ((dy ^ yflip) & 15) * gfx->line_modulo;
281         const UINT8 *src = gfx->get_data(code) + ((dy ^ yflip) & 15) * gfx->rowbytes();
282282
283283         /* the third byte is: color in bits 0-2 */
284284         int color = (state->m_spriteram[0x42 + (dataoffs & ~0x20)] & 0x07) << 2;
r17669r17670
322322      int dy = sy + ~y;
323323      int color = (state->m_spriteram[0x01 + dataoffs] & 0x07) << 2;
324324      int code = state->m_videoram[hprime | ((dy & 0xf8) << 2)] + change;
325      const UINT8 *src = gfx_element_get_data(gfx, code) + (dy & 7) * gfx->line_modulo;
325      const UINT8 *src = gfx->get_data(code) + (dy & 7) * gfx->rowbytes();
326326      int x;
327327
328328      /* draw 8 pixels */
trunk/src/mame/video/zaxxon.c
r17669r17670
434434{
435435   zaxxon_state *state = machine.driver_data<zaxxon_state>();
436436   UINT8 *spriteram = state->m_spriteram;
437   const gfx_element *gfx = machine.gfx[2];
437   gfx_element *gfx = machine.gfx[2];
438438   int flip = state->flip_screen();
439439   int flipmask = flip ? 0xff : 0x00;
440440   int offs;
trunk/src/mame/video/gaiden.c
r17669r17670
361361   };
362362
363363   gaiden_state *state = machine.driver_data<gaiden_state>();
364   const gfx_element *gfx = machine.gfx[3];
364   gfx_element *gfx = machine.gfx[3];
365365   const UINT16 *source = (NUM_SPRITES - 1) * 8 + state->m_spriteram;
366366   int count = NUM_SPRITES;
367367
r17669r17670
435435
436436                  pdrawgfx_transpen_raw(bitmap_sp, cliprect, gfx,
437437                     number + layout[row][col],
438                     gfx->color_base + color * gfx->color_granularity,
438                     gfx->colorbase() + color * gfx->granularity(),
439439                     flipx, flipy,
440440                     sx, sy,
441441                     machine.priority_bitmap, priority_mask, 0);
r17669r17670
455455
456456                  pdrawgfx_transpen_raw(bitmap, cliprect, gfx,
457457                     number + layout[row][col],
458                     gfx->color_base + color * gfx->color_granularity,
458                     gfx->colorbase() + color * gfx->granularity(),
459459                     flipx, flipy,
460460                     sx, sy,
461461                     machine.priority_bitmap, priority_mask, 0);
r17669r17670
483483   };
484484
485485   gaiden_state *state = machine.driver_data<gaiden_state>();
486   const gfx_element *gfx = machine.gfx[3];
486   gfx_element *gfx = machine.gfx[3];
487487   const UINT16 *source = (NUM_SPRITES - 1) * 8 + state->m_spriteram;
488488   int count = NUM_SPRITES;
489489
r17669r17670
556556
557557                  pdrawgfx_transpen_raw(bitmap_sp, cliprect, gfx,
558558                     number + layout[row][col],
559                     gfx->color_base + color * gfx->color_granularity,
559                     gfx->colorbase() + color * gfx->granularity(),
560560                     flipx, flipy,
561561                     sx, sy,
562562                     machine.priority_bitmap, priority_mask, 0);
r17669r17670
576576
577577                  pdrawgfx_transpen_raw(bitmap, cliprect, gfx,
578578                     number + layout[row][col],
579                     gfx->color_base + color * gfx->color_granularity,
579                     gfx->colorbase() + color * gfx->granularity(),
580580                     flipx, flipy,
581581                     sx, sy,
582582                     machine.priority_bitmap, priority_mask, 0);
r17669r17670
635635
636636      pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[3],
637637            code,
638            machine.gfx[3]->color_base + color * machine.gfx[3]->color_granularity,
638            machine.gfx[3]->colorbase() + color * machine.gfx[3]->granularity(),
639639            flipx,flipy,x,y,
640640            machine.priority_bitmap, priority_mask,15);
641641
642642      /* wrap x*/
643643      pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[3],
644644            code,
645            machine.gfx[3]->color_base + color * machine.gfx[3]->color_granularity,
645            machine.gfx[3]->colorbase() + color * machine.gfx[3]->granularity(),
646646            flipx,flipy,x-512,y,
647647            machine.priority_bitmap, priority_mask,15);
648648
trunk/src/mame/video/shangkid.c
r17669r17670
6262static void draw_sprite(running_machine &machine, const UINT8 *source, bitmap_ind16 &bitmap, const rectangle &cliprect)
6363{
6464   shangkid_state *state = machine.driver_data<shangkid_state>();
65   const gfx_element *gfx;
65   gfx_element *gfx;
6666   int transparent_pen;
6767   int bank_index;
6868   int c,r;
trunk/src/mame/video/finalizr.c
r17669r17670
9898
9999   /* Draw the sprites. */
100100   {
101      const gfx_element *gfx1 = screen.machine().gfx[1];
102      const gfx_element *gfx2 = screen.machine().gfx[2];
101      gfx_element *gfx1 = screen.machine().gfx[1];
102      gfx_element *gfx2 = screen.machine().gfx[2];
103103
104104      UINT8 *sr = state->m_spriterambank ? state->m_spriteram_2 : state->m_spriteram;
105105
trunk/src/mame/video/cclimber.c
r17669r17670
547547}
548548
549549
550static void cclimber_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const gfx_element *gfx)
550static void cclimber_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx)
551551{
552552   cclimber_state *state = gfx->machine().driver_data<cclimber_state>();
553553   int offs;
r17669r17670
588588}
589589
590590
591static void toprollr_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const gfx_element *gfx)
591static void toprollr_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx)
592592{
593593   cclimber_state *state = gfx->machine().driver_data<cclimber_state>();
594594   int offs;
r17669r17670
626626}
627627
628628
629static void swimmer_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const gfx_element *gfx)
629static void swimmer_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx)
630630{
631631   cclimber_state *state = gfx->machine().driver_data<cclimber_state>();
632632   int offs;
trunk/src/mame/video/speedspn.c
r17669r17670
5757static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
5858{
5959   speedspn_state *state = machine.driver_data<speedspn_state>();
60   const gfx_element *gfx = machine.gfx[1];
60   gfx_element *gfx = machine.gfx[1];
6161   UINT8 *source = state->m_vidram+ 0x1000;
6262   UINT8 *finish = source + 0x1000;
6363
trunk/src/mame/video/namcona1.c
r17669r17670
261261         old_word = m_shaperam[offset];
262262         COMBINE_DATA( &m_shaperam[offset] );
263263         if( m_shaperam[offset]!=old_word )
264            gfx_element_mark_dirty(machine().gfx[2], offset/4);
264            machine().gfx[2]->mark_dirty(offset/4);
265265      }
266266   }
267267   else if( type == 0x02 )
r17669r17670
270270      COMBINE_DATA( &m_cgram[offset] );
271271      if( m_cgram[offset]!=old_word )
272272      {
273         gfx_element_mark_dirty(machine().gfx[0], offset/0x20);
274         gfx_element_mark_dirty(machine().gfx[1], offset/0x20);
273         machine().gfx[0]->mark_dirty(offset/0x20);
274         machine().gfx[1]->mark_dirty(offset/0x20);
275275      }
276276   }
277277} /* namcona1_gfxram_w */
r17669r17670
298298   state->m_shaperam           = auto_alloc_array(machine, UINT16, 0x2000*4/2 );
299299   state->m_cgram              = auto_alloc_array(machine, UINT16, 0x1000*0x40/2 );
300300
301   machine.gfx[0] = gfx_element_alloc( machine, &cg_layout_8bpp, (UINT8 *)state->m_cgram, machine.total_colors()/256, 0 );
302   machine.gfx[1] = gfx_element_alloc( machine, &cg_layout_4bpp, (UINT8 *)state->m_cgram, machine.total_colors()/16, 0 );
303   machine.gfx[2] = gfx_element_alloc( machine, &shape_layout, (UINT8 *)state->m_shaperam, machine.total_colors()/2, 0 );
301   machine.gfx[0] = auto_alloc( machine, gfx_element( machine, cg_layout_8bpp, (UINT8 *)state->m_cgram, machine.total_colors()/256, 0 ));
302   machine.gfx[1] = auto_alloc( machine, gfx_element( machine, cg_layout_4bpp, (UINT8 *)state->m_cgram, machine.total_colors()/16, 0 ));
303   machine.gfx[2] = auto_alloc( machine, gfx_element( machine, shape_layout, (UINT8 *)state->m_shaperam, machine.total_colors()/2, 0 ));
304304
305305} /* namcona1_vh_start */
306306
r17669r17670
318318      int bOpaque,
319319      int gfx_region )
320320{
321   const gfx_element *gfx = machine.gfx[gfx_region];
322   const gfx_element *mask = machine.gfx[2];
321   gfx_element *gfx = machine.gfx[gfx_region];
322   gfx_element *mask = machine.gfx[2];
323323
324   int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
325   const UINT8 *source_base = gfx_element_get_data(gfx, (code % gfx->total_elements));
326   const UINT8 *mask_base = gfx_element_get_data(mask, (code % mask->total_elements));
324   int pal_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors());
325   const UINT8 *source_base = gfx->get_data((code % gfx->elements()));
326   const UINT8 *mask_base = mask->get_data((code % mask->elements()));
327327
328   int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16;
329   int sprite_screen_width  = ((1<<16)*gfx->width+0x8000)>>16;
328   int sprite_screen_height = ((1<<16)*gfx->height()+0x8000)>>16;
329   int sprite_screen_width  = ((1<<16)*gfx->width()+0x8000)>>16;
330330
331331   if (sprite_screen_width && sprite_screen_height)
332332   {
333333      /* compute sprite increment per screen pixel */
334      int dx = (gfx->width<<16)/sprite_screen_width;
335      int dy = (gfx->height<<16)/sprite_screen_height;
334      int dx = (gfx->width()<<16)/sprite_screen_width;
335      int dy = (gfx->height()<<16)/sprite_screen_height;
336336
337337      int ex = sx+sprite_screen_width;
338338      int ey = sy+sprite_screen_height;
r17669r17670
390390
391391         for( y=sy; y<ey; y++ )
392392         {
393            const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
394            const UINT8 *mask_addr = mask_base + (y_index>>16) * mask->line_modulo;
393            const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
394            const UINT8 *mask_addr = mask_base + (y_index>>16) * mask->rowbytes();
395395            UINT16 *dest = &dest_bmp.pix16(y);
396396            UINT8 *pri = &machine.priority_bitmap.pix8(y);
397397
r17669r17670
566566   gfx_element *pGfx;
567567
568568   pGfx = machine.gfx[0];
569   paldata = &machine.pens[pGfx->color_base + pGfx->color_granularity * state->m_tilemap_palette_bank[which]];
569   paldata = &machine.pens[pGfx->colorbase() + pGfx->granularity() * state->m_tilemap_palette_bank[which]];
570570
571571   /* draw one scanline at a time */
572572   clip.min_x = cliprect.min_x;
trunk/src/mame/video/foodf.c
r17669r17670
117117{
118118   foodf_state *state = screen.machine().driver_data<foodf_state>();
119119   int offs;
120   const gfx_element *gfx = screen.machine().gfx[1];
120   gfx_element *gfx = screen.machine().gfx[1];
121121   bitmap_ind8 &priority_bitmap = screen.machine().priority_bitmap;
122122   UINT16 *spriteram16 = state->m_spriteram;
123123
trunk/src/mame/video/armedf.c
r17669r17670
266266***************************************************************************/
267267
268268/* custom code to handle color cycling effect, handled by m_spr_pal_clut */
269void armedf_drawgfx(running_machine &machine, bitmap_ind16 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
269void armedf_drawgfx(running_machine &machine, bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
270270                     UINT32 code,UINT32 color, UINT32 clut,int flipx,int flipy,int offsx,int offsy,
271271                     int transparent_color)
272272{
273273   armedf_state *state = machine.driver_data<armedf_state>();
274   const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
275   const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
274   const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
275   const UINT8 *source_base = gfx->get_data(code % gfx->elements());
276276   int x_index_base, y_index, sx, sy, ex, ey;
277277   int xinc, yinc;
278278
279279   xinc = flipx ? -1 : 1;
280280   yinc = flipy ? -1 : 1;
281281
282   x_index_base = flipx ? gfx->width-1 : 0;
283   y_index = flipy ? gfx->height-1 : 0;
282   x_index_base = flipx ? gfx->width()-1 : 0;
283   y_index = flipy ? gfx->height()-1 : 0;
284284
285285   /* start coordinates */
286286   sx = offsx;
287287   sy = offsy;
288288
289289   /* end coordinates */
290   ex = sx + gfx->width;
291   ey = sy + gfx->height;
290   ex = sx + gfx->width();
291   ey = sy + gfx->height();
292292
293293   if (sx < clip.min_x)
294294   { /* clip left */
r17669r17670
319319      {
320320         for (y = sy; y < ey; y++)
321321         {
322            const UINT8 *source = source_base + y_index*gfx->line_modulo;
322            const UINT8 *source = source_base + y_index*gfx->rowbytes();
323323            UINT16 *dest = &dest_bmp.pix16(y);
324324            int x_index = x_index_base;
325325            for (x = sx; x < ex; x++)
trunk/src/mame/video/sprint4.c
r17669r17670
116116
117117         rect.min_x = horz - 15;
118118         rect.min_y = vert - 15;
119         rect.max_x = horz - 15 + screen.machine().gfx[1]->width - 1;
120         rect.max_y = vert - 15 + screen.machine().gfx[1]->height - 1;
119         rect.max_x = horz - 15 + screen.machine().gfx[1]->width() - 1;
120         rect.max_y = vert - 15 + screen.machine().gfx[1]->height() - 1;
121121
122122         rect &= screen.machine().primary_screen->visible_area();
123123
trunk/src/mame/video/appoooh.c
r17669r17670
203203   /* bit 7 unknown (used) */
204204}
205205
206static void appoooh_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, const gfx_element *gfx, UINT8 *sprite )
206static void appoooh_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, UINT8 *sprite )
207207{
208208   appoooh_state *state = gfx->machine().driver_data<appoooh_state>();
209209   int offs;
r17669r17670
235235   }
236236}
237237
238static void robowres_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, const gfx_element *gfx, UINT8 *sprite )
238static void robowres_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, UINT8 *sprite )
239239{
240240   appoooh_state *state = gfx->machine().driver_data<appoooh_state>();
241241   int offs;
trunk/src/mame/video/goldstar.c
r17669r17670
410410   {
411411      if (screen.machine().root_device().memregion("user1")->base())
412412      {
413         const gfx_element *gfx = screen.machine().gfx[2];
413         gfx_element *gfx = screen.machine().gfx[2];
414414         int girlyscroll = (INT8)((state->m_cm_girl_scroll & 0xf0));
415415         int girlxscroll = (INT8)((state->m_cm_girl_scroll & 0x0f)<<4);
416416
r17669r17670
453453   {
454454      if (screen.machine().root_device().memregion("user1")->base())
455455      {
456         const gfx_element *gfx = screen.machine().gfx[2];
456         gfx_element *gfx = screen.machine().gfx[2];
457457         int girlyscroll = (INT8)((state->m_cm_girl_scroll & 0xf0));
458458         int girlxscroll = (INT8)((state->m_cm_girl_scroll & 0x0f)<<4);
459459
trunk/src/mame/video/ms32.c
r17669r17670
255255      }
256256
257257
258      gfx_element_set_source_clip(gfx, tx, xsize, ty, ysize);
258      gfx->set_source_clip(tx, xsize, ty, ysize);
259259
260260      {
261261         // passes the priority as the upper bits of the colour
trunk/src/mame/video/spbactn.c
r17669r17670
9191
9292               drawgfx_transpen_raw(bitmap, cliprect, machine.gfx[2],
9393                  code + layout[row][col],
94                  machine.gfx[2]->color_base + color * machine.gfx[2]->color_granularity,
94                  machine.gfx[2]->colorbase() + color * machine.gfx[2]->granularity(),
9595                  flipx, flipy,
9696                  x, y,
9797                  0);
r17669r17670
134134
135135      drawgfx_transpen_raw(state->m_tile_bitmap_bg, cliprect, screen.machine().gfx[1],
136136               code,
137               screen.machine().gfx[1]->color_base + color * screen.machine().gfx[1]->color_granularity,
137               screen.machine().gfx[1]->colorbase() + color * screen.machine().gfx[1]->granularity(),
138138               0, 0,
139139               16 * sx, 8 * sy,
140140               (UINT32)-1);
r17669r17670
161161
162162         drawgfx_transpen_raw(state->m_tile_bitmap_bg, cliprect, screen.machine().gfx[1],
163163               code,
164               screen.machine().gfx[1]->color_base + color * screen.machine().gfx[1]->color_granularity,
164               screen.machine().gfx[1]->colorbase() + color * screen.machine().gfx[1]->granularity(),
165165               0, 0,
166166               16 * sx, 8 * sy,
167167               0);
r17669r17670
195195
196196      drawgfx_transpen_raw(state->m_tile_bitmap_fg, cliprect, screen.machine().gfx[0],
197197               code,
198               screen.machine().gfx[0]->color_base + color * screen.machine().gfx[0]->color_granularity,
198               screen.machine().gfx[0]->colorbase() + color * screen.machine().gfx[0]->granularity(),
199199               0, 0,
200200               16 * sx, 8 * sy,
201201               0);
trunk/src/mame/video/atarimo.c
r17669r17670
237237{
238238   mo->gfxelement[idx] = auto_alloc(mo->machine(), gfx_element(mo->machine()));
239239   memcpy(mo->gfxelement[idx], mo->machine().gfx[idx], sizeof(*mo->gfxelement[idx]));
240   mo->gfxgranularity[idx] = mo->gfxelement[idx]->color_granularity;
241   mo->gfxelement[idx]->color_granularity = 1;
242   mo->gfxelement[idx]->color_base = 0;
243   mo->gfxelement[idx]->total_colors = 65536;
240   mo->gfxgranularity[idx] = mo->gfxelement[idx]->granularity();
241   mo->gfxelement[idx]->set_granularity(1);
242   mo->gfxelement[idx]->set_colorbase(0);
243   mo->gfxelement[idx]->set_colors(65536);
244244}
245245
246246
r17669r17670
368368   mo->entrybits     = compute_log(mo->entrycount);
369369   mo->bankcount     = desc->banks;
370370
371   mo->tilewidth     = gfx->width;
372   mo->tileheight    = gfx->height;
371   mo->tilewidth     = gfx->width();
372   mo->tileheight    = gfx->height();
373373   mo->tilexshift    = compute_log(mo->tilewidth);
374374   mo->tileyshift    = compute_log(mo->tileheight);
375375   mo->bitmapwidth   = round_to_powerof2(mo->xposmask.mask);
r17669r17670
383383   mo->sliprammask   = mo->slipramsize - 1;
384384
385385   mo->palettebase   = desc->palettebase;
386   mo->maxcolors     = desc->maxcolors / gfx->color_granularity;
386   mo->maxcolors     = desc->maxcolors / gfx->granularity();
387387   mo->transpen      = desc->transpen;
388388
389389   mo->bank          = 0;
r17669r17670
742742static int mo_render_object(atarimo_data *mo, const atarimo_entry *entry, const rectangle &cliprect)
743743{
744744   int gfxindex = mo->gfxlookup[EXTRACT_DATA(entry, mo->gfxmask)];
745   const gfx_element *gfx = mo->gfxelement[gfxindex];
745   gfx_element *gfx = mo->gfxelement[gfxindex];
746746   bitmap_ind16 &bitmap = *mo->bitmap;
747747   int x, y, sx, sy;
748748
trunk/src/mame/video/wwfsstar.c
r17669r17670
133133    **- End of Comments -*/
134134
135135   wwfsstar_state *state = machine.driver_data<wwfsstar_state>();
136   const gfx_element *gfx = machine.gfx[1];
136   gfx_element *gfx = machine.gfx[1];
137137   UINT16 *source = state->m_spriteram;
138138   UINT16 *finish = source + 0x3ff/2;
139139
trunk/src/mame/video/polepos.c
r17669r17670
425425      UINT32 code,UINT32 color,int flipx,int sx,int sy,
426426      int sizex,int sizey)
427427{
428   const gfx_element *gfx = machine.gfx[big ? 3 : 2];
429   const UINT8 *gfxdata = gfx_element_get_data(gfx, code % gfx->total_elements);
428   gfx_element *gfx = machine.gfx[big ? 3 : 2];
429   const UINT8 *gfxdata = gfx->get_data(code % gfx->elements());
430430   UINT8 *scaling_rom = machine.root_device().memregion("gfx6")->base();
431431   UINT32 transmask = colortable_get_transpen_mask(machine.colortable, gfx, color, 0x1f);
432   int coloroffs = gfx->color_base + color * gfx->color_granularity;
432   int coloroffs = gfx->colorbase() + color * gfx->granularity();
433433   int x,y;
434434
435435   if (flipx) flipx = big ? 0x1f : 0x0f;
r17669r17670
448448         const UINT8 *src;
449449
450450         if (!big) dy >>= 1;
451         src = gfxdata + dy * gfx->line_modulo;
451         src = gfxdata + dy * gfx->rowbytes();
452452
453453         for (x = (big ? 0x40 : 0x20);x > 0;x--)
454454         {
trunk/src/mame/video/taitoic.c
r17669r17670
14391439
14401440   if (offset < 0x1000 / 2)
14411441   {
1442      gfx_element_mark_dirty(device->machine().gfx[tc0080vco->tx_gfx], offset / 8);
1442      device->machine().gfx[tc0080vco->tx_gfx]->mark_dirty(offset / 8);
14431443#if 0
14441444      if (!tc0080vco->has_tx)
14451445      {
r17669r17670
14701470
14711471   else if (offset < 0x11000 / 2)
14721472   {
1473      gfx_element_mark_dirty(device->machine().gfx[tc0080vco->tx_gfx], (offset - 0x10000 / 2) / 8);
1473      device->machine().gfx[tc0080vco->tx_gfx]->mark_dirty((offset - 0x10000 / 2) / 8);
14741474#if 0
14751475      if (!tc0080vco->has_tx)
14761476      {
r17669r17670
19021902   tc0080vco->scroll_ram    = tc0080vco->ram + 0x20800 / 2;
19031903
19041904   /* create the char set (gfx will then be updated dynamically from RAM) */
1905   device->machine().gfx[tc0080vco->tx_gfx] = gfx_element_alloc(device->machine(), &tc0080vco_charlayout, (UINT8 *)tc0080vco->char_ram, 64, 0);
1905   device->machine().gfx[tc0080vco->tx_gfx] = auto_alloc(device->machine(), gfx_element(device->machine(), tc0080vco_charlayout, (UINT8 *)tc0080vco->char_ram, 64, 0));
19061906
19071907   device->save_pointer(NAME(tc0080vco->ram), TC0080VCO_RAM_SIZE / 2);
19081908   device->machine().save().register_postload(save_prepost_delegate(FUNC(tc0080vco_postload), tc0080vco));
r17669r17670
21732173      else if (offset < 0x3000)
21742174         tc0100scn->tilemap[2][0]->mark_tile_dirty((offset & 0x0fff));
21752175      else if (offset < 0x3800)
2176         gfx_element_mark_dirty(device->machine().gfx[tc0100scn->tx_gfx], (offset - 0x3000) / 8);
2176         device->machine().gfx[tc0100scn->tx_gfx]->mark_dirty((offset - 0x3000) / 8);
21772177      else if (offset >= 0x4000 && offset < 0x6000)
21782178         tc0100scn->tilemap[1][0]->mark_tile_dirty((offset & 0x1fff) / 2);
21792179   }
r17669r17670
21842184      else if (offset >= 0x4000 && offset < 0x8000)
21852185         tc0100scn->tilemap[1][1]->mark_tile_dirty((offset & 0x3fff) / 2);
21862186      else if (offset >= 0x8800 && offset < 0x9000)
2187         gfx_element_mark_dirty(device->machine().gfx[tc0100scn->tx_gfx], (offset - 0x8800) / 8);
2187         device->machine().gfx[tc0100scn->tx_gfx]->mark_dirty((offset - 0x8800) / 8);
21882188      else if (offset >= 0x9000)
21892189         tc0100scn->tilemap[2][1]->mark_tile_dirty((offset & 0x0fff));
21902190   }
r17669r17670
22462246            tc0100scn_dirty_tilemaps(device);
22472247
22482248            /* reset the pointer to the text characters (and dirty them all) */
2249            gfx_element_set_source(device->machine().gfx[tc0100scn->tx_gfx], (UINT8 *)tc0100scn->char_ram);
2249            device->machine().gfx[tc0100scn->tx_gfx]->set_source((UINT8 *)tc0100scn->char_ram);
22502250         }
22512251
22522252         break;
r17669r17670
24912491   tc0100scn->bg_col_mult = 1;   /* multiplier for when bg gfx != 4bpp */
24922492   tc0100scn->tx_col_mult = 1;   /* multiplier needed when bg gfx is 6bpp */
24932493
2494   if (device->machine().gfx[intf->gfxnum]->color_granularity == 2)   /* Yuyugogo, Yesnoj */
2494   if (device->machine().gfx[intf->gfxnum]->granularity() == 2)   /* Yuyugogo, Yesnoj */
24952495      tc0100scn->bg_col_mult = 8;
24962496
2497   if (device->machine().gfx[intf->gfxnum]->color_granularity == 0x40)   /* Undrfire */
2497   if (device->machine().gfx[intf->gfxnum]->granularity() == 0x40)   /* Undrfire */
24982498      tc0100scn->tx_col_mult = 4;
24992499
2500//logerror("TC0100SCN bg gfx granularity %04x: multiplier %04x\n", device->machine().gfx[intf->gfxnum]->color_granularity, tc0100scn->tx_col_mult);
2500//logerror("TC0100SCN bg gfx granularity %04x: multiplier %04x\n", device->machine().gfx[intf->gfxnum]->granularity(), tc0100scn->tx_col_mult);
25012501
25022502   tc0100scn->ram = auto_alloc_array_clear(device->machine(), UINT16, TC0100SCN_RAM_SIZE / 2);
25032503
r17669r17670
25072507                           /* we call this here, so that they can be modified at VIDEO_START*/
25082508
25092509   /* create the char set (gfx will then be updated dynamically from RAM) */
2510   device->machine().gfx[tc0100scn->tx_gfx] = gfx_element_alloc(device->machine(), &tc0100scn_charlayout, (UINT8 *)tc0100scn->char_ram, 64, 0);
2510   device->machine().gfx[tc0100scn->tx_gfx] = auto_alloc(device->machine(), gfx_element(device->machine(), tc0100scn_charlayout, (UINT8 *)tc0100scn->char_ram, 64, 0));
25112511
25122512   device->save_pointer(NAME(tc0100scn->ram), TC0100SCN_RAM_SIZE / 2);
25132513   device->save_item(NAME(tc0100scn->ctrl));
r17669r17670
29762976      }
29772977      else if (offset <= 0x7fff)
29782978      {
2979         gfx_element_mark_dirty(device->machine().gfx[tc0480scp->tx_gfx], (offset - 0x7000) / 16);
2979         device->machine().gfx[tc0480scp->tx_gfx]->mark_dirty((offset - 0x7000) / 16);
29802980      }
29812981   }
29822982   else
r17669r17670
29942994      }
29952995      else if (offset <= 0x7fff)
29962996      {
2997         gfx_element_mark_dirty(device->machine().gfx[tc0480scp->tx_gfx], (offset - 0x7000) / 16);
2997         device->machine().gfx[tc0480scp->tx_gfx]->mark_dirty((offset - 0x7000) / 16);
29982998      }
29992999   }
30003000}
r17669r17670
37173717   tc0480scp_set_layer_ptrs(tc0480scp);
37183718
37193719   /* create the char set (gfx will then be updated dynamically from RAM) */
3720   device->machine().gfx[tc0480scp->tx_gfx] = gfx_element_alloc(device->machine(), &tc0480scp_charlayout, (UINT8 *)tc0480scp->char_ram, 64, 0);
3720   device->machine().gfx[tc0480scp->tx_gfx] = auto_alloc(device->machine(), gfx_element(device->machine(), tc0480scp_charlayout, (UINT8 *)tc0480scp->char_ram, 64, 0));
37213721
37223722   device->save_pointer(NAME(tc0480scp->ram), TC0480SCP_RAM_SIZE / 2);
37233723   device->save_item(NAME(tc0480scp->ctrl));
trunk/src/mame/video/namcos86.c
r17669r17670
285285   int sprite_xoffs = state->m_spriteram[0x07f5] + ((state->m_spriteram[0x07f4] & 1) << 8);
286286   int sprite_yoffs = state->m_spriteram[0x07f7];
287287
288   int bank_sprites = machine.gfx[2]->total_elements / 8;
288   int bank_sprites = machine.gfx[2]->elements() / 8;
289289
290290   while (source >= finish)
291291   {
r17669r17670
323323
324324      sy++;   /* sprites are buffered and delayed by one scanline */
325325
326      gfx_element_set_source_clip(gfx, tx, sizex, ty, sizey);
326      gfx->set_source_clip(tx, sizex, ty, sizey);
327327      pdrawgfx_transpen( bitmap, cliprect,gfx,
328328            sprite,
329329            color,
r17669r17670
371371
372372   screen.machine().priority_bitmap.fill(0, cliprect);
373373
374   bitmap.fill(screen.machine().gfx[0]->color_base + 8*state->m_backcolor+7, cliprect);
374   bitmap.fill(screen.machine().gfx[0]->colorbase() + 8*state->m_backcolor+7, cliprect);
375375
376376   for (layer = 0;layer < 8;layer++)
377377   {
trunk/src/mame/video/btime.c
r17669r17670
118118{
119119   btime_state *state = machine.driver_data<btime_state>();
120120
121   if (machine.gfx[0]->srcdata == NULL)
122      gfx_element_set_source(machine.gfx[0], state->m_deco_charram);
123   if (machine.gfx[1]->srcdata == NULL)
124      gfx_element_set_source(machine.gfx[1], state->m_deco_charram);
121   if (machine.gfx[0]->srcdata() == NULL)
122      machine.gfx[0]->set_source(state->m_deco_charram);
123   if (machine.gfx[1]->srcdata() == NULL)
124      machine.gfx[1]->set_source(state->m_deco_charram);
125125}
126126
127127
r17669r17670
221221   offset &= 0x1fff;
222222
223223   /* dirty sprite */
224   gfx_element_mark_dirty(machine().gfx[1], offset >> 5);
224   machine().gfx[1]->mark_dirty(offset >> 5);
225225
226226   /* diry char */
227   gfx_element_mark_dirty(machine().gfx[0], offset >> 3);
227   machine().gfx[0]->mark_dirty(offset >> 3);
228228}
229229
230230WRITE8_MEMBER(btime_state::bnj_background_w)
trunk/src/mame/video/nova2001.c
r17669r17670
269269{
270270   nova2001_state *state = machine.driver_data<nova2001_state>();
271271   UINT8 *spriteram = state->m_spriteram;
272   const gfx_element *gfx = machine.gfx[0];
272   gfx_element *gfx = machine.gfx[0];
273273   int offs;
274274
275275   for (offs = 0; offs < 0x800; offs += 32)
r17669r17670
307307{
308308   nova2001_state *state = machine.driver_data<nova2001_state>();
309309   UINT8 *spriteram = state->m_spriteram;
310   const gfx_element *gfx = machine.gfx[0];
310   gfx_element *gfx = machine.gfx[0];
311311   int offs;
312312
313313   for (offs = 0; offs < 0x800; offs += 32)
trunk/src/mame/video/mermaid.c
r17669r17670
307307
308308         rect.min_x = sx;
309309         rect.min_y = sy;
310         rect.max_x = sx + screen.machine().gfx[1]->width - 1;
311         rect.max_y = sy + screen.machine().gfx[1]->height - 1;
310         rect.max_x = sx + screen.machine().gfx[1]->width() - 1;
311         rect.max_y = sy + screen.machine().gfx[1]->height() - 1;
312312
313313         rect &= visarea;
314314
r17669r17670
410410
411411         rect.min_x = sx;
412412         rect.min_y = sy;
413         rect.max_x = sx + screen.machine().gfx[1]->width - 1;
414         rect.max_y = sy + screen.machine().gfx[1]->height - 1;
413         rect.max_x = sx + screen.machine().gfx[1]->width() - 1;
414         rect.max_y = sy + screen.machine().gfx[1]->height() - 1;
415415
416416         rect &= visarea;
417417
r17669r17670
491491
492492         rect.min_x = sx;
493493         rect.min_y = sy;
494         rect.max_x = sx + screen.machine().gfx[1]->width - 1;
495         rect.max_y = sy + screen.machine().gfx[1]->height - 1;
494         rect.max_x = sx + screen.machine().gfx[1]->width() - 1;
495         rect.max_y = sy + screen.machine().gfx[1]->height() - 1;
496496
497497         rect &= visarea;
498498
trunk/src/mame/video/kickgoal.c
r17669r17670
9595{
9696   kickgoal_state *state = machine.driver_data<kickgoal_state>();
9797   UINT16 *spriteram = state->m_spriteram;
98   const gfx_element *gfx = machine.gfx[1];
98   gfx_element *gfx = machine.gfx[1];
9999   int offs;
100100
101101   for (offs = 0; offs < state->m_spriteram.bytes() / 2; offs += 4)
trunk/src/mame/video/bbusters.c
r17669r17670
150150      break;
151151   }
152152
153   return gfx_element_get_data(gfx, (sprite+code) % gfx->total_elements) + ((dy%16) * gfx->line_modulo);
153   return gfx->get_data((sprite+code) % gfx->elements()) + ((dy%16) * gfx->rowbytes());
154154}
155155
156156static void bbusters_draw_block(running_machine &machine, bitmap_ind16 &dest,int x,int y,int size,int flipx,int flipy,UINT32 sprite,int color,int bank,int block)
157157{
158158   bbusters_state *state = machine.driver_data<bbusters_state>();
159159   gfx_element *gfx = machine.gfx[bank];
160   pen_t pen_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
160   pen_t pen_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors());
161161   UINT32 xinc=(state->m_scale_line_count * 0x10000 ) / size;
162162   UINT8 pixel;
163163   int x_index;
trunk/src/mame/video/snk.c
r17669r17670
183183   // bermudat, tdfever use FFFF to blank the background.
184184   // (still call SET_TILE_INFO, otherwise problems might occur on boot when
185185   // the tile data hasn't been initialised)
186   if (code >= machine.gfx[1]->total_elements)
186   if (code >= machine.gfx[1]->elements())
187187      tileinfo.pen_data = state->m_empty_tile;
188188}
189189
r17669r17670
718718      const int scrollx, const int scrolly, const int from, const int to)
719719{
720720   snk_state *state = machine.driver_data<snk_state>();
721   const gfx_element *gfx = machine.gfx[3];
721   gfx_element *gfx = machine.gfx[3];
722722   const UINT8 *source, *finish;
723723
724724   source = state->m_spriteram + from*4;
r17669r17670
763763{
764764   snk_state *state = machine.driver_data<snk_state>();
765765   UINT8 *spriteram = state->m_spriteram;
766   const gfx_element *gfx = machine.gfx[2];
767   const int size = gfx->width;
766   gfx_element *gfx = machine.gfx[2];
767   const int size = gfx->width();
768768   int tile_number, attributes, color, sx, sy;
769769   int xflip,yflip;
770770   int offs;
r17669r17670
787787      xflip = 0;
788788      yflip = 0;
789789
790      if (gfx->total_elements > 256)   // all except jcross
790      if (gfx->elements() > 256)   // all except jcross
791791      {
792792         tile_number |= (attributes & 0x40) << 2;
793793      }
794794
795      if (gfx->total_elements > 512)   // athena
795      if (gfx->elements() > 512)   // athena
796796      {
797797         tile_number |= (attributes & 0x20) << 4;
798798      }
r17669r17670
828828      const int start, const int xscroll, const int yscroll, const UINT8 *source, const int gfxnum )
829829{
830830   snk_state *state = machine.driver_data<snk_state>();
831   const gfx_element *gfx = machine.gfx[gfxnum];
832   const int size = gfx->width;
831   gfx_element *gfx = machine.gfx[gfxnum];
832   const int size = gfx->width();
833833   int tile_number, attributes, color, sx, sy;
834834   int which, finish;
835835
r17669r17670
900900      const int xscroll, const int yscroll, const UINT8 *source, const int gfxnum, const int hw_xflip, const int from, const int to )
901901{
902902   snk_state *state = machine.driver_data<snk_state>();
903   const gfx_element *gfx = machine.gfx[gfxnum];
904   const int size = gfx->width;
903   gfx_element *gfx = machine.gfx[gfxnum];
904   const int size = gfx->width();
905905   int tile_number, attributes, sx, sy, color;
906906   int which;
907907   int flipx, flipy;
trunk/src/mame/video/hyprduel.c
r17669r17670
494494
495495   for (i = 0; i < 0x20; i++)
496496   {
497      gfx_element gfx(machine);
498
499497      if (!(state->m_videoregs[0x02 / 2] & 0x8000))
500498      {
501499         src = state->m_spriteram + (sprites - 1) * (8 / 2);
r17669r17670
569567            if ((gfxstart + width * height - 1) >= gfx_size)
570568               continue;
571569
572            gfx_element_build_temporary(&gfx, machine, base_gfx8 + gfxstart, width, height, width, 0, 256, 0);
570            gfx_element gfx(machine, base_gfx8 + gfxstart, width, height, width, 0, 256);
573571
574572            pdrawgfxzoom_transpen(bitmap,cliprect, &gfx,
575573                        0,
r17669r17670
585583            if ((gfxstart + width / 2 * height - 1) >= gfx_size)
586584               continue;
587585
588            gfx_element_build_temporary(&gfx, machine, base_gfx4 + 2 * gfxstart, width, height, width, 0, 16, 0);
586            gfx_element gfx(machine, base_gfx4 + 2 * gfxstart, width, height, width, 0, 16);
589587
590588            pdrawgfxzoom_transpen(bitmap,cliprect, &gfx,
591589                        0,
trunk/src/mame/video/arcadecl.c
r17669r17670
6767   /* set the intial scroll offset */
6868   atarimo_set_xscroll(0, -12);
6969   atarimo_set_yscroll(0, 0x110);
70   state->m_has_mo = (machine.gfx[0]->total_elements > 10);
70   state->m_has_mo = (machine.gfx[0]->elements() > 10);
7171}
7272
7373
trunk/src/mame/video/suprslam.c
r17669r17670
3131    */
3232
3333   suprslam_state *state = machine.driver_data<suprslam_state>();
34   const gfx_element *gfx = machine.gfx[1];
34   gfx_element *gfx = machine.gfx[1];
3535   UINT16 *source = state->m_spriteram;
3636   UINT16 *source2 = state->m_spriteram;
3737   UINT16 *finish = source + 0x2000/2;
trunk/src/mame/video/segaic24.c
r17669r17670
9494   memset(char_ram, 0, 0x80000);
9595   memset(tile_ram, 0, 0x10000);
9696
97   machine().gfx[char_gfx_index] = gfx_element_alloc(machine(), &char_layout, (UINT8 *)char_ram, machine().total_colors() / 16, 0);
97   machine().gfx[char_gfx_index] = auto_alloc(machine(), gfx_element(machine(), char_layout, (UINT8 *)char_ram, machine().total_colors() / 16, 0));
9898
9999   save_pointer(NAME(tile_ram), 0x10000/2);
100100   save_pointer(NAME(char_ram), 0x80000/2);
r17669r17670
550550   UINT16 old = char_ram[offset];
551551   COMBINE_DATA(char_ram + offset);
552552   if(old != char_ram[offset])
553      gfx_element_mark_dirty(machine().gfx[char_gfx_index], offset / 16);
553      machine().gfx[char_gfx_index]->mark_dirty(offset / 16);
554554}
555555
556556READ32_MEMBER(segas24_tile::tile32_r)
trunk/src/mame/video/lemmings.c
r17669r17670
3838   state->m_vram_tilemap->set_transparent_pen(0);
3939   state->m_bitmap0.fill(0x100);
4040
41   gfx_element_set_source(machine.gfx[2], state->m_vram_buffer);
41   machine.gfx[2]->set_source(state->m_vram_buffer);
4242
4343   machine.device<decospr_device>("spritegen")->alloc_sprite_bitmap();
4444   machine.device<decospr_device>("spritegen2")->alloc_sprite_bitmap();
r17669r17670
9797
9898   /* Copy pixel to buffer for easier decoding later */
9999   tile = ((sx / 8) * 32) + (sy / 8);
100   gfx_element_mark_dirty(machine().gfx[2], tile);
100   machine().gfx[2]->mark_dirty(tile);
101101   m_vram_buffer[(tile * 64) + ((sx & 7)) + ((sy & 7) * 8)] = (src >> 8) & 0xf;
102102
103103   sx += 1; /* Update both pixels in the word */
trunk/src/mame/video/tiamc1.c
r17669r17670
2323      m_charram[offset + 0x1800] = data;
2424
2525   if ((m_layers_ctrl & (16|8|4|2)) != (16|8|4|2))
26      gfx_element_mark_dirty(machine().gfx[0], (offset / 8) & 0xff);
26      machine().gfx[0]->mark_dirty((offset / 8) & 0xff);
2727
2828   if(!(m_layers_ctrl & 1)) {
2929      m_tileram[offset] = data;
r17669r17670
153153   state_save_register_global(machine, state->m_bg_vshift);
154154   state_save_register_global(machine, state->m_bg_hshift);
155155
156   gfx_element_set_source(machine.gfx[0], state->m_charram);
156   machine.gfx[0]->set_source(state->m_charram);
157157}
158158
159159static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
trunk/src/mame/video/toaplan1.c
r17669r17670
934934***************************************************************************/
935935
936936// custom function to draw a single sprite. needed to keep correct sprites - sprites and sprites - tilemaps priorities
937static void toaplan1_draw_sprite_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
937static void toaplan1_draw_sprite_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
938938      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
939939      int priority)
940940{
941   int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
942   const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
941   int pal_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors());
942   const UINT8 *source_base = gfx->get_data(code % gfx->elements());
943943   bitmap_ind8 &priority_bitmap = gfx->machine().priority_bitmap;
944   int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16;
945   int sprite_screen_width = ((1<<16)*gfx->width+0x8000)>>16;
944   int sprite_screen_height = ((1<<16)*gfx->height()+0x8000)>>16;
945   int sprite_screen_width = ((1<<16)*gfx->width()+0x8000)>>16;
946946
947947   if (sprite_screen_width && sprite_screen_height)
948948   {
949949      /* compute sprite increment per screen pixel */
950      int dx = (gfx->width<<16)/sprite_screen_width;
951      int dy = (gfx->height<<16)/sprite_screen_height;
950      int dx = (gfx->width()<<16)/sprite_screen_width;
951      int dy = (gfx->height()<<16)/sprite_screen_height;
952952
953953      int ex = sx+sprite_screen_width;
954954      int ey = sy+sprite_screen_height;
r17669r17670
10061006
10071007         for( y=sy; y<ey; y++ )
10081008         {
1009            const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
1009            const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
10101010            UINT16 *dest = &dest_bmp.pix16(y);
10111011            UINT8 *pri = &priority_bitmap.pix8(y);
10121012
trunk/src/mame/video/segag80r.c
r17669r17670
194194         3,   rg_resistances, state->m_gweights, 220, 0,
195195         2,   b_resistances,  state->m_bweights, 220, 0);
196196
197   gfx_element_set_source(machine.gfx[0], &videoram[0x800]);
197   machine.gfx[0]->set_source(&videoram[0x800]);
198198
199199   /* allocate paletteram */
200200   state->m_generic_paletteram_8.allocate(0x80);
r17669r17670
270270
271271   /* track which characters are dirty */
272272   if (offset & 0x800)
273      gfx_element_mark_dirty(machine().gfx[0], (offset & 0x7ff) / 8);
273      machine().gfx[0]->mark_dirty((offset & 0x7ff) / 8);
274274}
275275
276276
trunk/src/mame/video/taitojc.c
r17669r17670
6262WRITE32_MEMBER(taitojc_state::taitojc_char_w)
6363{
6464   COMBINE_DATA(m_char_ram + offset);
65   gfx_element_mark_dirty(machine().gfx[m_gfx_index], offset/32);
65   machine().gfx[m_gfx_index]->mark_dirty(offset/32);
6666}
6767
6868// Object data format:
r17669r17670
320320   state->m_tile_ram = auto_alloc_array_clear(machine, UINT32, 0x4000/4);
321321
322322   /* create the char set (gfx will then be updated dynamically from RAM) */
323   machine.gfx[state->m_gfx_index] = gfx_element_alloc(machine, &taitojc_char_layout, (UINT8 *)state->m_char_ram, machine.total_colors() / 16, 0);
323   machine.gfx[state->m_gfx_index] = auto_alloc(machine, gfx_element(machine, taitojc_char_layout, (UINT8 *)state->m_char_ram, machine.total_colors() / 16, 0));
324324
325325   state->m_texture = auto_alloc_array(machine, UINT8, 0x400000);
326326
trunk/src/mame/video/bionicc.c
r17669r17670
206206   bionicc_state *state = machine.driver_data<bionicc_state>();
207207   UINT16 *buffered_spriteram = state->m_spriteram->buffer();
208208   int offs;
209   const gfx_element *gfx = machine.gfx[3];
209   gfx_element *gfx = machine.gfx[3];
210210
211211   for (offs = (state->m_spriteram->bytes() - 8) / 2; offs >= 0; offs -= 4)
212212   {
trunk/src/mame/video/playmark.c
r17669r17670
390390{
391391   playmark_state *state = machine.driver_data<playmark_state>();
392392   int offs, start_offset = state->m_spriteram.bytes() / 2 - 4;
393   int height = machine.gfx[0]->height;
394   int colordiv = machine.gfx[0]->color_granularity / 16;
393   int height = machine.gfx[0]->height();
394   int colordiv = machine.gfx[0]->granularity() / 16;
395395   UINT16 *spriteram = state->m_spriteram;
396396
397397   // find the "end of list" to draw the sprites in reverse order
r17669r17670
434434{
435435   playmark_state *state = machine.driver_data<playmark_state>();
436436   int offs, start_offset = state->m_spriteram.bytes() / 2 - 4;
437   int height = machine.gfx[0]->height;
437   int height = machine.gfx[0]->height();
438438   UINT16 *spriteram = state->m_spriteram;
439439
440440   // find the "end of list" to draw the sprites in reverse order
trunk/src/mame/video/st0016.c
r17669r17670
112112WRITE8_MEMBER(st0016_state::st0016_character_ram_w)
113113{
114114   st0016_charram[ST0016_CHAR_BANK_SIZE*st0016_char_bank+offset]=data;
115   gfx_element_mark_dirty(machine().gfx[st0016_ramgfx], st0016_char_bank);
115   machine().gfx[st0016_ramgfx]->mark_dirty(st0016_char_bank);
116116}
117117
118118READ8_MEMBER(st0016_state::st0016_vregs_r)
r17669r17670
360360                     tileno = (code+i0++)&ST0016_CHAR_BANK_MASK ;
361361
362362                     gfxoffs = 0;
363                     srcgfx= gfx_element_get_data(gfx, tileno);
363                     srcgfx= gfx->get_data(tileno);
364364
365365                     for (yloop=0; yloop<8; yloop++)
366366                     {
r17669r17670
450450   assert(gfx_index != MAX_GFX_ELEMENTS);
451451
452452   /* create the char set (gfx will then be updated dynamically from RAM) */
453   machine.gfx[gfx_index] = gfx_element_alloc(machine, &charlayout, (UINT8 *) st0016_charram, 0x40, 0);
453   machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, charlayout, (UINT8 *) st0016_charram, 0x40, 0));
454454   st0016_ramgfx = gfx_index;
455455
456456   spr_dx=0;
r17669r17670
526526                     ypos = y*8+spr_dy;//+((st0016_vregs[j+2]==0xaf)?0x50:0);//hack for mayjinsen title screen
527527                     xpos = x*8+spr_dx;
528528                     gfxoffs = 0;
529                     srcgfx= gfx_element_get_data(gfx, code);
529                     srcgfx= gfx->get_data(code);
530530
531531                     for (yloop=0; yloop<8; yloop++)
532532                     {
trunk/src/mame/video/battlex.c
r17669r17670
6363static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
6464{
6565   battlex_state *state = machine.driver_data<battlex_state>();
66   const gfx_element *gfx = machine.gfx[1];
66   gfx_element *gfx = machine.gfx[1];
6767   UINT8 *source = state->m_spriteram;
6868   UINT8 *finish = state->m_spriteram + 0x200;
6969
trunk/src/mame/video/mrflea.c
r17669r17670
4343static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
4444{
4545   mrflea_state *state = machine.driver_data<mrflea_state>();
46   const gfx_element *gfx = machine.gfx[0];
46   gfx_element *gfx = machine.gfx[0];
4747   const UINT8 *source = state->m_spriteram;
4848   const UINT8 *finish = source + 0x100;
4949   rectangle clip = machine.primary_screen->visible_area();
r17669r17670
7575{
7676   mrflea_state *state = machine.driver_data<mrflea_state>();
7777   const UINT8 *source = state->m_videoram;
78   const gfx_element *gfx = machine.gfx[1];
78   gfx_element *gfx = machine.gfx[1];
7979   int sx, sy;
8080   int base = 0;
8181
trunk/src/mame/video/glass.c
r17669r17670
166166{
167167   glass_state *state = machine.driver_data<glass_state>();
168168   int i;
169   const gfx_element *gfx = machine.gfx[0];
169   gfx_element *gfx = machine.gfx[0];
170170
171171   for (i = 3; i < (0x1000 - 6) / 2; i += 4)
172172   {
trunk/src/mame/video/toaplan2.c
r17669r17670
7676static void truxton2_postload(running_machine &machine)
7777{
7878   for (int i = 0; i < 1024; i++)
79      gfx_element_mark_dirty(machine.gfx[2], i);
79      machine.gfx[2]->mark_dirty(i);
8080}
8181
8282VIDEO_START( toaplan2 )
r17669r17670
112112   VIDEO_START_CALL( toaplan2 );
113113
114114   /* Create the Text tilemap for this game */
115   gfx_element_set_source(machine.gfx[2], reinterpret_cast<UINT8 *>(state->m_tx_gfxram16.target()));
115   machine.gfx[2]->set_source(reinterpret_cast<UINT8 *>(state->m_tx_gfxram16.target()));
116116   machine.save().register_postload(save_prepost_delegate(FUNC(truxton2_postload), &machine));
117117
118118   truxton2_create_tx_tilemap(machine);
r17669r17670
177177
178178   /* Create the Text tilemap for this game */
179179   state->m_tx_gfxram16.allocate(RAIZING_TX_GFXRAM_SIZE/2);
180   gfx_element_set_source(machine.gfx[2], reinterpret_cast<UINT8 *>(state->m_tx_gfxram16.target()));
180   machine.gfx[2]->set_source(reinterpret_cast<UINT8 *>(state->m_tx_gfxram16.target()));
181181   machine.save().register_postload(save_prepost_delegate(FUNC(truxton2_postload), &machine));
182182
183183   truxton2_create_tx_tilemap(machine);
r17669r17670
246246   {
247247      int code = offset/32;
248248      COMBINE_DATA(&m_tx_gfxram16[offset]);
249      gfx_element_mark_dirty(machine().gfx[2], code);
249      machine().gfx[2]->mark_dirty(code);
250250   }
251251}
252252
r17669r17670
268268   memcpy(dest, m_mainram16, m_mainram16.bytes());
269269
270270   for (int i = 0; i < 1024; i++)
271      gfx_element_mark_dirty(machine().gfx[2], i);
271      machine().gfx[2]->mark_dirty(i);
272272}
273273
274274WRITE16_MEMBER(toaplan2_state::batrider_unknown_dma_w)
trunk/src/mame/video/gaelco.c
r17669r17670
124124{
125125   gaelco_state *state = machine.driver_data<gaelco_state>();
126126   int i, x, y, ex, ey;
127   const gfx_element *gfx = machine.gfx[0];
127   gfx_element *gfx = machine.gfx[0];
128128
129129   static const int x_offset[2] = {0x0,0x2};
130130   static const int y_offset[2] = {0x0,0x1};
trunk/src/mame/video/wecleman.c
r17669r17670
610610         if ((road>>8) != 0x04) continue;
611611         road &= YMASK;
612612
613         src_ptr = gfx_element_get_data(machine.gfx[1], (road << 3));
614         gfx_element_get_data(machine.gfx[1], (road << 3) + 1);
615         gfx_element_get_data(machine.gfx[1], (road << 3) + 2);
616         gfx_element_get_data(machine.gfx[1], (road << 3) + 3);
617         gfx_element_get_data(machine.gfx[1], (road << 3) + 4);
618         gfx_element_get_data(machine.gfx[1], (road << 3) + 5);
619         gfx_element_get_data(machine.gfx[1], (road << 3) + 6);
620         gfx_element_get_data(machine.gfx[1], (road << 3) + 7);
613         src_ptr = machine.gfx[1]->get_data((road << 3));
614         machine.gfx[1]->get_data((road << 3) + 1);
615         machine.gfx[1]->get_data((road << 3) + 2);
616         machine.gfx[1]->get_data((road << 3) + 3);
617         machine.gfx[1]->get_data((road << 3) + 4);
618         machine.gfx[1]->get_data((road << 3) + 5);
619         machine.gfx[1]->get_data((road << 3) + 6);
620         machine.gfx[1]->get_data((road << 3) + 7);
621621         mdy = ((road * MIDCURB_DY) >> 8) * bitmap.rowpixels();
622622         tdy = ((road * TOPCURB_DY) >> 8) * bitmap.rowpixels();
623623
r17669r17670
656656
657657// blends two 8x8x16bpp direct RGB tilemaps
658658static void draw_cloud(bitmap_rgb32 &bitmap,
659             const gfx_element *gfx,
659             gfx_element *gfx,
660660             UINT16 *tm_base,
661661             int x0, int y0,            // target coordinate
662662             int xcount, int ycount,      // number of tiles to draw in x and y
r17669r17670
677677
678678   if (alpha > 0x1f) return;
679679
680   tilew = gfx->width;
681   tileh = gfx->height;
680   tilew = gfx->width();
681   tileh = gfx->height();
682682
683683   tmmaskx = (1<<tmw_l2) - 1;
684684   tmmasky = (1<<tmh_l2) - 1;
r17669r17670
693693
694694   dst_base = &bitmap.pix32(y0+dy, x0+dx);
695695
696   pal_base = gfx->machine().pens + pal_offset * gfx->color_granularity;
696   pal_base = gfx->machine().pens + pal_offset * gfx->granularity();
697697
698698   alpha <<= 6;
699699
r17669r17670
713713         // Wec Le Mans specific: decodes tile color in EAX
714714         UINT16 tile_color = ((tiledata >> 5) & 0x78) + (tiledata >> 12);
715715
716         src_ptr = gfx_element_get_data(gfx, tile_index);
717         pal_ptr = pal_base + tile_color * gfx->color_granularity;
716         src_ptr = gfx->get_data(tile_index);
717         pal_ptr = pal_base + tile_color * gfx->granularity();
718718         dst_ptr = dst_base + j * tilew;
719719
720720         /* alpha case */
r17669r17670
967967   state->m_txt_tilemap->set_scrolly(0, -BMP_PAD );
968968
969969   // patches out a mysterious pixel floating in the sky (tile decoding bug?)
970   *(machine.gfx[0]->gfxdata + (machine.gfx[0]->char_modulo*0xaca+7)) = 0;
970   *const_cast<UINT8 *>(machine.gfx[0]->get_data(0xaca)+7) = 0;
971971}
972972
973973//  Callbacks for the K051316
trunk/src/mame/video/bankp.c
r17669r17670
6969   /* color_prom now points to the beginning of the lookup table */
7070
7171   /* charset #1 lookup table */
72   for (i = 0; i < machine.gfx[0]->total_colors * machine.gfx[0]->color_granularity; i++)
73      colortable_entry_set_value(machine.colortable, machine.gfx[0]->color_base + i, *color_prom++ & 0x0f);
72   for (i = 0; i < machine.gfx[0]->colors() * machine.gfx[0]->granularity(); i++)
73      colortable_entry_set_value(machine.colortable, machine.gfx[0]->colorbase() + i, *color_prom++ & 0x0f);
7474
7575   color_prom += 128;   /* skip the bottom half of the PROM - seems to be not used */
7676
7777   /* charset #2 lookup table */
78   for (i = 0; i < machine.gfx[1]->total_colors * machine.gfx[1]->color_granularity; i++)
79      colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + i, *color_prom++ & 0x0f);
78   for (i = 0; i < machine.gfx[1]->colors() * machine.gfx[1]->granularity(); i++)
79      colortable_entry_set_value(machine.colortable, machine.gfx[1]->colorbase() + i, *color_prom++ & 0x0f);
8080
8181   /* the bottom half of the PROM seems to be not used */
8282}
trunk/src/mame/video/munchmo.c
r17669r17670
5050static void draw_status( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
5151{
5252   munchmo_state *state = machine.driver_data<munchmo_state>();
53   const gfx_element *gfx = machine.gfx[0];
53   gfx_element *gfx = machine.gfx[0];
5454   int row;
5555
5656   for (row = 0; row < 4; row++)
r17669r17670
8383*/
8484   munchmo_state *state = machine.driver_data<munchmo_state>();
8585   UINT8 *rom = state->memregion("gfx2")->base();
86   const gfx_element *gfx = machine.gfx[1];
86   gfx_element *gfx = machine.gfx[1];
8787   int offs;
8888
8989   for (offs = 0; offs < 0x100; offs++)
r17669r17670
121121   int flags = state->m_vreg[7];                     /*   XB?????? */
122122   int xadjust = - 128 - 16 - ((flags & 0x80) ? 1 : 0);
123123   int bank = (flags & 0x40) ? 1 : 0;
124   const gfx_element *gfx = machine.gfx[2 + bank];
124   gfx_element *gfx = machine.gfx[2 + bank];
125125   int color_base = state->m_palette_bank * 4 + 3;
126126   int i, j;
127127   int firstsprite = state->m_vreg[4] & 0x3f;
trunk/src/mame/video/tetrisp2.c
r17669r17670
418418      if (ysize > 0x100 - ty)
419419         ysize = 0x100 - ty;
420420
421      gfx_element_set_source_clip(gfx, tx, xsize, ty, ysize);
421      gfx->set_source_clip(tx, xsize, ty, ysize);
422422
423423      {
424424         primask = 0;
trunk/src/mame/video/drgnmst.c
r17669r17670
6060static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
6161{
6262   drgnmst_state *state = machine.driver_data<drgnmst_state>();
63   const gfx_element *gfx = machine.gfx[0];
63   gfx_element *gfx = machine.gfx[0];
6464   UINT16 *source = state->m_spriteram;
6565   UINT16 *finish = source + 0x800 / 2;
6666
trunk/src/mame/video/namcos22.c
r17669r17670
768768
769769static void
770770poly3d_DrawSprite(
771   bitmap_rgb32 &dest_bmp, const gfx_element *gfx, UINT32 code,
771   bitmap_rgb32 &dest_bmp, gfx_element *gfx, UINT32 code,
772772   UINT32 color, int flipx, int flipy, int sx, int sy,
773773   int scalex, int scaley, int cz_factor, int prioverchar, int alpha )
774774{
775775   namcos22_state *state = gfx->machine().driver_data<namcos22_state>();
776   int sprite_screen_height = (scaley*gfx->height+0x8000)>>16;
777   int sprite_screen_width = (scalex*gfx->width+0x8000)>>16;
776   int sprite_screen_height = (scaley*gfx->height()+0x8000)>>16;
777   int sprite_screen_width = (scalex*gfx->width()+0x8000)>>16;
778778   if (sprite_screen_width && sprite_screen_height)
779779   {
780780      float fsx = sx;
781781      float fsy = sy;
782      float fwidth = gfx->width;
783      float fheight = gfx->height;
782      float fwidth = gfx->width();
783      float fheight = gfx->height();
784784      float fsw = sprite_screen_width;
785785      float fsh = sprite_screen_height;
786786      poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(state->m_poly);
r17669r17670
793793      extra->machine = &gfx->machine();
794794      extra->alpha = alpha;
795795      extra->prioverchar = 2 | prioverchar;
796      extra->line_modulo = gfx->line_modulo;
796      extra->line_modulo = gfx->rowbytes();
797797      extra->flipx = flipx;
798798      extra->flipy = flipy;
799      extra->pens = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color&0x7f)];
799      extra->pens = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color&0x7f)];
800800      extra->priority_bitmap = &gfx->machine().priority_bitmap;
801      extra->source = gfx_element_get_data(gfx, code % gfx->total_elements);
801      extra->source = gfx->get_data(code % gfx->elements());
802802
803803      vert[0].x = fsx;
804804      vert[0].y = fsy;
r17669r17670
14661466} /* namcos22_draw_direct_poly */
14671467
14681468static void
1469Prepare3dTexture( running_machine &machine, void *pTilemapROM, void *pTextureROM )
1469Prepare3dTexture( running_machine &machine, void *pTilemapROM, const void *pTextureROM )
14701470{
14711471   namcos22_state *state = machine.driver_data<namcos22_state>();
14721472   int i;
r17669r17670
26992699WRITE32_MEMBER(namcos22_state::namcos22_cgram_w)
27002700{
27012701   COMBINE_DATA( &m_cgram[offset] );
2702   gfx_element_mark_dirty(machine().gfx[GFX_CHAR],offset/32);
2702   machine().gfx[GFX_CHAR]->mark_dirty(offset/32);
27032703}
27042704
27052705READ32_MEMBER(namcos22_state::namcos22_paletteram_r)
r17669r17670
27372737   state->m_mbDSPisActive = 0;
27382738   memset( state->m_polygonram, 0xcc, 0x20000 );
27392739
2740   for (code = 0; code < machine.gfx[GFX_TEXTURE_TILE]->total_elements; code++)
2741      gfx_element_decode(machine.gfx[GFX_TEXTURE_TILE], code);
2740   for (code = 0; code < machine.gfx[GFX_TEXTURE_TILE]->elements(); code++)
2741      machine.gfx[GFX_TEXTURE_TILE]->decode(code);
27422742
2743   Prepare3dTexture(machine, state->memregion("textilemap")->base(), machine.gfx[GFX_TEXTURE_TILE]->gfxdata );
2743   Prepare3dTexture(machine, state->memregion("textilemap")->base(), machine.gfx[GFX_TEXTURE_TILE]->get_data(0) );
27442744   state->m_dirtypal = auto_alloc_array(machine, UINT8, NAMCOS22_PALETTE_SIZE/4);
27452745   state->m_mPtRomSize = state->memregion("pointrom")->bytes()/3;
27462746   state->m_mpPolyL = state->memregion("pointrom")->base();
r17669r17670
27512751   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(namcos22_reset), &machine));
27522752   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(namcos22_exit), &machine));
27532753
2754   gfx_element_set_source(machine.gfx[GFX_CHAR], (UINT8 *)state->m_cgram.target());
2754   machine.gfx[GFX_CHAR]->set_source((UINT8 *)state->m_cgram.target());
27552755}
27562756
27572757VIDEO_START( namcos22 )
trunk/src/mame/video/galaxold.c
r17669r17670
483483
484484   state->m_bg_tilemap->set_scroll_cols(32);
485485
486   state->m_color_mask = (machine.gfx[0]->color_granularity == 4) ? 7 : 3;
486   state->m_color_mask = (machine.gfx[0]->granularity() == 4) ? 7 : 3;
487487}
488488
489489VIDEO_START( galaxold )
trunk/src/mame/video/wgp.c
r17669r17670
352352   UINT8 small_sprite, col, flipx, flipy;
353353   UINT16 code, bigsprite, map_index;
354354//  UINT16 rotate = 0;
355   UINT16 tile_mask = (machine.gfx[0]->total_elements) - 1;
355   UINT16 tile_mask = (machine.gfx[0]->elements()) - 1;
356356   static const int primasks[2] = {0x0, 0xfffc};   /* fff0 => under rhs of road only */
357357
358358   for (offs = 0x1ff; offs >= 0; offs--)
trunk/src/mame/video/atarisy1.c
r17669r17670
664664   switch (bpp)
665665   {
666666   case 4:
667      machine.gfx[gfx_index] = gfx_element_alloc(machine, &objlayout_4bpp, srcdata, 0x40, 256);
667      machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, objlayout_4bpp, srcdata, 0x40, 256));
668668      break;
669669
670670   case 5:
671      machine.gfx[gfx_index] = gfx_element_alloc(machine, &objlayout_5bpp, srcdata, 0x40, 256);
671      machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, objlayout_5bpp, srcdata, 0x40, 256));
672672      break;
673673
674674   case 6:
675      machine.gfx[gfx_index] = gfx_element_alloc(machine, &objlayout_6bpp, srcdata, 0x40, 256);
675      machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, objlayout_6bpp, srcdata, 0x40, 256));
676676      break;
677677
678678   default:
r17669r17670
680680   }
681681
682682   /* set the color information */
683   machine.gfx[gfx_index]->color_granularity = 8;
683   machine.gfx[gfx_index]->set_granularity(8);
684684   state->m_bank_color_shift[gfx_index] = bpp - 3;
685685
686686   /* set the entry and return it */
trunk/src/mame/video/ssv.c
r17669r17670
141141#endif
142142
143143
144static void ssv_drawgfx(   bitmap_ind16 &bitmap, const rectangle &cliprect, const gfx_element *gfx,
144static void ssv_drawgfx(   bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx,
145145               UINT32 code,UINT32 color,int flipx,int flipy,int x0,int y0,
146146               int shadow )
147147{
r17669r17670
152152   int sx, x1, dx;
153153   int sy, y1, dy;
154154
155   addr   =   gfx_element_get_data(gfx, code  % gfx->total_elements);
156   color   =   gfx->color_granularity * (color % gfx->total_colors);
155   addr   =   gfx->get_data(code  % gfx->elements());
156   color   =   gfx->granularity() * (color % gfx->colors());
157157
158   if ( flipx )   {   x1 = x0-1;            x0 += gfx->width-1;      dx = -1;   }
159   else         {   x1 = x0 + gfx->width;                     dx =  1;   }
158   if ( flipx )   {   x1 = x0-1;            x0 += gfx->width()-1;      dx = -1;   }
159   else         {   x1 = x0 + gfx->width();                     dx =  1;   }
160160
161   if ( flipy )   {   y1 = y0-1;            y0 += gfx->height-1;   dy = -1;   }
162   else         {   y1 = y0 + gfx->height;                     dy =  1;   }
161   if ( flipy )   {   y1 = y0-1;            y0 += gfx->height()-1;   dy = -1;   }
162   else         {   y1 = y0 + gfx->height();                     dy =  1;   }
163163
164164#define SSV_DRAWGFX(SETPIXELCOLOR)                                    \
165165   for ( sy = y0; sy != y1; sy += dy )                                 \
r17669r17670
178178         }                                                   \
179179      }                                                      \
180180                                                            \
181      addr   +=   gfx->line_modulo;                                 \
181      addr   +=   gfx->rowbytes();                                 \
182182   }
183183
184184   if (shadow)
r17669r17670
194194
195195VIDEO_START( ssv )
196196{
197   machine.gfx[0]->color_granularity = 64; /* 256 colour sprites with palette selectable on 64 colour boundaries */
197   machine.gfx[0]->set_granularity(64); /* 256 colour sprites with palette selectable on 64 colour boundaries */
198198}
199199
200200VIDEO_START( eaglshot )
r17669r17670
204204
205205   state->m_eaglshot_gfxram      =   auto_alloc_array(machine, UINT16, 16 * 0x40000 / 2);
206206
207   gfx_element_set_source(machine.gfx[0], (UINT8 *)state->m_eaglshot_gfxram);
208   gfx_element_set_source(machine.gfx[1], (UINT8 *)state->m_eaglshot_gfxram);
207   machine.gfx[0]->set_source((UINT8 *)state->m_eaglshot_gfxram);
208   machine.gfx[1]->set_source((UINT8 *)state->m_eaglshot_gfxram);
209209}
210210
211211static TILE_GET_INFO( get_tile_info_0 )
trunk/src/mame/video/tceptor.c
r17669r17670
261261   auto_free(machine, buffer);
262262
263263   /* decode the graphics */
264   machine.gfx[gfx_index] = gfx_element_alloc(machine, &bg_layout, machine.root_device().memregion(region)->base(), 64, 2048);
264   machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, bg_layout, machine.root_device().memregion(region)->base(), 64, 2048));
265265}
266266
267267static void decode_sprite(running_machine &machine, int gfx_index, const gfx_layout *layout, const void *data)
268268{
269269   /* decode the graphics */
270   machine.gfx[gfx_index] = gfx_element_alloc(machine, layout, (const UINT8 *)data, 64, 1024);
270   machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, *layout, (const UINT8 *)data, 64, 1024));
271271}
272272
273273// fix sprite order
trunk/src/mame/video/metro.c
r17669r17670
163163   }
164164   else if (((tile & 0x00f00000) == 0x00f00000)   && (state->m_support_8bpp)) /* draw tile as 8bpp */
165165   {
166      const gfx_element *gfx1 = machine.gfx[big?3:1];
166      gfx_element *gfx1 = machine.gfx[big?3:1];
167167      UINT32 tile2 = big ? ((tile & 0xfffff) + 8*(code & 0xf)) :
168168                          ((tile & 0xfffff) + 2*(code & 0xf));
169169      const UINT8* data;
170170      UINT8 flipxy = (code & 0x6000) >> 13;
171171
172      if (tile2 < gfx1->total_elements)
173         data = gfx_element_get_data(gfx1, tile2);
172      if (tile2 < gfx1->elements())
173         data = gfx1->get_data(tile2);
174174      else
175175      {
176176         *pix |= 0;
r17669r17670
196196   }
197197   else
198198   {
199      const gfx_element *gfx1 = machine.gfx[big?2:0];
199      gfx_element *gfx1 = machine.gfx[big?2:0];
200200      UINT32 tile2 = big ? ((tile & 0xfffff) + 4*(code & 0xf)) :
201201                          ((tile & 0xfffff) +   (code & 0xf));
202202      const UINT8* data;
203203      UINT8 flipxy = (code & 0x6000) >> 13;
204204
205      if (tile2 < gfx1->total_elements)
206         data = gfx_element_get_data(gfx1, tile2);
205      if (tile2 < gfx1->elements())
206         data = gfx1->get_data(tile2);
207207      else
208208      {
209209         *pix |= 0;
r17669r17670
468468
469469   for (i = 0; i < 0x20; i++)
470470   {
471      gfx_element gfx(machine);
472
473471      if (!(state->m_videoregs[0x02/2] & 0x8000))
474472      {
475473         src = state->m_spriteram + (sprites - 1) * (8 / 2);
r17669r17670
541539            if ((gfxstart + width * height - 1) >= gfx_size)
542540               continue;
543541
544            gfx_element_build_temporary(&gfx, machine, base_gfx8 + gfxstart, width, height, width, 0, 256, 0);
542            gfx_element gfx(machine, base_gfx8 + gfxstart, width, height, width, 0, 256);
545543
546544            pdrawgfxzoom_transpen(   bitmap,cliprect, &gfx,
547545                        0,
r17669r17670
557555            if ((gfxstart + width / 2 * height - 1) >= gfx_size)
558556               continue;
559557
560            gfx_element_build_temporary(&gfx, machine, base_gfx4 + 2 * gfxstart, width, height, width, 0, 16, 0);
558            gfx_element gfx(machine, base_gfx4 + 2 * gfxstart, width, height, width, 0, 16);
561559
562560            pdrawgfxzoom_transpen(   bitmap,cliprect, &gfx,
563561                        0,
trunk/src/mame/video/angelkds.c
r17669r17670
136136   angelkds_state *state = machine.driver_data<angelkds_state>();
137137   const UINT8 *source = state->m_spriteram + 0x100 - 4;
138138   const UINT8 *finish = state->m_spriteram;
139   const gfx_element *gfx = machine.gfx[3];
139   gfx_element *gfx = machine.gfx[3];
140140
141141   while (source >= finish)
142142   {
trunk/src/mame/video/usgames.c
r17669r17670
4646{
4747   usgames_state *state = machine.driver_data<usgames_state>();
4848   state->m_tilemap = tilemap_create(machine, get_usgames_tile_info,TILEMAP_SCAN_ROWS, 8, 8,64,32);
49   gfx_element_set_source(machine.gfx[0], state->m_charram);
49   machine.gfx[0]->set_source(state->m_charram);
5050}
5151
5252
r17669r17670
5959WRITE8_MEMBER(usgames_state::usgames_charram_w)
6060{
6161   m_charram[offset] = data;
62   gfx_element_mark_dirty(machine().gfx[0], offset/8);
62   machine().gfx[0]->mark_dirty(offset/8);
6363}
6464
6565
trunk/src/mame/video/shadfrce.c
r17669r17670
124124    */
125125
126126   shadfrce_state *state = machine.driver_data<shadfrce_state>();
127   const gfx_element *gfx = machine.gfx[1];
127   gfx_element *gfx = machine.gfx[1];
128128   UINT16 *finish = state->m_spvideoram_old;
129129   UINT16 *source = finish + 0x2000/2 - 8;
130130   int hcount;
trunk/src/mame/video/ninjakd2.c
r17669r17670
347347static void draw_sprites(running_machine& machine, bitmap_ind16 &bitmap)
348348{
349349   ninjakd2_state *state = machine.driver_data<ninjakd2_state>();
350   const gfx_element* const gfx = machine.gfx[1];
350   gfx_element* const gfx = machine.gfx[1];
351351   int const big_xshift = state->m_robokid_sprites ? 1 : 0;
352352   int const big_yshift = state->m_robokid_sprites ? 0 : 1;
353353
trunk/src/mame/video/m52.c
r17669r17670
342342      rect.max_y = ypos + 2 * BGHEIGHT - 1;
343343   }
344344
345   bitmap.fill(machine.gfx[image]->color_base + 3, rect);
345   bitmap.fill(machine.gfx[image]->colorbase() + 3, rect);
346346}
347347
348348
trunk/src/mame/video/gng.c
r17669r17670
108108{
109109   gng_state *state = machine.driver_data<gng_state>();
110110   UINT8 *buffered_spriteram = state->m_spriteram->buffer();
111   const gfx_element *gfx = machine.gfx[2];
111   gfx_element *gfx = machine.gfx[2];
112112   int offs;
113113
114114
trunk/src/mame/video/jalblend.c
r17669r17670
8585}
8686
8787template<class _BitmapClass>
88void jal_blend_drawgfx_common(_BitmapClass &dest_bmp,const rectangle &clip,const gfx_element *gfx,
88void jal_blend_drawgfx_common(_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx,
8989                     UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
9090                     int transparent_color)
9191{
r17669r17670
9898   /* Start drawing */
9999   if (gfx)
100100   {
101      const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
102      const UINT8 *alpha = &jal_blend_table[gfx->color_granularity * (color % gfx->total_colors)];
103      const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
101      const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
102      const UINT8 *alpha = &jal_blend_table[gfx->granularity() * (color % gfx->colors())];
103      const UINT8 *source_base = gfx->get_data(code % gfx->elements());
104104      int x_index_base, y_index, sx, sy, ex, ey;
105105      int xinc, yinc;
106106
107107      xinc = flipx ? -1 : 1;
108108      yinc = flipy ? -1 : 1;
109109
110      x_index_base = flipx ? gfx->width-1 : 0;
111      y_index = flipy ? gfx->height-1 : 0;
110      x_index_base = flipx ? gfx->width()-1 : 0;
111      y_index = flipy ? gfx->height()-1 : 0;
112112
113113      /* start coordinates */
114114      sx = offsx;
115115      sy = offsy;
116116
117117      /* end coordinates */
118      ex = sx + gfx->width;
119      ey = sy + gfx->height;
118      ex = sx + gfx->width();
119      ey = sy + gfx->height();
120120
121121      if (sx < clip.min_x)
122122      { /* clip left */
r17669r17670
147147         /* taken from case 7: TRANSPARENCY_ALPHARANGE */
148148         for (y = sy; y < ey; y++)
149149         {
150            const UINT8 *source = source_base + y_index*gfx->line_modulo;
150            const UINT8 *source = source_base + y_index*gfx->rowbytes();
151151            typename _BitmapClass::pixel_t *dest = &dest_bmp.pix(y);
152152            int x_index = x_index_base;
153153            for (x = sx; x < ex; x++)
r17669r17670
174174   }
175175}
176176
177void jal_blend_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
177void jal_blend_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
178178                     UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
179179                     int transparent_color)
180180{ jal_blend_drawgfx_common(dest_bmp, clip, gfx, code, color, flipx, flipy, offsx, offsy, transparent_color); }
181void jal_blend_drawgfx(bitmap_rgb32 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
181void jal_blend_drawgfx(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
182182                     UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
183183                     int transparent_color)
184184{ jal_blend_drawgfx_common(dest_bmp, clip, gfx, code, color, flipx, flipy, offsx, offsy, transparent_color); }
trunk/src/mame/video/jalblend.h
r17669r17670
22void jal_blend_set(int color, UINT8 val);
33
44rgb_t jal_blend_func(rgb_t dest, rgb_t addMe, UINT8 alpha);
5void jal_blend_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
5void jal_blend_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
66                     UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
77                     int transparent_color);
8void jal_blend_drawgfx(bitmap_rgb32 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
8void jal_blend_drawgfx(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
99                     UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
1010                     int transparent_color);
trunk/src/mame/video/kncljoe.c
r17669r17670
183183   kncljoe_state *state = machine.driver_data<kncljoe_state>();
184184   UINT8 *spriteram = state->m_spriteram;
185185   rectangle clip = cliprect;
186   const gfx_element *gfx = machine.gfx[1 + state->m_sprite_bank];
186   gfx_element *gfx = machine.gfx[1 + state->m_sprite_bank];
187187   int i, j;
188188   static const int pribase[4]={0x0180, 0x0080, 0x0100, 0x0000};
189189   const rectangle &visarea = machine.primary_screen->visible_area();
trunk/src/mame/video/spdodgeb.c
r17669r17670
152152{
153153   spdodgeb_state *state = machine.driver_data<spdodgeb_state>();
154154   UINT8 *spriteram = state->m_spriteram;
155   const gfx_element *gfx = machine.gfx[1];
155   gfx_element *gfx = machine.gfx[1];
156156   UINT8 *src;
157157   int i;
158158
trunk/src/mame/video/seta.c
r17669r17670
678678
679679PALETTE_INIT( setaroul )
680680{
681   machine.gfx[0]->color_granularity=16;
682   machine.gfx[1]->color_granularity=16;
681   machine.gfx[0]->set_granularity(16);
682   machine.gfx[1]->set_granularity(16);
683683
684684   PALETTE_INIT_CALL(inttoote);
685685}
r17669r17670
773773static void draw_tilemap_palette_effect(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tilemap, int scrollx, int scrolly, int gfxnum, int flipscreen)
774774{
775775   int y;
776   const gfx_element *gfx_tilemap = machine.gfx[gfxnum];
776   gfx_element *gfx_tilemap = machine.gfx[gfxnum];
777777   const bitmap_ind16 &src_bitmap = tilemap->pixmap();
778778   int width_mask, height_mask;
779   int opaque_mask = gfx_tilemap->color_granularity - 1;
780   int pixel_effect_mask = gfx_tilemap->color_base + (gfx_tilemap->total_colors - 1) * gfx_tilemap->color_granularity;
779   int opaque_mask = gfx_tilemap->granularity() - 1;
780   int pixel_effect_mask = gfx_tilemap->colorbase() + (gfx_tilemap->colors() - 1) * gfx_tilemap->granularity();
781781   int p;
782782
783783   width_mask = src_bitmap.width() - 1;
trunk/src/mame/video/vball.c
r17669r17670
114114static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
115115{
116116   vball_state *state = machine.driver_data<vball_state>();
117   const gfx_element *gfx = machine.gfx[1];
117   gfx_element *gfx = machine.gfx[1];
118118   UINT8 *src = state->m_spriteram;
119119   int i;
120120
trunk/src/mame/video/plygonet.c
r17669r17670
102102   assert(state->m_ttl_gfx_index != MAX_GFX_ELEMENTS);
103103
104104   /* decode the ttl layer's gfx */
105   machine.gfx[state->m_ttl_gfx_index] = gfx_element_alloc(machine, &charlayout, machine.root_device().memregion("gfx1")->base(), machine.total_colors() / 16, 0);
105   machine.gfx[state->m_ttl_gfx_index] = auto_alloc(machine, gfx_element(machine, charlayout, machine.root_device().memregion("gfx1")->base(), machine.total_colors() / 16, 0));
106106
107107   /* create the tilemap */
108108   state->m_ttl_tilemap = tilemap_create(machine, ttl_get_tile_info, plygonet_scan,  8, 8, 64, 32);
trunk/src/mame/video/nemesis.c
r17669r17670
267267      {
268268         int w = sprite_data[i].width;
269269         int h = sprite_data[i].height;
270         gfx_element_mark_dirty(machine().gfx[sprite_data[i].char_type], offset * 4 / (w * h));
270         machine().gfx[sprite_data[i].char_type]->mark_dirty(offset * 4 / (w * h));
271271      }
272272   }
273273}
r17669r17670
284284      {
285285         int w = sprite_data[i].width;
286286         int h = sprite_data[i].height;
287         gfx_element_mark_dirty(machine.gfx[sprite_data[i].char_type], offs * 4 / (w * h));
287         machine.gfx[sprite_data[i].char_type]->mark_dirty(offs * 4 / (w * h));
288288      }
289289   }
290290   state->m_background->mark_all_dirty();
r17669r17670
310310   memset(state->m_charram, 0, state->m_charram.bytes());
311311   memset(state->m_blank_tile, 0, ARRAY_LENGTH(state->m_blank_tile));
312312
313   gfx_element_set_source(machine.gfx[0], (UINT8 *)state->m_charram.target());
314   gfx_element_set_source(machine.gfx[1], (UINT8 *)state->m_charram.target());
315   gfx_element_set_source(machine.gfx[2], (UINT8 *)state->m_charram.target());
316   gfx_element_set_source(machine.gfx[3], (UINT8 *)state->m_charram.target());
317   gfx_element_set_source(machine.gfx[4], (UINT8 *)state->m_charram.target());
318   gfx_element_set_source(machine.gfx[5], (UINT8 *)state->m_charram.target());
319   gfx_element_set_source(machine.gfx[6], (UINT8 *)state->m_charram.target());
320   gfx_element_set_source(machine.gfx[7], (UINT8 *)state->m_charram.target());
313   machine.gfx[0]->set_source((UINT8 *)state->m_charram.target());
314   machine.gfx[1]->set_source((UINT8 *)state->m_charram.target());
315   machine.gfx[2]->set_source((UINT8 *)state->m_charram.target());
316   machine.gfx[3]->set_source((UINT8 *)state->m_charram.target());
317   machine.gfx[4]->set_source((UINT8 *)state->m_charram.target());
318   machine.gfx[5]->set_source((UINT8 *)state->m_charram.target());
319   machine.gfx[6]->set_source((UINT8 *)state->m_charram.target());
320   machine.gfx[7]->set_source((UINT8 *)state->m_charram.target());
321321
322322   /* Set up save state */
323323   machine.save().register_postload(save_prepost_delegate(FUNC(nemesis_postload), &machine));
trunk/src/mame/video/cheekyms.c
r17669r17670
107107}
108108
109109
110static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const gfx_element *gfx, int flip )
110static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip )
111111{
112112   cheekyms_state *state = machine.driver_data<cheekyms_state>();
113113   offs_t offs;
trunk/src/mame/video/battlera.c
r17669r17670
3131   state->m_current_scanline=0;
3232   state->m_irq_enable=state->m_rcr_enable=state->m_sb_enable=state->m_bb_enable=0;
3333
34   gfx_element_set_source(machine.gfx[0], state->m_HuC6270_vram);
35   gfx_element_set_source(machine.gfx[1], state->m_HuC6270_vram);
36   gfx_element_set_source(machine.gfx[2], state->m_blank_tile);
34   machine.gfx[0]->set_source(state->m_HuC6270_vram);
35   machine.gfx[1]->set_source(state->m_HuC6270_vram);
36   machine.gfx[2]->set_source(state->m_blank_tile);
3737}
3838
3939/******************************************************************************/
r17669r17670
125125         case 2: /* VRAM */
126126            if (m_HuC6270_vram[(m_HuC6270_registers[0]<<1)|1]!=data) {
127127               m_HuC6270_vram[(m_HuC6270_registers[0]<<1)|1]=data;
128               gfx_element_mark_dirty(machine().gfx[0], m_HuC6270_registers[0]>>4);
129               gfx_element_mark_dirty(machine().gfx[1], m_HuC6270_registers[0]>>6);
128               machine().gfx[0]->mark_dirty(m_HuC6270_registers[0]>>4);
129               machine().gfx[1]->mark_dirty(m_HuC6270_registers[0]>>6);
130130            }
131131            if (m_HuC6270_registers[0]<0x1000) m_vram_dirty[m_HuC6270_registers[0]]=1;
132132            return;
r17669r17670
185185         case 2: /* VWR - VRAM */
186186            if (m_HuC6270_vram[(m_HuC6270_registers[0]<<1)|0]!=data) {
187187               m_HuC6270_vram[(m_HuC6270_registers[0]<<1)|0]=data;
188               gfx_element_mark_dirty(machine().gfx[0], m_HuC6270_registers[0]>>4);
189               gfx_element_mark_dirty(machine().gfx[1], m_HuC6270_registers[0]>>6);
188               machine().gfx[0]->mark_dirty(m_HuC6270_registers[0]>>4);
189               machine().gfx[1]->mark_dirty(m_HuC6270_registers[0]>>6);
190190               if (m_HuC6270_registers[0]<0x1000) m_vram_dirty[m_HuC6270_registers[0]]=1;
191191            }
192192            m_HuC6270_registers[0]+=m_inc_value;
r17669r17670
306306   int offs,code,scrollx,scrolly,mx,my;
307307
308308   /* if any tiles changed, redraw the VRAM */
309   if (screen.machine().gfx[0]->dirtyseq != state->m_tile_dirtyseq)
309   if (screen.machine().gfx[0]->dirtyseq() != state->m_tile_dirtyseq)
310310   {
311      state->m_tile_dirtyseq = screen.machine().gfx[0]->dirtyseq;
311      state->m_tile_dirtyseq = screen.machine().gfx[0]->dirtyseq();
312312      memset(state->m_vram_dirty, 1, 0x1000);
313313   }
314314
trunk/src/mame/video/flower.c
r17669r17670
2929static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
3030{
3131   flower_state *state = machine.driver_data<flower_state>();
32   const gfx_element *gfx = machine.gfx[1];
32   gfx_element *gfx = machine.gfx[1];
3333   UINT8 *source = state->m_spriteram + 0x200;
3434   UINT8 *finish = source - 0x200;
3535
trunk/src/mame/video/namcos1.c
r17669r17670
344344
345345      sy++;   /* sprites are buffered and delayed by one scanline */
346346
347      gfx_element_set_source_clip(gfx, tx, sizex, ty, sizey);
347      gfx->set_source_clip(tx, sizex, ty, sizey);
348348      if (color != 0x7f)
349349         pdrawgfx_transpen( bitmap, cliprect, gfx,
350350               sprite,
trunk/src/mame/video/othunder.c
r17669r17670
6767{
6868   othunder_state *state = machine.driver_data<othunder_state>();
6969   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
70   UINT16 tile_mask = (machine.gfx[0]->total_elements) - 1;
70   UINT16 tile_mask = (machine.gfx[0]->elements()) - 1;
7171   UINT16 *spriteram16 = state->m_spriteram;
7272   int offs, data, tilenum, color, flipx, flipy;
7373   int x, y, priority, curx, cury;
trunk/src/mame/video/tail2nos.c
r17669r17670
5050
5151   for (i = 0; i < 0x20000; i += 64)
5252   {
53      gfx_element_mark_dirty(machine.gfx[2], i / 64);
53      machine.gfx[2]->mark_dirty(i / 64);
5454   }
5555}
5656
r17669r17670
9494
9595   COMBINE_DATA(&m_zoomdata[offset]);
9696   if (oldword != m_zoomdata[offset])
97      gfx_element_mark_dirty(machine().gfx[2], offset / 64);
97      machine().gfx[2]->mark_dirty(offset / 64);
9898}
9999
100100WRITE16_MEMBER(tail2nos_state::tail2nos_gfxbank_w)
trunk/src/mame/video/slapshot.c
r17669r17670
333333      {
334334         sprite_ptr->code = code;
335335         sprite_ptr->color = color;
336         if (machine.gfx[0]->color_granularity == 64)   /* Final Blow, Slapshot are 6bpp */
336         if (machine.gfx[0]->granularity() == 64)   /* Final Blow, Slapshot are 6bpp */
337337            sprite_ptr->color /= 4;
338338         sprite_ptr->flipx = flipx;
339339         sprite_ptr->flipy = flipy;
trunk/src/mame/video/pacland.c
r17669r17670
103103   /* color_prom now points to the beginning of the lookup table */
104104
105105   for (i = 0;i < 0x400;i++)
106      colortable_entry_set_value(machine.colortable, machine.gfx[0]->color_base + i, *color_prom++);
106      colortable_entry_set_value(machine.colortable, machine.gfx[0]->colorbase() + i, *color_prom++);
107107
108108   /* Background */
109109   for (i = 0;i < 0x400;i++)
110      colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + i, *color_prom++);
110      colortable_entry_set_value(machine.colortable, machine.gfx[1]->colorbase() + i, *color_prom++);
111111
112112   /* Sprites */
113113   for (i = 0;i < 0x400;i++)
114      colortable_entry_set_value(machine.colortable, machine.gfx[2]->color_base + i, *color_prom++);
114      colortable_entry_set_value(machine.colortable, machine.gfx[2]->colorbase() + i, *color_prom++);
115115
116116   state->m_palette_bank = 0;
117117   switch_palette(machine);
r17669r17670
207207
208208   /* create one group per color code; for each group, set the transparency mask
209209       to correspond to the pens that are 0x7f or 0xff */
210   assert(machine.gfx[0]->total_colors <= TILEMAP_NUM_GROUPS);
211   for (color = 0; color < machine.gfx[0]->total_colors; color++)
210   assert(machine.gfx[0]->colors() <= TILEMAP_NUM_GROUPS);
211   for (color = 0; color < machine.gfx[0]->colors(); color++)
212212   {
213213      UINT32 mask = colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0x7f);
214214      mask |= colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0xff);
trunk/src/mame/video/psikyo4.c
r17669r17670
5353    **- End Sprite Format -*/
5454
5555   psikyo4_state *state = machine.driver_data<psikyo4_state>();
56   const gfx_element *gfx = machine.gfx[0];
56   gfx_element *gfx = machine.gfx[0];
5757   UINT32 *source = state->m_spriteram;
5858   UINT16 *list = (UINT16 *)state->m_spriteram.target() + 0x2c00/2 + 0x04/2; /* 0x2c00/0x2c02 what are these for, pointers? one for each screen */
5959   UINT16 listlen = (0xc00/2 - 0x04/2), listcntr = 0;
r17669r17670
143143
144144VIDEO_START( psikyo4 )
145145{
146   machine.gfx[0]->color_granularity = 32; /* 256 colour sprites with palette selectable on 32 colour boundaries */
146   machine.gfx[0]->set_granularity(32); /* 256 colour sprites with palette selectable on 32 colour boundaries */
147147}
trunk/src/mame/video/sidearms.c
r17669r17670
172172{
173173   sidearms_state *state = machine.driver_data<sidearms_state>();
174174   UINT8 *buffered_spriteram = state->m_spriteram->buffer();
175   const gfx_element *gfx = machine.gfx[2];
175   gfx_element *gfx = machine.gfx[2];
176176   int offs, attr, color, code, x, y, flipx, flipy;
177177
178178   flipy = flipx = state->m_flipon;
trunk/src/mame/video/taitosj.c
r17669r17670
187187   state->m_sprite_sprite_collbitmap1.allocate(32,32);
188188   state->m_sprite_sprite_collbitmap2.allocate(32,32);
189189
190   gfx_element_set_source(machine.gfx[0], state->m_characterram);
191   gfx_element_set_source(machine.gfx[1], state->m_characterram);
192   gfx_element_set_source(machine.gfx[2], state->m_characterram + 0x1800);
193   gfx_element_set_source(machine.gfx[3], state->m_characterram + 0x1800);
190   machine.gfx[0]->set_source(state->m_characterram);
191   machine.gfx[1]->set_source(state->m_characterram);
192   machine.gfx[2]->set_source(state->m_characterram + 0x1800);
193   machine.gfx[3]->set_source(state->m_characterram + 0x1800);
194194
195195   compute_draw_order(machine);
196196}
r17669r17670
224224   {
225225      if (offset < 0x1800)
226226      {
227         gfx_element_mark_dirty(machine().gfx[0], (offset / 8) & 0xff);
228         gfx_element_mark_dirty(machine().gfx[1], (offset / 32) & 0x3f);
227         machine().gfx[0]->mark_dirty((offset / 8) & 0xff);
228         machine().gfx[1]->mark_dirty((offset / 32) & 0x3f);
229229      }
230230      else
231231      {
232         gfx_element_mark_dirty(machine().gfx[2], (offset / 8) & 0xff);
233         gfx_element_mark_dirty(machine().gfx[3], (offset / 32) & 0x3f);
232         machine().gfx[2]->mark_dirty((offset / 8) & 0xff);
233         machine().gfx[3]->mark_dirty((offset / 32) & 0x3f);
234234      }
235235
236236      m_characterram[offset] = data;
r17669r17670
263263}
264264
265265
266INLINE const gfx_element *get_sprite_gfx_element(running_machine &machine, UINT8 which)
266INLINE gfx_element *get_sprite_gfx_element(running_machine &machine, UINT8 which)
267267{
268268   taitosj_state *state = machine.driver_data<taitosj_state>();
269269   offs_t offs = which * 4;
trunk/src/mame/video/splash.c
r17669r17670
213213{
214214   splash_state *state = machine.driver_data<splash_state>();
215215   int i;
216   const gfx_element *gfx = machine.gfx[1];
216   gfx_element *gfx = machine.gfx[1];
217217
218218   for (i = 0; i < 0x400; i += 4){
219219      int sx = state->m_spriteram[i+2] & 0xff;
r17669r17670
234234{
235235   splash_state *state = machine.driver_data<splash_state>();
236236   int i;
237   const gfx_element *gfx = machine.gfx[1];
237   gfx_element *gfx = machine.gfx[1];
238238
239239   for (i = 0; i < 0x400; i += 4){
240240      int sx = state->m_spriteram[i+2] & 0xff;
trunk/src/mame/video/f1gp.c
r17669r17670
5353   state->m_fg_tilemap->set_transparent_pen(0xff);
5454
5555   state->m_zoomdata = (UINT16 *)state->memregion("gfx4")->base();
56   gfx_element_set_source(machine.gfx[3], (UINT8 *)state->m_zoomdata);
56   machine.gfx[3]->set_source((UINT8 *)state->m_zoomdata);
5757
5858//  state->save_pointer(NAME(state->m_zoomdata), state->memregion("gfx4")->bytes());
5959}
r17669r17670
6969   state->m_fg_tilemap->set_transparent_pen(0xff);
7070
7171   state->m_zoomdata = (UINT16 *)state->memregion("gfx4")->base();
72   gfx_element_set_source(machine.gfx[3], (UINT8 *)state->m_zoomdata);
72   machine.gfx[3]->set_source((UINT8 *)state->m_zoomdata);
7373
7474//  state->save_pointer(NAME(state->m_zoomdata), state->memregion("gfx4")->bytes());
7575}
r17669r17670
103103WRITE16_MEMBER(f1gp_state::f1gp_zoomdata_w)
104104{
105105   COMBINE_DATA(&m_zoomdata[offset]);
106   gfx_element_mark_dirty(machine().gfx[3], offset / 64);
106   machine().gfx[3]->mark_dirty(offset / 64);
107107}
108108
109109READ16_MEMBER(f1gp_state::f1gp_rozvideoram_r)
trunk/src/mame/video/snk6502.c
r17669r17670
1010#include "includes/snk6502.h"
1111
1212
13#define TOTAL_COLORS(m,gfxn) ((m).gfx[gfxn]->total_colors * (m).gfx[gfxn]->color_granularity)
13#define TOTAL_COLORS(m,gfxn) ((m).gfx[gfxn]->colors() * (m).gfx[gfxn]->granularity())
1414#define COLOR(m,gfxn,offs) ((m).config().m_gfxdecodeinfo[gfxn].color_codes_start + offs)
1515
1616
r17669r17670
103103   if (m_charram[offset] != data)
104104   {
105105      m_charram[offset] = data;
106      gfx_element_mark_dirty(machine().gfx[0], (offset/8) % 256);
106      machine().gfx[0]->mark_dirty((offset/8) % 256);
107107   }
108108}
109109
r17669r17670
183183
184184   state->m_fg_tilemap->set_transparent_pen(0);
185185
186   gfx_element_set_source(machine.gfx[0], state->m_charram);
186   machine.gfx[0]->set_source(state->m_charram);
187187}
188188
189189VIDEO_START( pballoon )
r17669r17670
320320
321321   state->m_fg_tilemap->set_transparent_pen(0);
322322
323   gfx_element_set_source(machine.gfx[0], state->m_charram);
323   machine.gfx[0]->set_source(state->m_charram);
324324}
trunk/src/mame/video/polyplay.c
r17669r17670
3333{
3434   if (m_characterram[offset] != data)
3535   {
36      gfx_element_mark_dirty(machine().gfx[1], (offset >> 3) & 0x7f);
36      machine().gfx[1]->mark_dirty((offset >> 3) & 0x7f);
3737
3838      m_characterram[offset] = data;
3939   }
r17669r17670
4242VIDEO_START( polyplay )
4343{
4444   polyplay_state *state = machine.driver_data<polyplay_state>();
45   gfx_element_set_source(machine.gfx[1], state->m_characterram);
45   machine.gfx[1]->set_source(state->m_characterram);
4646}
4747
4848
trunk/src/mame/video/tatsumi.c
r17669r17670
4343
4444   offset=offset%0xc000;
4545
46   gfx_element_mark_dirty(machine().gfx[1],offset/0x10);
46   machine().gfx[1]->mark_dirty(offset/0x10);
4747}
4848
4949
r17669r17670
209209
210210   state->m_tx_layer->set_transparent_pen(0);
211211
212   gfx_element_set_source(machine.gfx[1], (UINT8 *)state->m_roundup5_vram);
212   machine.gfx[1]->set_source((UINT8 *)state->m_roundup5_vram);
213213}
214214
215215VIDEO_START( cyclwarr )
r17669r17670
239239
240240template<class _BitmapClass>
241241INLINE void roundupt_drawgfxzoomrotate(tatsumi_state *state,
242      _BitmapClass &dest_bmp, const rectangle &clip, const gfx_element *gfx,
242      _BitmapClass &dest_bmp, const rectangle &clip, gfx_element *gfx,
243243      UINT32 code,UINT32 color,int flipx,int flipy,UINT32 ssx,UINT32 ssy,
244244      int scalex, int scaley, int rotate, int write_priority_only )
245245{
r17669r17670
261261   {
262262      if( gfx )
263263      {
264         const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
265         const UINT8 *shadow_pens = state->m_shadow_pen_array + (gfx->color_granularity * (color % gfx->total_colors));
266         const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements);
264         const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
265         const UINT8 *shadow_pens = state->m_shadow_pen_array + (gfx->granularity() * (color % gfx->colors()));
266         const UINT8 *code_base = gfx->get_data(code % gfx->elements());
267267
268268         int block_size = 8 * scalex;
269269         int sprite_screen_height = ((ssy&0xffff)+block_size)>>16;
r17669r17670
272272         if (sprite_screen_width && sprite_screen_height)
273273         {
274274            /* compute sprite increment per screen pixel */
275            int dx = (gfx->width<<16)/sprite_screen_width;
276            int dy = (gfx->height<<16)/sprite_screen_height;
275            int dx = (gfx->width()<<16)/sprite_screen_width;
276            int dy = (gfx->height()<<16)/sprite_screen_height;
277277
278278            int sx;//=ssx>>16;
279279            int sy;//=ssy>>16;
r17669r17670
384384                        int x, x_index = x_index_base;
385385                        for( x=sx; x<ex; x++ )
386386                        {
387                           const UINT8 *source = code_base + (cy>>16) * gfx->line_modulo;
387                           const UINT8 *source = code_base + (cy>>16) * gfx->rowbytes();
388388                           int c = source[(cx >> 16)];
389389                           if( c != transparent_color )
390390                           {
r17669r17670
407407                  {
408408                     for( y=sy; y<ey; y++ )
409409                     {
410                        const UINT8 *source = code_base + (y_index>>16) * gfx->line_modulo;
410                        const UINT8 *source = code_base + (y_index>>16) * gfx->rowbytes();
411411                        typename _BitmapClass::pixel_t *dest = &dest_bmp.pix(y);
412412
413413                        int x, x_index = x_index_base;
trunk/src/mame/video/konamiic.c
r17669r17670
11651165
11661166   memcpy(&gl, layout, sizeof(gl));
11671167   gl.total = total;
1168   machine.gfx[gfx_index] = gfx_element_alloc(machine, &gl, data, machine.total_colors() >> bpp, 0);
1168   machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, gl, data, machine.total_colors() >> bpp, 0));
11691169}
11701170
11711171/***************************************************************************/
r17669r17670
21142114         fatalerror("Unsupported bpp");
21152115   }
21162116
2117   machine.gfx[gfx_index]->color_granularity = 16; /* override */
2117   machine.gfx[gfx_index]->set_granularity(16); /* override */
21182118
21192119   K056832_memory_region = gfx_memory_region;
21202120   K056832_gfxnum = gfx_index;
r17669r17670
26212621         int count, src_pitch, src_modulo;
26222622         int   dst_pitch;
26232623         int line;
2624         const gfx_element *src_gfx;
2624         gfx_element *src_gfx;
26252625         int offs, mask;
26262626
26272627         #define LINE_WIDTH 512
r17669r17670
26352635         pixmap  = K056832_pixmap[page];
26362636         pal_ptr    = machine.pens;
26372637         src_gfx    = machine.gfx[K056832_gfxnum];
2638         src_pitch  = src_gfx->line_modulo;
2638         src_pitch  = src_gfx->rowbytes();
26392639         src_modulo = src_gfx->char_modulo;
26402640         dst_pitch  = pixmap->rowpixels;
26412641
trunk/src/mame/video/snk68.c
r17669r17670
202202   // pow has 0x4000 tiles and independent x/y flipping
203203   // the other games have > 0x4000 tiles and flipping in only one direction
204204   // (globally selected)
205   int const is_pow = (machine.gfx[1]->total_elements <= 0x4000);
205   int const is_pow = (machine.gfx[1]->elements() <= 0x4000);
206206   int offs;
207207
208208   for (offs = 0; offs < 0x800; offs += 0x40)
trunk/src/mame/video/madalien.c
r17669r17670
153153
154154   state->m_headlight_bitmap = auto_bitmap_ind16_alloc(machine, 128, 128);
155155
156   gfx_element_set_source(machine.gfx[0], state->m_charram);
156   machine.gfx[0]->set_source(state->m_charram);
157157
158158   drawgfx_opaque(*state->m_headlight_bitmap, state->m_headlight_bitmap->cliprect(), machine.gfx[2], 0, 0, 0, 0, 0x00, 0x00);
159159   drawgfx_opaque(*state->m_headlight_bitmap, state->m_headlight_bitmap->cliprect(), machine.gfx[2], 0, 0, 0, 1, 0x00, 0x40);
r17669r17670
246246WRITE8_MEMBER(madalien_state::madalien_charram_w)
247247{
248248   m_charram[offset] = data;
249   gfx_element_mark_dirty(machine().gfx[0], (offset/8) & 0xff);
249   machine().gfx[0]->mark_dirty((offset/8) & 0xff);
250250}
251251
252252
trunk/src/mame/video/oneshot.c
r17669r17670
101101   oneshot_state *state = machine.driver_data<oneshot_state>();
102102   const UINT16 *source = state->m_sprites;
103103   const UINT16 *finish = source + (0x1000 / 2);
104   const gfx_element *gfx = machine.gfx[1];
104   gfx_element *gfx = machine.gfx[1];
105105
106106   int xpos, ypos;
107107
trunk/src/mame/video/stlforce.c
r17669r17670
100100   stlforce_state *state = machine.driver_data<stlforce_state>();
101101   const UINT16 *source = state->m_spriteram+0x0;
102102   const UINT16 *finish = state->m_spriteram+0x800;
103   const gfx_element *gfx = machine.gfx[2];
103   gfx_element *gfx = machine.gfx[2];
104104   int ypos, xpos, attr, num;
105105
106106   while (source<finish)
trunk/src/mame/video/mcr68.c
r17669r17670
2626   int code = (data & 0x3ff) | ((data >> 4) & 0xc00);
2727   int color = (~data >> 12) & 3;
2828   SET_TILE_INFO(0, code, color, TILE_FLIPYX((data >> 10) & 3));
29   if (machine.gfx[0]->total_elements < 0x1000)
29   if (machine.gfx[0]->elements() < 0x1000)
3030      tileinfo.category = (data >> 15) & 1;
3131}
3232
r17669r17670
8686   state->m_fg_tilemap->set_transparent_pen(0);
8787
8888   /* allocate memory for the assembled gfx data */
89   srcdata0 = auto_alloc_array(machine, UINT8, gfx0->total_elements * gfx0->width * gfx0->height);
90   srcdata2 = auto_alloc_array(machine, UINT8, gfx2->total_elements * gfx2->width * gfx2->height);
89   srcdata0 = auto_alloc_array(machine, UINT8, gfx0->elements() * gfx0->width() * gfx0->height());
90   srcdata2 = auto_alloc_array(machine, UINT8, gfx2->elements() * gfx2->width() * gfx2->height());
9191
9292   /* "colorize" each code */
9393   dest0 = srcdata0;
9494   dest2 = srcdata2;
95   for (code = 0; code < gfx0->total_elements; code++)
95   for (code = 0; code < gfx0->elements(); code++)
9696   {
9797      const UINT8 *coldata = colordatabase + code * 32;
98      const UINT8 *gfxdata0 = gfx_element_get_data(gfx0, code);
99      const UINT8 *gfxdata2 = gfx_element_get_data(gfx2, code);
98      const UINT8 *gfxdata0 = gfx0->get_data(code);
99      const UINT8 *gfxdata2 = gfx2->get_data(code);
100100
101101      /* assume 16 rows */
102102      for (y = 0; y < 16; y++)
r17669r17670
122122         }
123123
124124         /* advance */
125         gfxdata0 += gfx0->line_modulo;
126         gfxdata2 += gfx2->line_modulo;
125         gfxdata0 += gfx0->rowbytes();
126         gfxdata2 += gfx2->rowbytes();
127127      }
128128   }
129129
130   /* create a simple target layout */
131   gfx0->layout.planes = gfx2->layout.planes = 8;
132   for (x = 0; x < 8; x++)
133      gfx0->layout.planeoffset[x] = gfx2->layout.planeoffset[x] = x;
134   for (x = 0; x < gfx0->width; x++)
135      gfx0->layout.xoffset[x] = gfx2->layout.xoffset[x] = 8 * x;
136   for (y = 0; y < gfx0->height; y++)
137      gfx0->layout.yoffset[y] = gfx2->layout.yoffset[y] = 8 * y * gfx0->width;
138   gfx0->layout.charincrement = gfx2->layout.charincrement = 8 * gfx0->width * gfx0->height;
139
140130   /* make the assembled data our new source data */
141   gfx_element_set_source(gfx0, srcdata0);
142   gfx_element_set_source(gfx2, srcdata2);
131   gfx0->set_raw_layout(srcdata0, gfx0->width(), gfx0->height(), gfx0->elements(), 8 * gfx0->width(), 8 * gfx0->width() * gfx0->height());
132   gfx2->set_raw_layout(srcdata2, gfx2->width(), gfx2->height(), gfx2->elements(), 8 * gfx2->width(), 8 * gfx2->width() * gfx2->height());
143133}
144134
145135
trunk/src/mame/video/silkroad.c
r17669r17670
1010static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1111{
1212   silkroad_state *state = machine.driver_data<silkroad_state>();
13   const gfx_element *gfx = machine.gfx[0];
13   gfx_element *gfx = machine.gfx[0];
1414   UINT32 *source = state->m_sprram;
1515   UINT32 *finish = source + 0x1000/4;
1616
trunk/src/mame/video/tecmo16.c
r17669r17670
400400                  }
401401                  pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[2],
402402                        code + layout[y][x],
403                        machine.gfx[2]->color_base + color * machine.gfx[2]->color_granularity,
403                        machine.gfx[2]->colorbase() + color * machine.gfx[2]->granularity(),
404404                        flipx,flipy,
405405                        sx,sy,
406406                        machine.priority_bitmap, priority_mask,0);
r17669r17670
408408                  /* wrap around x */
409409                  pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[2],
410410                        code + layout[y][x],
411                        machine.gfx[2]->color_base + color * machine.gfx[2]->color_granularity,
411                        machine.gfx[2]->colorbase() + color * machine.gfx[2]->granularity(),
412412                        flipx,flipy,
413413                        sx-512,sy,
414414                        machine.priority_bitmap, priority_mask,0);
r17669r17670
416416                  /* wrap around x */
417417                  pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[2],
418418                        code + layout[y][x],
419                        machine.gfx[2]->color_base + color * machine.gfx[2]->color_granularity,
419                        machine.gfx[2]->colorbase() + color * machine.gfx[2]->granularity(),
420420                        flipx,flipy,
421421                        sx+512,sy,
422422                        machine.priority_bitmap, priority_mask,0);
r17669r17670
443443                  }
444444                  pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[2],
445445                        code + layout[y][x],
446                        machine.gfx[2]->color_base + color * machine.gfx[2]->color_granularity,
446                        machine.gfx[2]->colorbase() + color * machine.gfx[2]->granularity(),
447447                        flipx,flipy,
448448                        sx,sy,
449449                        machine.priority_bitmap, priority_mask,0);
r17669r17670
451451                  /* wrap around x */
452452                  pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[2],
453453                        code + layout[y][x],
454                        machine.gfx[2]->color_base + color * machine.gfx[2]->color_granularity,
454                        machine.gfx[2]->colorbase() + color * machine.gfx[2]->granularity(),
455455                        flipx,flipy,
456456                        sx-512,sy,
457457                        machine.priority_bitmap, priority_mask,0);
r17669r17670
459459                  /* wrap around x */
460460                  pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[2],
461461                        code + layout[y][x],
462                        machine.gfx[2]->color_base + color * machine.gfx[2]->color_granularity,
462                        machine.gfx[2]->colorbase() + color * machine.gfx[2]->granularity(),
463463                        flipx,flipy,
464464                        sx+512,sy,
465465                        machine.priority_bitmap, priority_mask,0);
trunk/src/mame/video/ultratnk.c
r17669r17670
119119
120120         rect.min_x = horz - 15;
121121         rect.min_y = vert - 15;
122         rect.max_x = horz - 15 + screen.machine().gfx[1]->width - 1;
123         rect.max_y = vert - 15 + screen.machine().gfx[1]->height - 1;
122         rect.max_x = horz - 15 + screen.machine().gfx[1]->width() - 1;
123         rect.max_y = vert - 15 + screen.machine().gfx[1]->height() - 1;
124124
125125         rect &= screen.machine().primary_screen->visible_area();
126126
trunk/src/mame/video/psikyosh.c
r17669r17670
183183    a single transparent pen, storing the alpha value
184184    in alpha field of ARGB32, negative alpha implies alphatable
185185-------------------------------------------------*/
186static void drawgfx_alphastore(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
186static void drawgfx_alphastore(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
187187      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
188188      int fixedalpha)
189189{
r17669r17670
205205   }
206206
207207   /* get final code and color, and grab lookup tables */
208   code %= gfx->total_elements;
209   color %= gfx->total_colors;
210   paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color];
208   code %= gfx->elements();
209   color %= gfx->colors();
210   paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * color];
211211
212212   /* early out if completely transparent */
213   if (gfx->pen_usage != NULL && (gfx->pen_usage[code] & ~(1 << 0)) == 0)
213   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << 0)) == 0)
214214      return;
215215
216216   if (fixedalpha >= 0)
r17669r17670
229229    a fixed alpha value, or if alpha==-1 then uses
230230    the per-pen alphatable[] array
231231 -------------------------------------------------*/
232static void drawgfx_alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
232static void drawgfx_alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
233233      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
234234      int fixedalpha)
235235{
r17669r17670
251251   assert(alphatable != NULL);
252252
253253   /* get final code and color, and grab lookup tables */
254   code %= gfx->total_elements;
255   color %= gfx->total_colors;
256   paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color];
254   code %= gfx->elements();
255   color %= gfx->colors();
256   paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * color];
257257
258258   /* early out if completely transparent */
259   if (gfx->pen_usage != NULL && (gfx->pen_usage[code] & ~(1 << 0)) == 0)
259   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << 0)) == 0)
260260      return;
261261
262262   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANS0_ALPHATABLE32, NO_PRIORITY);
r17669r17670
515515/* Note that Level 5-4 of sbomberb boss is perfect! (Alpha blended zoomed) as well as S1945II logo */
516516/* pixel is only plotted if z is >= priority_buffer[y][x] */
517517static void psikyosh_drawgfxzoom( running_machine &machine,
518      bitmap_rgb32 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
518      bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
519519      UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
520520      int alpha, int zoomx, int zoomy, int wide, int high, UINT32 z)
521521{
r17669r17670
554554         {
555555            for (xtile = xstart; xtile != xend; xtile += xinc)
556556            {
557               const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
558               const UINT8 *code_base = gfx_element_get_data(gfx, (code + code_offset++) % gfx->total_elements);
557               const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
558               const UINT8 *code_base = gfx->get_data((code + code_offset++) % gfx->elements());
559559
560560               int x_index_base, y_index, sx, sy, ex, ey;
561561
562               if (flipx)   { x_index_base = gfx->width - 1; }
562               if (flipx)   { x_index_base = gfx->width() - 1; }
563563               else      { x_index_base = 0; }
564564
565               if (flipy)   { y_index = gfx->height-1; }
565               if (flipy)   { y_index = gfx->height()-1; }
566566               else      { y_index = 0; }
567567
568568               /* start coordinates */
569               sx = offsx + xtile * gfx->width;
570               sy = offsy + ytile * gfx->height;
569               sx = offsx + xtile * gfx->width();
570               sy = offsy + ytile * gfx->height();
571571
572572               /* end coordinates */
573               ex = sx + gfx->width;
574               ey = sy + gfx->height;
573               ex = sx + gfx->width();
574               ey = sy + gfx->height();
575575
576576               if (sx < myclip.min_x)
577577               { /* clip left */
r17669r17670
606606                  {
607607                     if (z > 0)
608608                     {
609                        const UINT8 *source = code_base + (y_index) * gfx->line_modulo + x_index_base;
609                        const UINT8 *source = code_base + (y_index) * gfx->rowbytes() + x_index_base;
610610                        UINT32 *dest = &dest_bmp.pix32(sy, sx);
611611                        UINT16 *pri = &state->m_z_bitmap.pix16(sy, sx);
612                        int src_modulo = yinc * gfx->line_modulo - xinc * (ex - sx);
612                        int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx);
613613                        int dst_modulo = dest_bmp.rowpixels() - (ex - sx);
614614
615615                        for (y = sy; y < ey; y++)
r17669r17670
637637                     }
638638                     else
639639                     {
640                        const UINT8 *source = code_base + y_index * gfx->line_modulo + x_index_base;
640                        const UINT8 *source = code_base + y_index * gfx->rowbytes() + x_index_base;
641641                        UINT32 *dest = &dest_bmp.pix32(sy, sx);
642                        int src_modulo = yinc * gfx->line_modulo - xinc * (ex - sx);
642                        int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx);
643643                        int dst_modulo = dest_bmp.rowpixels() - (ex - sx);
644644
645645                        for (y = sy; y < ey; y++)
r17669r17670
665665                  {
666666                     if (z > 0)
667667                     {
668                        const UINT8 *source = code_base + y_index * gfx->line_modulo + x_index_base;
668                        const UINT8 *source = code_base + y_index * gfx->rowbytes() + x_index_base;
669669                        UINT32 *dest = &dest_bmp.pix32(sy, sx);
670670                        UINT16 *pri = &state->m_z_bitmap.pix16(sy, sx);
671                        int src_modulo = yinc * gfx->line_modulo - xinc * (ex - sx);
671                        int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx);
672672                        int dst_modulo = dest_bmp.rowpixels() - (ex - sx);
673673
674674                        for (y = sy; y < ey; y++)
r17669r17670
696696                     }
697697                     else
698698                     {
699                        const UINT8 *source = code_base + y_index * gfx->line_modulo + x_index_base;
699                        const UINT8 *source = code_base + y_index * gfx->rowbytes() + x_index_base;
700700                        UINT32 *dest = &dest_bmp.pix32(sy, sx);
701                        int src_modulo = yinc * gfx->line_modulo - xinc * (ex - sx);
701                        int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx);
702702                        int dst_modulo = dest_bmp.rowpixels() - (ex - sx);
703703
704704                        for (y = sy; y < ey; y++)
r17669r17670
725725                  {
726726                     if (z > 0)
727727                     {
728                        const UINT8 *source = code_base + y_index * gfx->line_modulo + x_index_base;
728                        const UINT8 *source = code_base + y_index * gfx->rowbytes() + x_index_base;
729729                        UINT32 *dest = &dest_bmp.pix32(sy, sx);
730730                        UINT16 *pri = &state->m_z_bitmap.pix16(sy, sx);
731                        int src_modulo = yinc * gfx->line_modulo - xinc * (ex - sx);
731                        int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx);
732732                        int dst_modulo = dest_bmp.rowpixels() - (ex - sx);
733733
734734                        for (y = sy; y < ey; y++)
r17669r17670
760760                     }
761761                     else
762762                     {
763                        const UINT8 *source = code_base + y_index * gfx->line_modulo + x_index_base;
763                        const UINT8 *source = code_base + y_index * gfx->rowbytes() + x_index_base;
764764                        UINT32 *dest = &dest_bmp.pix32(sy, sx);
765                        int src_modulo = yinc * gfx->line_modulo - xinc * (ex - sx);
765                        int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx);
766766                        int dst_modulo = dest_bmp.rowpixels() - (ex - sx);
767767
768768                        for (y = sy; y < ey; y++)
r17669r17670
800800      {
801801         for (xtile = 0; xtile < wide; xtile++)
802802         {
803            const UINT8 *code_base = gfx_element_get_data(gfx, (code + code_offset++) % gfx->total_elements);
804            for (ypixel = 0; ypixel < gfx->height; ypixel++)
803            const UINT8 *code_base = gfx->get_data((code + code_offset++) % gfx->elements());
804            for (ypixel = 0; ypixel < gfx->height(); ypixel++)
805805            {
806               const UINT8 *source = code_base + ypixel * gfx->line_modulo;
807               UINT8 *dest = &state->m_zoom_bitmap.pix8(ypixel + ytile*gfx->height);
806               const UINT8 *source = code_base + ypixel * gfx->rowbytes();
807               UINT8 *dest = &state->m_zoom_bitmap.pix8(ypixel + ytile*gfx->height());
808808
809               for (xpixel = 0; xpixel < gfx->width; xpixel++)
809               for (xpixel = 0; xpixel < gfx->width(); xpixel++)
810810               {
811                  dest[xpixel + xtile*gfx->width] = source[xpixel];
811                  dest[xpixel + xtile*gfx->width()] = source[xpixel];
812812               }
813813            }
814814         }
r17669r17670
817817      /* Start drawing */
818818      if (gfx)
819819      {
820         const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
820         const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
821821
822         int sprite_screen_height = ((high * gfx->height * (0x400 * 0x400)) / zoomy + 0x200) >> 10; /* Round up to nearest pixel */
823         int sprite_screen_width = ((wide * gfx->width * (0x400 * 0x400)) / zoomx + 0x200) >> 10;
822         int sprite_screen_height = ((high * gfx->height() * (0x400 * 0x400)) / zoomy + 0x200) >> 10; /* Round up to nearest pixel */
823         int sprite_screen_width = ((wide * gfx->width() * (0x400 * 0x400)) / zoomx + 0x200) >> 10;
824824
825825         if (sprite_screen_width && sprite_screen_height)
826826         {
r17669r17670
10841084
10851085
10861086   psikyosh_state *state = machine.driver_data<psikyosh_state>();
1087   const gfx_element *gfx;
1087   gfx_element *gfx;
10881088   UINT32 *src = state->m_spriteram->buffer(); /* Use buffered spriteram */
10891089   UINT16 *list = (UINT16 *)src + 0x3800 / 2;
10901090   UINT16 listlen = 0x800/2;
r17669r17670
12291229   state->m_bg_bitmap.allocate(32*16, 32*16); /* temp buffer for assembling tilemaps */
12301230   state->m_bg_zoom = auto_alloc_array(machine, UINT16, 256);
12311231
1232   machine.gfx[1]->color_granularity = 16; /* 256 colour sprites with palette selectable on 16 colour boundaries */
1232   machine.gfx[1]->set_granularity(16); /* 256 colour sprites with palette selectable on 16 colour boundaries */
12331233
12341234   /* Pens 0xc0-0xff have a gradient of alpha values associated with them */
12351235   int i;
trunk/src/mame/video/equites.c
r17669r17670
329329   equites_state *state = machine.driver_data<equites_state>();
330330   const UINT8 * const xrom = state->memregion("user2")->base();
331331   const UINT8 * const yrom = xrom + 0x100;
332   const gfx_element* const gfx = machine.gfx[2];
332   gfx_element* gfx = machine.gfx[2];
333333   int offs;
334334
335335   // note that sprites are actually 30x30, contained in 32x32 squares. The outer edge is not used.
r17669r17670
350350
351351//      const UINT8 * const xromline = xrom + (scalex << 4);
352352      const UINT8 * const yromline = yrom + (scaley << 4) + (15 - scaley);
353      const UINT8* const srcgfx = gfx_element_get_data(gfx, tile);
354      const pen_t *paldata = &machine.pens[gfx->color_base + gfx->color_granularity * color];
353      const UINT8* const srcgfx = gfx->get_data(tile);
354      const pen_t *paldata = &machine.pens[gfx->colorbase() + gfx->granularity() * color];
355355      int x,yy;
356356
357357      sy += 16;
r17669r17670
385385                  if (bx >= cliprect.min_x && bx <= cliprect.max_x)
386386                  {
387387                     int xx = scalex ? (x * 29 + scalex) / (scalex << 1) + 1 : 16;   // FIXME This is wrong. Should use the PROM.
388                     int const offset = (fx ? (31 - xx) : xx) + ((fy ^ yhalf) ? (16 + line) : (15 - line) ) * gfx->line_modulo;
388                     int const offset = (fx ? (31 - xx) : xx) + ((fy ^ yhalf) ? (16 + line) : (15 - line) ) * gfx->rowbytes();
389389
390390                     int pen = srcgfx[offset];
391391
trunk/src/mame/video/gradius3.c
r17669r17670
6464
6565   for (i = 0; i < 0x20000; i += 16)
6666   {
67      gfx_element_mark_dirty(machine.gfx[0], i / 16);
67      machine.gfx[0]->mark_dirty(i / 16);
6868   }
6969}
7070
r17669r17670
8484   /* re-decode the sprites because the ROMs are connected to the custom IC differently
8585       from how they are connected to the CPU. */
8686   for (i = 0; i < TOTAL_SPRITES; i++)
87      gfx_element_mark_dirty(machine.gfx[1], i);
87      machine.gfx[1]->mark_dirty(i);
8888
89   gfx_element_set_source(machine.gfx[0], (UINT8 *)state->m_gfxram.target());
89   machine.gfx[0]->set_source((UINT8 *)state->m_gfxram.target());
9090
9191   machine.save().register_postload(save_prepost_delegate(FUNC(gradius3_postload), &machine));
9292}
r17669r17670
113113   COMBINE_DATA(&m_gfxram[offset]);
114114
115115   if (oldword != m_gfxram[offset])
116      gfx_element_mark_dirty(machine().gfx[0], offset / 16);
116      machine().gfx[0]->mark_dirty(offset / 16);
117117}
118118
119119/***************************************************************************
trunk/src/mame/video/decocass.c
r17669r17670
188188   decocass_state *state = space->machine().driver_data<decocass_state>();
189189   state->m_charram[offset] = data;
190190   /* dirty sprite */
191   gfx_element_mark_dirty(space->machine().gfx[1], (offset >> 5) & 255);
191   space->machine().gfx[1]->mark_dirty((offset >> 5) & 255);
192192   /* dirty char */
193   gfx_element_mark_dirty(space->machine().gfx[0], (offset >> 3) & 1023);
193   space->machine().gfx[0]->mark_dirty((offset >> 3) & 1023);
194194}
195195
196196
r17669r17670
222222   decocass_state *state = space->machine().driver_data<decocass_state>();
223223   state->m_tileram[offset] = data;
224224   /* dirty tile (64 bytes per tile) */
225   gfx_element_mark_dirty(space->machine().gfx[2], (offset / 64) & 15);
225   space->machine().gfx[2]->mark_dirty((offset / 64) & 15);
226226   /* first 1KB of tile RAM is shared with tilemap RAM */
227227   if (offset < state->m_bgvideoram_size)
228228      mark_bg_tile_dirty(space->machine(), offset);
r17669r17670
233233   decocass_state *state = space->machine().driver_data<decocass_state>();
234234   state->m_objectram[offset] = data;
235235   /* dirty the object */
236   gfx_element_mark_dirty(space->machine().gfx[3], 0);
237   gfx_element_mark_dirty(space->machine().gfx[3], 1);
236   space->machine().gfx[3]->mark_dirty(0);
237   space->machine().gfx[3]->mark_dirty(1);
238238}
239239
240240WRITE8_HANDLER( decocass_bgvideoram_w )
r17669r17670
510510   state->m_bgvideoram = state->m_tileram;
511511   state->m_bgvideoram_size = 0x0400;   /* d000-d3ff */
512512
513   gfx_element_set_source(machine.gfx[0], state->m_charram);
514   gfx_element_set_source(machine.gfx[1], state->m_charram);
515   gfx_element_set_source(machine.gfx[2], state->m_tileram);
516   gfx_element_set_source(machine.gfx[3], state->m_objectram);
513   machine.gfx[0]->set_source(state->m_charram);
514   machine.gfx[1]->set_source(state->m_charram);
515   machine.gfx[2]->set_source(state->m_tileram);
516   machine.gfx[3]->set_source(state->m_objectram);
517517
518518   /* This should ensure that the fake 17th tile is left blank
519519     * now that dirty-tile tracking is handled by the core */
520   gfx_element_decode(machine.gfx[2], 16);
520   machine.gfx[2]->decode(16);
521521}
522522
523523SCREEN_UPDATE_IND16( decocass )
trunk/src/mame/video/mystwarr.c
r17669r17670
2222   int gfxnum;
2323
2424   for (gfxnum = 0; gfxnum < ARRAY_LENGTH(machine.gfx); gfxnum++)
25      if (machine.gfx[gfxnum] != NULL && machine.gfx[gfxnum]->srcdata == s)
25      if (machine.gfx[gfxnum] != NULL && machine.gfx[gfxnum]->srcdata() == s)
2626         break;
2727   assert(gfxnum != ARRAY_LENGTH(machine.gfx));
2828
r17669r17670
5555      d += 5;
5656   }
5757
58   gfx_element_set_source(machine.gfx[gfxnum], decoded);
58   machine.gfx[gfxnum]->set_source(decoded);
5959}
6060
6161
trunk/src/mame/video/konicdev.c
r17669r17670
12391239
12401240   memcpy(&gl, layout, sizeof(gl));
12411241   gl.total = total;
1242   machine.gfx[gfx_index] = gfx_element_alloc(machine, &gl, data, machine.total_colors() >> bpp, 0);
1242   machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, gl, data, machine.total_colors() >> bpp, 0));
12431243}
12441244
12451245
r17669r17670
14261426                    const UINT8 *source, int base_color, int global_x_offset, int bank_base, UINT32 pri_mask )
14271427{
14281428   k007121_state *k007121 = k007121_get_safe_token(device);
1429//  const gfx_element *gfx = gfxs[chip];
1429//  gfx_element *gfx = gfxs[chip];
14301430   bitmap_ind8 &priority_bitmap = gfx->machine().priority_bitmap;
14311431   int flipscreen = k007121->flipscreen;
14321432   int i, num, inc, offs[5];
r17669r17670
30923092         flipy = !flipy;
30933093      }
30943094
3095      drawmode_table[k051960->gfx->color_granularity - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE;
3095      drawmode_table[k051960->gfx->granularity() - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE;
30963096
30973097      if (zoomx == 0x10000 && zoomy == 0x10000)
30983098      {
r17669r17670
36783678      ox -= (zoomx * w) >> 13;
36793679      oy -= (zoomy * h) >> 13;
36803680
3681      drawmode_table[k053245->gfx->color_granularity - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE;
3681      drawmode_table[k053245->gfx->granularity() - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE;
36823682
36833683      for (y = 0; y < h; y++)
36843684      {
r17669r17670
39283928      ox -= (zoomx * w) >> 13;
39293929      oy -= (zoomy * h) >> 13;
39303930
3931      drawmode_table[machine.gfx[0]->color_granularity - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE;
3931      drawmode_table[machine.gfx[0]->granularity() - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE;
39323932
39333933      for (y = 0; y < h; y++)
39343934      {
r17669r17670
47394739      ox -= (zoomx * w) >> 13;
47404740      oy -= (zoomy * h) >> 13;
47414741
4742      drawmode_table[k053246->gfx->color_granularity - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE;
4742      drawmode_table[k053246->gfx->granularity() - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE;
47434743
47444744      for (y = 0; y < h; y++)
47454745      {
r17669r17670
70347034         int count, src_pitch, src_modulo;
70357035         int dst_pitch;
70367036         int line;
7037         const gfx_element *src_gfx;
7037         gfx_element *src_gfx;
70387038         int offs, mask;
70397039
70407040         #define LINE_WIDTH 512
r17669r17670
70487048         pixmap  = k056832->pixmap[page];
70497049         pal_ptr = machine.pens;
70507050         src_gfx = machine.gfx[k056832->gfxnum];
7051         src_pitch  = src_gfx->line_modulo;
7051         src_pitch  = src_gfx->rowbytes();
70527052         src_modulo = src_gfx->char_modulo;
70537053         dst_pitch  = pixmap->rowpixels;
70547054
r17669r17670
78877887         fatalerror("Unsupported bpp");
78887888   }
78897889
7890   machine.gfx[intf->gfx_num]->color_granularity = 16; /* override */
7890   machine.gfx[intf->gfx_num]->set_granularity(16); /* override */
78917891
78927892   /* deinterleave the graphics, if needed */
78937893   deinterleave_gfx(machine, intf->gfx_memory_region, intf->deinterleave);
r17669r17670
98619861
98629862   COMBINE_DATA(k001604->char_ram + addr);
98639863
9864   gfx_element_mark_dirty(device->machine().gfx[k001604->gfx_index[0]], addr / 32);
9865   gfx_element_mark_dirty(device->machine().gfx[k001604->gfx_index[1]], addr / 128);
9864   device->machine().gfx[k001604->gfx_index[0]]->mark_dirty(addr / 32);
9865   device->machine().gfx[k001604->gfx_index[1]]->mark_dirty(addr / 128);
98669866}
98679867
98689868WRITE32_DEVICE_HANDLER( k001604_reg_w )
r17669r17670
99379937   k001604->layer_8x8[0]->set_transparent_pen(0);
99389938   k001604->layer_8x8[1]->set_transparent_pen(0);
99399939
9940   device->machine().gfx[k001604->gfx_index[0]] = gfx_element_alloc(device->machine(), &k001604_char_layout_layer_8x8, (UINT8*)&k001604->char_ram[0], device->machine().total_colors() / 16, 0);
9941   device->machine().gfx[k001604->gfx_index[1]] = gfx_element_alloc(device->machine(), &k001604_char_layout_layer_16x16, (UINT8*)&k001604->char_ram[0], device->machine().total_colors() / 16, 0);
9940   device->machine().gfx[k001604->gfx_index[0]] = auto_alloc(device->machine(), gfx_element(device->machine(), k001604_char_layout_layer_8x8, (UINT8*)&k001604->char_ram[0], device->machine().total_colors() / 16, 0));
9941   device->machine().gfx[k001604->gfx_index[1]] = auto_alloc(device->machine(), gfx_element(device->machine(), k001604_char_layout_layer_16x16, (UINT8*)&k001604->char_ram[0], device->machine().total_colors() / 16, 0));
99429942
99439943   device->save_pointer(NAME(k001604->reg), 0x400 / 4);
99449944   device->save_pointer(NAME(k001604->char_ram), 0x200000 / 4);
r17669r17670
1013310133   UINT32 addr = offset + (bank * (0x40000/4));
1013410134
1013510135   COMBINE_DATA(k037122->char_ram + addr);
10136   gfx_element_mark_dirty(device->machine().gfx[k037122->gfx_index], addr / 32);
10136   device->machine().gfx[k037122->gfx_index]->mark_dirty(addr / 32);
1013710137}
1013810138
1013910139READ32_DEVICE_HANDLER( k037122_reg_r )
r17669r17670
1017910179   k037122->layer[0]->set_transparent_pen(0);
1018010180   k037122->layer[1]->set_transparent_pen(0);
1018110181
10182   device->machine().gfx[k037122->gfx_index] = gfx_element_alloc(device->machine(), &k037122_char_layout, (UINT8*)k037122->char_ram, device->machine().total_colors() / 16, 0);
10182   device->machine().gfx[k037122->gfx_index] = auto_alloc(device->machine(), gfx_element(device->machine(), k037122_char_layout, (UINT8*)k037122->char_ram, device->machine().total_colors() / 16, 0));
1018310183
1018410184   device->save_pointer(NAME(k037122->reg), 0x400 / 4);
1018510185   device->save_pointer(NAME(k037122->char_ram), 0x200000 / 4);
trunk/src/mame/video/djmain.c
r17669r17670
1919   int offs, pri_code;
2020   int sortedlist[NUM_SPRITES];
2121
22   machine.gfx[0]->color_base = k055555_read_register(k055555, K55_PALBASE_SUB2) * 0x400;
22   machine.gfx[0]->set_colorbase(k055555_read_register(k055555, K55_PALBASE_SUB2) * 0x400);
2323
2424   for (offs = 0; offs < NUM_SPRITES; offs++)
2525      sortedlist[offs] = -1;
trunk/src/mame/video/mustache.c
r17669r17670
102102{
103103   mustache_state *state = machine.driver_data<mustache_state>();
104104   rectangle clip = cliprect;
105   const gfx_element *gfx = machine.gfx[1];
105   gfx_element *gfx = machine.gfx[1];
106106   const rectangle &visarea = machine.primary_screen->visible_area();
107107   UINT8 *spriteram = state->m_spriteram;
108108   int offs;
trunk/src/mame/video/konamigx.c
r17669r17670
377377
378378
379379INLINE void zdrawgfxzoom32GP(
380      bitmap_rgb32 &bitmap, const rectangle &cliprect, const gfx_element *gfx,
380      bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx,
381381      UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy,
382382      int scalex, int scaley, int alpha, int drawmode, int zcode, int pri)
383383{
r17669r17670
416416   if (!scalex || !scaley) return;
417417
418418   // find shadow pens and cull invisible shadows
419   granularity = shdpen = gfx->color_granularity;
419   granularity = shdpen = gfx->granularity();
420420   shdpen--;
421421
422422   if (zcode >= 0)
r17669r17670
440440   src_pitch = 16;
441441   src_fw    = 16;
442442   src_fh    = 16;
443   src_base  = gfx_element_get_data(gfx, code % gfx->total_elements);
443   src_base  = gfx->get_data(code % gfx->elements());
444444
445   pal_base  = gfx->machine().pens + gfx->color_base + (color % gfx->total_colors) * granularity;
445   pal_base  = gfx->machine().pens + gfx->colorbase() + (color % gfx->colors()) * granularity;
446446   shd_base  = gfx->machine().shadow_table;
447447
448448   dst_ptr   = &bitmap.pix32(0);
trunk/src/mame/video/combatsc.c
r17669r17670
515515static void bootleg_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *source, int circuit )
516516{
517517   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
518   const gfx_element *gfx = machine.gfx[circuit + 2];
518   gfx_element *gfx = machine.gfx[circuit + 2];
519519
520520   int limit = circuit ? (space->read_byte(0xc2) * 256 + space->read_byte(0xc3)) : (space->read_byte(0xc0) * 256 + space->read_byte(0xc1));
521521   const UINT8 *finish;
trunk/src/mame/video/buggychl.c
r17669r17670
2020   state->save_item(NAME(state->m_tmp_bitmap1));
2121   state->save_item(NAME(state->m_tmp_bitmap2));
2222
23   gfx_element_set_source(machine.gfx[0], state->m_charram);
23   machine.gfx[0]->set_source(state->m_charram);
2424}
2525
2626
r17669r17670
3030   if (m_charram[offset] != data)
3131   {
3232      m_charram[offset] = data;
33      gfx_element_mark_dirty(machine().gfx[0], (offset / 8) & 0xff);
33      machine().gfx[0]->mark_dirty((offset / 8) & 0xff);
3434   }
3535}
3636
r17669r17670
205205               code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8));
206206               realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy;
207207               code += (realflipy ? (charline ^ 7) : charline);
208               pendata = gfx_element_get_data(machine.gfx[1], code);
208               pendata = machine.gfx[1]->get_data(code);
209209
210210               for (x = 0; x < 16; x++)
211211               {
trunk/src/mame/video/starshp1.c
r17669r17670
393393
394394      rect.min_x = get_sprite_hpos(state, 13);
395395      rect.min_y = get_sprite_vpos(state, 13);
396      rect.max_x = rect.min_x + screen.machine().gfx[1]->width - 1;
397      rect.max_y = rect.min_y + screen.machine().gfx[1]->height - 1;
396      rect.max_x = rect.min_x + screen.machine().gfx[1]->width() - 1;
397      rect.max_y = rect.min_y + screen.machine().gfx[1]->height() - 1;
398398
399399      rect &= state->m_helper.cliprect();
400400
trunk/src/mame/video/bigstrkb.c
r17669r17670
1717    **- End of Comments -*/
1818
1919   bigstrkb_state *state = machine.driver_data<bigstrkb_state>();
20   const gfx_element *gfx = machine.gfx[2];
20   gfx_element *gfx = machine.gfx[2];
2121   UINT16 *source = state->m_spriteram;
2222   UINT16 *finish = source + 0x800/2;
2323
trunk/src/mame/video/taito_f2.c
r17669r17670
283283   m_spritebank_buffered[7] = m_spritebank_buffered[6] + 0x400;
284284}
285285
286static void taito_f2_tc360_spritemixdraw( running_machine &machine, bitmap_ind16 &dest_bmp, const rectangle &clip, const gfx_element *gfx,
286static void taito_f2_tc360_spritemixdraw( running_machine &machine, bitmap_ind16 &dest_bmp, const rectangle &clip, gfx_element *gfx,
287287      UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy, int scalex, int scaley )
288288{
289289   taitof2_state *state = machine.driver_data<taitof2_state>();
290   int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
291   const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
290   int pal_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors());
291   const UINT8 *source_base = gfx->get_data(code % gfx->elements());
292292   bitmap_ind8 &priority_bitmap = gfx->machine().priority_bitmap;
293   int sprite_screen_height = (scaley * gfx->height + 0x8000) >> 16;
294   int sprite_screen_width = (scalex * gfx->width + 0x8000) >> 16;
293   int sprite_screen_height = (scaley * gfx->height() + 0x8000) >> 16;
294   int sprite_screen_width = (scalex * gfx->width() + 0x8000) >> 16;
295295
296296   if (!scalex || !scaley)
297297      return;
r17669r17670
299299   if (sprite_screen_width && sprite_screen_height)
300300   {
301301      /* compute sprite increment per screen pixel */
302      int dx = (gfx->width << 16) / sprite_screen_width;
303      int dy = (gfx->height << 16) / sprite_screen_height;
302      int dx = (gfx->width() << 16) / sprite_screen_width;
303      int dy = (gfx->height() << 16) / sprite_screen_height;
304304
305305      int ex = sx + sprite_screen_width;
306306      int ey = sy + sprite_screen_height;
r17669r17670
359359
360360         for (y = sy; y < ey; y++)
361361         {
362            const UINT8 *source = source_base + (y_index >> 16) * gfx->line_modulo;
362            const UINT8 *source = source_base + (y_index >> 16) * gfx->rowbytes();
363363            UINT16 *dest = &dest_bmp.pix16(y);
364364            UINT8 *pri = &priority_bitmap.pix8(y);
365365
r17669r17670
759759      {
760760         sprite_ptr->code = code;
761761         sprite_ptr->color = color;
762         if (machine.gfx[0]->color_granularity == 64)   /* Final Blow is 6-bit deep */
762         if (machine.gfx[0]->granularity() == 64)   /* Final Blow is 6-bit deep */
763763            sprite_ptr->color /= 4;
764764         sprite_ptr->flipx = flipx;
765765         sprite_ptr->flipy = flipy;
trunk/src/mame/video/gottlieb.c
r17669r17670
109109   if (m_charram[offset] != data)
110110   {
111111      m_charram[offset] = data;
112      gfx_element_mark_dirty(machine().gfx[0], offset / 32);
112      machine().gfx[0]->mark_dirty(offset / 32);
113113   }
114114}
115115
r17669r17670
163163   state->m_bg_tilemap->set_transparent_pen(0);
164164   state->m_bg_tilemap->set_scrolldx(0, 318 - 256);
165165
166   gfx_element_set_source(machine.gfx[0], state->m_charram);
166   machine.gfx[0]->set_source(state->m_charram);
167167
168168   /* save some state */
169169   state_save_register_global(machine, state->m_background_priority);
r17669r17670
190190   state->m_bg_tilemap->set_transparent_pen(0);
191191   state->m_bg_tilemap->set_scrolldx(0, 318 - 256);
192192
193   gfx_element_set_source(machine.gfx[0], state->m_charram);
193   machine.gfx[0]->set_source(state->m_charram);
194194
195195   /* save some state */
196196   state_save_register_global(machine, state->m_background_priority);
trunk/src/mame/video/ddragon.c
r17669r17670
155155static void draw_sprites( running_machine& machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
156156{
157157   ddragon_state *state = machine.driver_data<ddragon_state>();
158   const gfx_element *gfx = machine.gfx[1];
158   gfx_element *gfx = machine.gfx[1];
159159
160160   UINT8 *src;
161161   int i;
trunk/src/mame/video/xxmissio.c
r17669r17670
8282}
8383
8484
85static void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const gfx_element *gfx)
85static void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx)
8686{
8787   xxmissio_state *state = gfx->machine().driver_data<xxmissio_state>();
8888   int offs;
trunk/src/mame/video/mugsmash.c
r17669r17670
2828   mugsmash_state *state = machine.driver_data<mugsmash_state>();
2929   const UINT16 *source = state->m_spriteram;
3030   const UINT16 *finish = source + 0x2000;
31   const gfx_element *gfx = machine.gfx[0];
31   gfx_element *gfx = machine.gfx[0];
3232
3333   while (source < finish)
3434   {
trunk/src/mame/video/hng64.c
r17669r17670
9292while (0)                                                         \
9393
9494
95static void pdrawgfx_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
95static void pdrawgfx_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
9696      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
9797      bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen)
9898{
r17669r17670
103103   assert(gfx != NULL);
104104
105105   /* get final code and color, and grab lookup tables */
106   code %= gfx->total_elements;
107   color %= gfx->total_colors;
108   paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color];
106   code %= gfx->elements();
107   color %= gfx->colors();
108   paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * color];
109109
110110   /* use pen usage to optimize */
111   if (gfx->pen_usage != NULL && !gfx->dirty[code])
111   if (gfx->has_pen_usage())
112112   {
113      UINT32 usage = gfx->pen_usage[code];
113      UINT32 usage = gfx->pen_usage(code);
114114
115115      /* fully transparent; do nothing */
116116      if ((usage & ~(1 << transpen)) == 0)
r17669r17670
125125}
126126
127127
128static void pdrawgfxzoom_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
128static void pdrawgfxzoom_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
129129      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
130130      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
131131      UINT32 transpen)
r17669r17670
145145   assert(gfx != NULL);
146146
147147   /* get final code and color, and grab lookup tables */
148   code %= gfx->total_elements;
149   color %= gfx->total_colors;
150   paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color];
148   code %= gfx->elements();
149   color %= gfx->colors();
150   paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * color];
151151
152152   /* use pen usage to optimize */
153   if (gfx->pen_usage != NULL && !gfx->dirty[code])
153   if (gfx->has_pen_usage())
154154   {
155      UINT32 usage = gfx->pen_usage[code];
155      UINT32 usage = gfx->pen_usage(code);
156156
157157      /* fully transparent; do nothing */
158158      if ((usage & ~(1 << transpen)) == 0)
r17669r17670
210210static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
211211{
212212   hng64_state *state = machine.driver_data<hng64_state>();
213   const gfx_element *gfx;
213   gfx_element *gfx;
214214   UINT32 *source = state->m_spriteram;
215215   UINT32 *finish = state->m_spriteram + 0xc000/4;
216216
trunk/src/mame/video/macrossp.c
r17669r17670
158158   state->m_scrb_tilemap->set_transparent_pen(0);
159159   state->m_scrc_tilemap->set_transparent_pen(0);
160160
161   machine.gfx[0]->color_granularity = 64;
162   machine.gfx[1]->color_granularity = 64;
163   machine.gfx[2]->color_granularity = 64;
164   machine.gfx[3]->color_granularity = 64;
161   machine.gfx[0]->set_granularity(64);
162   machine.gfx[1]->set_granularity(64);
163   machine.gfx[2]->set_granularity(64);
164   machine.gfx[3]->set_granularity(64);
165165
166166   state->save_pointer(NAME(state->m_spriteram_old), state->m_spriteram.bytes() / 4);
167167   state->save_pointer(NAME(state->m_spriteram_old2), state->m_spriteram.bytes() / 4);
r17669r17670
172172static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority )
173173{
174174   macrossp_state *state = machine.driver_data<macrossp_state>();
175   const gfx_element *gfx = machine.gfx[0];
175   gfx_element *gfx = machine.gfx[0];
176176   //  UINT32 *source = state->m_spriteram;
177177   UINT32 *source = state->m_spriteram_old2; /* buffers by two frames */
178178   UINT32 *finish = source + state->m_spriteram.bytes() / 4;
trunk/src/mame/video/taito_l.c
r17669r17670
149149
150150void taitol_chardef14_m( running_machine &machine, int offset )
151151{
152   gfx_element_mark_dirty(machine.gfx[2], offset / 32 + 0);
152   machine.gfx[2]->mark_dirty(offset / 32 + 0);
153153}
154154
155155void taitol_chardef15_m( running_machine &machine, int offset )
156156{
157   gfx_element_mark_dirty(machine.gfx[2], offset / 32 + 128);
157   machine.gfx[2]->mark_dirty(offset / 32 + 128);
158158}
159159
160160void taitol_chardef16_m( running_machine &machine, int offset )
161161{
162   gfx_element_mark_dirty(machine.gfx[2], offset / 32 + 256);
162   machine.gfx[2]->mark_dirty(offset / 32 + 256);
163163}
164164
165165void taitol_chardef17_m( running_machine &machine, int offset )
166166{
167   gfx_element_mark_dirty(machine.gfx[2], offset / 32 + 384);
167   machine.gfx[2]->mark_dirty(offset / 32 + 384);
168168}
169169
170170void taitol_chardef1c_m( running_machine &machine, int offset )
171171{
172   gfx_element_mark_dirty(machine.gfx[2], offset / 32 + 512);
172   machine.gfx[2]->mark_dirty(offset / 32 + 512);
173173}
174174
175175void taitol_chardef1d_m( running_machine &machine, int offset )
176176{
177   gfx_element_mark_dirty(machine.gfx[2], offset / 32 + 640);
177   machine.gfx[2]->mark_dirty(offset / 32 + 640);
178178}
179179
180180void taitol_chardef1e_m( running_machine &machine, int offset )
181181{
182   gfx_element_mark_dirty(machine.gfx[2], offset / 32 + 768);
182   machine.gfx[2]->mark_dirty(offset / 32 + 768);
183183}
184184
185185void taitol_chardef1f_m( running_machine &machine, int offset )
186186{
187   gfx_element_mark_dirty(machine.gfx[2], offset / 32 + 896);
187   machine.gfx[2]->mark_dirty(offset / 32 + 896);
188188}
189189
190190void taitol_bg18_m( running_machine &machine, int offset )
trunk/src/mame/video/fcombat.c
r17669r17670
162162      int code2 = code;
163163
164164      int color = ((flags >> 1) & 0x03) | ((code >> 5) & 0x04) | (code & 0x08) | (state->m_sprite_palette * 16);
165            const gfx_element *gfx = screen.machine().gfx[1];
165            gfx_element *gfx = screen.machine().gfx[1];
166166
167167      if (state->m_cocktail_flip)
168168      {
169         x = 64 * 8 - gfx->width - x;
170         y = 32 * 8 - gfx->height - y;
171         if (wide) y -= gfx->height;
169         x = 64 * 8 - gfx->width() - x;
170         y = 32 * 8 - gfx->height() - y;
171         if (wide) y -= gfx->height();
172172         xflip = !xflip;
173173         yflip = !yflip;
174174      }
r17669r17670
180180         else
181181            code &= ~0x10, code2 |= 0x10;
182182
183         drawgfx_transpen(bitmap, cliprect, gfx, code2, color, xflip, yflip, x, y + gfx->height, 0);
183         drawgfx_transpen(bitmap, cliprect, gfx, code2, color, xflip, yflip, x, y + gfx->height(), 0);
184184      }
185185
186186      if(flags&0x10)
187187      {
188         drawgfx_transpen(bitmap, cliprect, gfx, code2 + 16, color, xflip, yflip, x, y + gfx->height, 0);
189         drawgfx_transpen(bitmap, cliprect, gfx, code2 + 16 * 2, color, xflip, yflip, x, y + 2 * gfx->height, 0);
190         drawgfx_transpen(bitmap, cliprect, gfx, code2 + 16 * 3, color, xflip, yflip, x, y + 3 * gfx->height, 0);
188         drawgfx_transpen(bitmap, cliprect, gfx, code2 + 16, color, xflip, yflip, x, y + gfx->height(), 0);
189         drawgfx_transpen(bitmap, cliprect, gfx, code2 + 16 * 2, color, xflip, yflip, x, y + 2 * gfx->height(), 0);
190         drawgfx_transpen(bitmap, cliprect, gfx, code2 + 16 * 3, color, xflip, yflip, x, y + 3 * gfx->height(), 0);
191191
192192      }
193193
trunk/src/mame/video/thoop2.c
r17669r17670
151151{
152152   thoop2_state *state = machine.driver_data<thoop2_state>();
153153   int j, x, y, ex, ey;
154   const gfx_element *gfx = machine.gfx[0];
154   gfx_element *gfx = machine.gfx[0];
155155
156156   static const int x_offset[2] = {0x0,0x2};
157157   static const int y_offset[2] = {0x0,0x1};
trunk/src/mame/video/wwfwfest.c
r17669r17670
165165    **- End of Comments -*/
166166
167167   UINT16 *buffered_spriteram16 = state->m_spriteram->buffer();
168   const gfx_element *gfx = machine.gfx[1];
168   gfx_element *gfx = machine.gfx[1];
169169   UINT16 *source = buffered_spriteram16;
170170   UINT16 *finish = source + 0x2000/2;
171171
trunk/src/mame/video/marineb.c
r17669r17670
214214
215215      if (!state->m_flipscreen_y)
216216      {
217         sy = 256 - screen.machine().gfx[gfx]->width - sy;
217         sy = 256 - screen.machine().gfx[gfx]->width() - sy;
218218         flipy = !flipy;
219219      }
220220
r17669r17670
257257
258258      if (!state->m_flipscreen_y)
259259      {
260         sy = 256 - screen.machine().gfx[1]->width - sy;
260         sy = 256 - screen.machine().gfx[1]->width() - sy;
261261         flipy = !flipy;
262262      }
263263
r17669r17670
284284
285285   if (!state->m_flipscreen_y)
286286   {
287      sy = 256 - screen.machine().gfx[2]->width - sy;
287      sy = 256 - screen.machine().gfx[2]->width() - sy;
288288      flipy = !flipy;
289289   }
290290
r17669r17670
353353
354354      if (!state->m_flipscreen_y)
355355      {
356         sy = 256 - screen.machine().gfx[gfx]->width - sy;
356         sy = 256 - screen.machine().gfx[gfx]->width() - sy;
357357         flipy = !flipy;
358358      }
359359
r17669r17670
396396
397397      if (!state->m_flipscreen_y)
398398      {
399         sy = 256 - screen.machine().gfx[1]->width - sy;
399         sy = 256 - screen.machine().gfx[1]->width() - sy;
400400         flipy = !flipy;
401401      }
402402
403403      if (state->m_flipscreen_x)
404404      {
405         sx = 256 - screen.machine().gfx[1]->width - sx;
405         sx = 256 - screen.machine().gfx[1]->width() - sx;
406406         flipx = !flipx;
407407      }
408408
r17669r17670
456456
457457      if (!state->m_flipscreen_y)
458458      {
459         sy = 256 - screen.machine().gfx[gfx]->width - sy;
459         sy = 256 - screen.machine().gfx[gfx]->width() - sy;
460460         flipy = !flipy;
461461      }
462462
trunk/src/mame/video/fuukifg2.c
r17669r17670
105105   state->m_tilemap[2]->set_transparent_pen(0x0f);   // 4 bits
106106   state->m_tilemap[3]->set_transparent_pen(0x0f);   // 4 bits
107107
108   machine.gfx[2]->color_granularity = 16; /* 256 colour tiles with palette selectable on 16 colour boundaries */
108   machine.gfx[2]->set_granularity(16); /* 256 colour tiles with palette selectable on 16 colour boundaries */
109109}
110110
111111
r17669r17670
140140{
141141   fuuki16_state *state = screen.machine().driver_data<fuuki16_state>();
142142   int offs;
143   const gfx_element *gfx = screen.machine().gfx[0];
143   gfx_element *gfx = screen.machine().gfx[0];
144144   bitmap_ind8 &priority_bitmap = screen.machine().priority_bitmap;
145145   const rectangle &visarea = screen.visible_area();
146146   UINT16 *spriteram16 = state->m_spriteram;
trunk/src/mame/video/vulgus.c
r17669r17670
5252
5353
5454   /* characters use colors 32-47 (?) */
55   for (i = 0;i < machine.gfx[0]->total_colors * machine.gfx[0]->color_granularity;i++)
56      colortable_entry_set_value(machine.colortable, machine.gfx[0]->color_base + i, 32 + *color_prom++);
55   for (i = 0;i < machine.gfx[0]->colors() * machine.gfx[0]->granularity();i++)
56      colortable_entry_set_value(machine.colortable, machine.gfx[0]->colorbase() + i, 32 + *color_prom++);
5757
5858   /* sprites use colors 16-31 */
59   for (i = 0;i < machine.gfx[2]->total_colors * machine.gfx[2]->color_granularity;i++)
60      colortable_entry_set_value(machine.colortable, machine.gfx[2]->color_base + i, 16 + *color_prom++);
59   for (i = 0;i < machine.gfx[2]->colors() * machine.gfx[2]->granularity();i++)
60      colortable_entry_set_value(machine.colortable, machine.gfx[2]->colorbase() + i, 16 + *color_prom++);
6161
6262   /* background tiles use colors 0-15, 64-79, 128-143, 192-207 in four banks */
63   for (i = 0;i < machine.gfx[1]->total_colors * machine.gfx[1]->color_granularity / 4;i++)
63   for (i = 0;i < machine.gfx[1]->colors() * machine.gfx[1]->granularity() / 4;i++)
6464   {
65      colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + 0*32*8 + i, *color_prom);
66      colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + 1*32*8 + i, *color_prom + 64);
67      colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + 2*32*8 + i, *color_prom + 128);
68      colortable_entry_set_value(machine.colortable, machine.gfx[1]->color_base + 3*32*8 + i, *color_prom + 192);
65      colortable_entry_set_value(machine.colortable, machine.gfx[1]->colorbase() + 0*32*8 + i, *color_prom);
66      colortable_entry_set_value(machine.colortable, machine.gfx[1]->colorbase() + 1*32*8 + i, *color_prom + 64);
67      colortable_entry_set_value(machine.colortable, machine.gfx[1]->colorbase() + 2*32*8 + i, *color_prom + 128);
68      colortable_entry_set_value(machine.colortable, machine.gfx[1]->colorbase() + 3*32*8 + i, *color_prom + 192);
6969      color_prom++;
7070   }
7171}
trunk/src/mame/video/sderby.c
r17669r17670
6767   sderby_state *state = machine.driver_data<sderby_state>();
6868   UINT16 *spriteram16 = state->m_spriteram;
6969   int offs;
70   int height = machine.gfx[0]->height;
71   int colordiv = machine.gfx[0]->color_granularity / 16;
70   int height = machine.gfx[0]->height();
71   int colordiv = machine.gfx[0]->granularity() / 16;
7272
7373   for (offs = 4;offs < state->m_spriteram.bytes()/2;offs += 4)
7474   {
trunk/src/mame/video/circus.c
r17669r17670
6363static void draw_sprite_collision( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
6464{
6565   circus_state *state = machine.driver_data<circus_state>();
66   const gfx_element *sprite_gfx = machine.gfx[1];
67   const UINT8 *sprite_data = gfx_element_get_data(sprite_gfx, state->m_clown_z);
66   gfx_element *sprite_gfx = machine.gfx[1];
67   const UINT8 *sprite_data = sprite_gfx->get_data(state->m_clown_z);
6868   int sx, sy, dx, dy;
6969   int pixel, collision = 0;
7070
r17669r17670
7979            dx = state->m_clown_y + sx;
8080            if (dx>=0 && dx<bitmap.width())
8181            {
82               pixel = sprite_data[sy * sprite_gfx->line_modulo + sx];
82               pixel = sprite_data[sy * sprite_gfx->rowbytes() + sx];
8383               if (pixel)
8484               {
8585                  collision |= bitmap.pix16(dy, dx);
trunk/src/mame/video/zac2650.c
r17669r17670
3131WRITE8_MEMBER(zac2650_state::zac_s2636_w)
3232{
3333   m_s2636_0_ram[offset] = data;
34   gfx_element_mark_dirty(machine().gfx[1], offset/8);
35   gfx_element_mark_dirty(machine().gfx[2], offset/8);
34   machine().gfx[1]->mark_dirty(offset/8);
35   machine().gfx[2]->mark_dirty(offset/8);
3636   if (offset == 0xc7)
3737   {
3838      s2636_soundport_w(machine().device("s2636snd"), 0, data);
r17669r17670
7171
7272        /* Get fingerprint */
7373
74       for (x = fx; x < fx + machine.gfx[expand]->width; x++)
74       for (x = fx; x < fx + machine.gfx[expand]->width(); x++)
7575       {
76          for (y = fy; y < fy + machine.gfx[expand]->height; y++)
76          for (y = fy; y < fy + machine.gfx[expand]->height(); y++)
7777            {
7878             if (visarea.contains(x, y))
7979                  Checksum += state->m_spritebitmap.pix16(y, x);
r17669r17670
9090
9191        /* Remove fingerprint */
9292
93       for (x = fx; x < fx + machine.gfx[expand]->width; x++)
93       for (x = fx; x < fx + machine.gfx[expand]->width(); x++)
9494       {
95          for (y = fy; y < fy + machine.gfx[expand]->height; y++)
95          for (y = fy; y < fy + machine.gfx[expand]->height(); y++)
9696            {
9797             if (visarea.contains(x, y))
9898                  Checksum -= state->m_spritebitmap.pix16(y, x);
r17669r17670
129129   machine.primary_screen->register_screen_bitmap(state->m_bitmap);
130130   machine.primary_screen->register_screen_bitmap(state->m_spritebitmap);
131131
132   gfx_element_set_source(machine.gfx[1], state->m_s2636_0_ram);
133   gfx_element_set_source(machine.gfx[2], state->m_s2636_0_ram);
132   machine.gfx[1]->set_source(state->m_s2636_0_ram);
133   machine.gfx[2]->set_source(state->m_s2636_0_ram);
134134}
135135
136136static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
r17669r17670
172172                0,0,
173173                bx,by, 0);
174174
175           for (x = bx; x < bx + machine.gfx[expand]->width; x++)
175           for (x = bx; x < bx + machine.gfx[expand]->width(); x++)
176176           {
177              for (y = by; y < by + machine.gfx[expand]->height; y++)
177              for (y = by; y < by + machine.gfx[expand]->height(); y++)
178178                {
179179                 if (visarea.contains(x, y))
180180                      if (bitmap.pix16(y, x) != state->m_bitmap.pix16(y, x))
trunk/src/mame/video/taotaido.c
r17669r17670
4141   int x,y;
4242
4343   UINT16 *source = &state->m_spriteram_older[spriteno*4];
44   const gfx_element *gfx = machine.gfx[0];
44   gfx_element *gfx = machine.gfx[0];
4545
4646
4747   int yzoom = (source[0] & 0xf000) >> 12;
trunk/src/mame/video/relief.c
r17669r17670
8787   relief_state *state = machine.driver_data<relief_state>();
8888
8989   /* MOs are 5bpp but with a 4-bit color granularity */
90   machine.gfx[1]->color_granularity = 16;
90   machine.gfx[1]->set_granularity(16);
9191
9292   /* initialize the playfield */
9393   state->m_playfield_tilemap = tilemap_create(machine, get_playfield_tile_info, TILEMAP_SCAN_COLS,  8,8, 64,64);
trunk/src/mame/video/taito_f3.c
r17669r17670
649649   state->m_pf_line_inf = auto_alloc_array(machine, struct f3_playfield_line_inf, 5);
650650   state->m_sa_line_inf = auto_alloc_array(machine, struct f3_spritealpha_line_inf, 1);
651651   machine.primary_screen->register_screen_bitmap(state->m_pri_alp_bitmap);
652   state->m_tile_opaque_sp = auto_alloc_array(machine, UINT8, machine.gfx[2]->total_elements);
652   state->m_tile_opaque_sp = auto_alloc_array(machine, UINT8, machine.gfx[2]->elements());
653653   for (i=0; i<8; i++)
654      state->m_tile_opaque_pf[i] = auto_alloc_array(machine, UINT8, machine.gfx[1]->total_elements);
654      state->m_tile_opaque_pf[i] = auto_alloc_array(machine, UINT8, machine.gfx[1]->elements());
655655
656656
657657   state->m_vram_layer->set_transparent_pen(0);
r17669r17670
659659
660660   /* Palettes have 4 bpp indexes despite up to 6 bpp data. The unused */
661661   /* top bits in the gfx data are cleared later.                      */
662   machine.gfx[1]->color_granularity=16;
663   machine.gfx[2]->color_granularity=16;
662   machine.gfx[1]->set_granularity(16);
663   machine.gfx[2]->set_granularity(16);
664664
665665   state->m_flipscreen = 0;
666666   memset(state->m_spriteram16_buffered,0,0x10000);
r17669r17670
669669   state_save_register_global_array(machine, state->m_f3_control_0);
670670   state_save_register_global_array(machine, state->m_f3_control_1);
671671
672   gfx_element_set_source(machine.gfx[0], (UINT8 *)state->m_f3_vram);
673   gfx_element_set_source(machine.gfx[3], (UINT8 *)state->m_f3_pivot_ram);
672   machine.gfx[0]->set_source((UINT8 *)state->m_f3_vram);
673   machine.gfx[3]->set_source((UINT8 *)state->m_f3_pivot_ram);
674674
675675   state->m_f3_skip_this_frame=0;
676676
r17669r17670
679679   init_alpha_blend_func(machine);
680680
681681   {
682      const gfx_element *sprite_gfx = machine.gfx[2];
682      gfx_element *sprite_gfx = machine.gfx[2];
683683      int c;
684684
685      for (c = 0;c < sprite_gfx->total_elements;c++)
685      for (c = 0;c < sprite_gfx->elements();c++)
686686      {
687687         int x,y;
688688         int chk_trans_or_opa=0;
689         const UINT8 *dp = gfx_element_get_data(sprite_gfx, c);
690         for (y = 0;y < sprite_gfx->height;y++)
689         const UINT8 *dp = sprite_gfx->get_data(c);
690         for (y = 0;y < sprite_gfx->height();y++)
691691         {
692            for (x = 0;x < sprite_gfx->width;x++)
692            for (x = 0;x < sprite_gfx->width();x++)
693693            {
694694               if(!dp[x]) chk_trans_or_opa|=2;
695695               else      chk_trans_or_opa|=1;
696696            }
697            dp += sprite_gfx->line_modulo;
697            dp += sprite_gfx->rowbytes();
698698         }
699699         if(chk_trans_or_opa==1) state->m_tile_opaque_sp[c]=1;
700700         else               state->m_tile_opaque_sp[c]=0;
r17669r17670
703703
704704
705705   {
706      const gfx_element *pf_gfx = machine.gfx[1];
706      gfx_element *pf_gfx = machine.gfx[1];
707707      int c;
708708
709      for (c = 0;c < pf_gfx->total_elements;c++)
709      for (c = 0;c < pf_gfx->elements();c++)
710710      {
711711         int x,y;
712712         int extra_planes; /* 0 = 4bpp, 1=5bpp, 2=?, 3=6bpp */
r17669r17670
715715         {
716716            int chk_trans_or_opa=0;
717717            UINT8 extra_mask = ((extra_planes << 4) | 0x0f);
718            const UINT8 *dp = gfx_element_get_data(pf_gfx, c);
718            const UINT8 *dp = pf_gfx->get_data(c);
719719
720            for (y = 0;y < pf_gfx->height;y++)
720            for (y = 0;y < pf_gfx->height();y++)
721721            {
722               for (x = 0;x < pf_gfx->width;x++)
722               for (x = 0;x < pf_gfx->width();x++)
723723               {
724724                  if(!(dp[x] & extra_mask))
725725                     chk_trans_or_opa|=2;
726726                  else
727727                     chk_trans_or_opa|=1;
728728               }
729               dp += pf_gfx->line_modulo;
729               dp += pf_gfx->rowbytes();
730730            }
731731            state->m_tile_opaque_pf[extra_planes][c]=chk_trans_or_opa;
732732         }
r17669r17670
814814WRITE16_MEMBER(taito_f3_state::f3_vram_w)
815815{
816816   COMBINE_DATA(&m_f3_vram[offset]);
817   gfx_element_mark_dirty(machine().gfx[0], offset/16);
817   machine().gfx[0]->mark_dirty(offset/16);
818818}
819819
820820READ16_MEMBER(taito_f3_state::f3_pivot_r)
r17669r17670
825825WRITE16_MEMBER(taito_f3_state::f3_pivot_w)
826826{
827827   COMBINE_DATA(&m_f3_pivot_ram[offset]);
828   gfx_element_mark_dirty(machine().gfx[3], offset/16);
828   machine().gfx[3]->mark_dirty(offset/16);
829829}
830830
831831READ16_MEMBER(taito_f3_state::f3_lineram_r)
r17669r17670
15671567   alpha_mode=line_t->alpha_mode[line];
15681568   if(!alpha_mode) return;
15691569
1570   total_elements=machine.gfx[1]->total_elements;
1570   total_elements=machine.gfx[1]->elements();
15711571
15721572   tile_index=x_index_fx>>16;
15731573   tile_num=(((line_t->x_zoom[line]*320+(x_index_fx & 0xffff)+0xffff)>>16)+(tile_index%16)+15)/16;
r17669r17670
25802580   pri++;
25812581
25822582INLINE void f3_drawgfx(
2583      bitmap_rgb32 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
2583      bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
25842584      int code,
25852585      int color,
25862586      int flipx,int flipy,
r17669r17670
25992599
26002600   if( gfx )
26012601   {
2602      const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
2603      const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements);
2602      const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
2603      const UINT8 *code_base = gfx->get_data(code % gfx->elements());
26042604
26052605      {
26062606         /* compute sprite increment per screen pixel */
r17669r17670
26622662//              if (dest_bmp.bpp == 32)
26632663            {
26642664               int y=ey-sy;
2665               int x=(ex-sx-1)|(state->m_tile_opaque_sp[code % gfx->total_elements]<<4);
2665               int x=(ex-sx-1)|(state->m_tile_opaque_sp[code % gfx->elements()]<<4);
26662666               const UINT8 *source0 = code_base + y_index * 16 + x_index_base;
26672667               UINT32 *dest0 = &dest_bmp.pix32(sy, sx);
26682668               UINT8 *pri0 = &state->m_pri_alp_bitmap.pix8(sy, sx);
r17669r17670
27302730
27312731
27322732INLINE void f3_drawgfxzoom(
2733      bitmap_rgb32 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
2733      bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
27342734      int code,
27352735      int color,
27362736      int flipx,int flipy,
r17669r17670
27502750
27512751   if( gfx )
27522752   {
2753      const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
2754      const UINT8 *code_base = gfx_element_get_data(gfx, code % gfx->total_elements);
2753      const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
2754      const UINT8 *code_base = gfx->get_data(code % gfx->elements());
27552755
27562756      {
27572757         /* compute sprite increment per screen pixel */
r17669r17670
31223122{
31233123   taito_f3_state *state = machine.driver_data<taito_f3_state>();
31243124   const struct tempsprite *sprite_ptr;
3125   const gfx_element *sprite_gfx = machine.gfx[2];
3125   gfx_element *sprite_gfx = machine.gfx[2];
31263126
31273127   sprite_ptr = state->m_sprite_end;
31283128   state->m_sprite_pri_usage=0;
trunk/src/mame/video/gaelco2.c
r17669r17670
343343   gaelco2_state *state = screen.machine().driver_data<gaelco2_state>();
344344   UINT16 *buffered_spriteram16 = state->m_spriteram->buffer();
345345   int j, x, y, ex, ey, px, py;
346   const gfx_element *gfx = screen.machine().gfx[0];
346   gfx_element *gfx = screen.machine().gfx[0];
347347
348348   /* get sprite ram start and end offsets */
349349   int start_offset = (state->m_vregs[1] & 0x10)*0x100;
r17669r17670
392392               } else { /* last palette entry is reserved for shadows and highlights */
393393
394394                  /* get a pointer to the current sprite's gfx data */
395                  const UINT8 *gfx_src = gfx_element_get_data(gfx, number % gfx->total_elements);
395                  const UINT8 *gfx_src = gfx->get_data(number % gfx->elements());
396396
397                  for (py = 0; py < gfx->height; py++){
397                  for (py = 0; py < gfx->height(); py++){
398398                     /* get a pointer to the current line in the screen bitmap */
399399                     int ypos = ((sy + ey*16 + py) & 0x1ff);
400400                     UINT16 *srcy = &bitmap.pix16(ypos);
401401
402                     int gfx_py = yflip ? (gfx->height - 1 - py) : py;
402                     int gfx_py = yflip ? (gfx->height() - 1 - py) : py;
403403
404404                     if ((ypos < cliprect.min_y) || (ypos > cliprect.max_y)) continue;
405405
406                     for (px = 0; px < gfx->width; px++){
406                     for (px = 0; px < gfx->width(); px++){
407407                        /* get current pixel */
408408                        int xpos = (((sx + ex*16 + px) & 0x3ff) + spr_x_adjust) & 0x3ff;
409409                        UINT16 *pixel = srcy + xpos;
410410                        int src_color = *pixel;
411411
412                        int gfx_px = xflip ? (gfx->width - 1 - px) : px;
412                        int gfx_px = xflip ? (gfx->width() - 1 - px) : px;
413413
414414                        /* get asociated pen for the current sprite pixel */
415                        int gfx_pen = gfx_src[gfx->line_modulo*gfx_py + gfx_px];
415                        int gfx_pen = gfx_src[gfx->rowbytes()*gfx_py + gfx_px];
416416
417417                        if ((gfx_pen == 0) || (gfx_pen >= 16)) continue;
418418
trunk/src/mame/video/champbas.c
r17669r17670
196196{
197197   champbas_state *state = machine.driver_data<champbas_state>();
198198   int offs;
199   const gfx_element* const gfx = machine.gfx[1];
199   gfx_element* const gfx = machine.gfx[1];
200200
201201   for (offs = state->m_spriteram.bytes() - 2; offs >= 0; offs -= 2)
202202   {
trunk/src/mame/video/mcr.c
r17669r17670
254254{
255255   mcr_state *state = machine.driver_data<mcr_state>();
256256   UINT8 *spriteram = state->m_spriteram;
257   const gfx_element *gfx = machine.gfx[1];
257   gfx_element *gfx = machine.gfx[1];
258258   int offs;
259259
260260   /* render the sprites into the bitmap, ORing together */
r17669r17670
288288      for (y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff)
289289         if (sy >= cliprect.min_y && sy <= cliprect.max_y)
290290         {
291            const UINT8 *src = gfx_element_get_data(gfx, code) + gfx->line_modulo * (y ^ vflip);
291            const UINT8 *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip);
292292            UINT16 *dst = &bitmap.pix16(sy);
293293            UINT8 *pri = &machine.priority_bitmap.pix8(sy);
294294
r17669r17670
327327{
328328   mcr_state *state = machine.driver_data<mcr_state>();
329329   UINT8 *spriteram = state->m_spriteram;
330   const gfx_element *gfx = machine.gfx[1];
330   gfx_element *gfx = machine.gfx[1];
331331   int offs;
332332
333333   /* render the sprites into the bitmap, working from topmost to bottommost */
r17669r17670
336336      int code, color, x, y, sx, sy, hflip, vflip;
337337
338338      /* extract the bits of information */
339      code = (spriteram[offs + 2] + 256 * ((spriteram[offs + 1] >> 3) & 0x01)) % gfx->total_elements;
339      code = (spriteram[offs + 2] + 256 * ((spriteram[offs + 1] >> 3) & 0x01)) % gfx->elements();
340340      color = (((~spriteram[offs + 1] & 3) << 4) & sprmask) | colormask;
341341      hflip = (spriteram[offs + 1] & 0x10) ? 31 : 0;
342342      vflip = (spriteram[offs + 1] & 0x20) ? 31 : 0;
r17669r17670
360360      for (y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff)
361361         if (sy >= 2 && sy >= cliprect.min_y && sy <= cliprect.max_y)
362362         {
363            const UINT8 *src = gfx_element_get_data(gfx, code) + gfx->line_modulo * (y ^ vflip);
363            const UINT8 *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip);
364364            UINT16 *dst = &bitmap.pix16(sy);
365365            UINT8 *pri = &machine.priority_bitmap.pix8(sy);
366366
trunk/src/mame/video/bwing.c
r17669r17670
9696   {
9797      offs = offset;
9898      if (offset < 0x1000)
99         gfx_element_mark_dirty(machine().gfx[2], offset / 32);
99         machine().gfx[2]->mark_dirty(offset / 32);
100100      else
101         gfx_element_mark_dirty(machine().gfx[3], offset / 32);
101         machine().gfx[3]->mark_dirty(offset / 32);
102102   }
103103
104104   (m_srbase[m_srbank])[offs] = data;
r17669r17670
173173static TILE_GET_INFO( get_fgtileinfo )
174174{
175175   bwing_state *state = machine.driver_data<bwing_state>();
176   tileinfo.pen_data = gfx_element_get_data(machine.gfx[2], state->m_fgdata[tile_index] & (BW_NTILES - 1));
177   tileinfo.palette_base = machine.gfx[2]->color_base + ((state->m_fgdata[tile_index] >> 7) << 3);
176   tileinfo.pen_data = machine.gfx[2]->get_data(state->m_fgdata[tile_index] & (BW_NTILES - 1));
177   tileinfo.palette_base = machine.gfx[2]->colorbase() + ((state->m_fgdata[tile_index] >> 7) << 3);
178178}
179179
180180static TILE_GET_INFO( get_bgtileinfo )
181181{
182182   bwing_state *state = machine.driver_data<bwing_state>();
183   tileinfo.pen_data = gfx_element_get_data(machine.gfx[3], state->m_bgdata[tile_index] & (BW_NTILES - 1));
184   tileinfo.palette_base = machine.gfx[3]->color_base + ((state->m_bgdata[tile_index] >> 7) << 3);
183   tileinfo.pen_data = machine.gfx[3]->get_data(state->m_bgdata[tile_index] & (BW_NTILES - 1));
184   tileinfo.palette_base = machine.gfx[3]->colorbase() + ((state->m_bgdata[tile_index] >> 7) << 3);
185185}
186186
187187static TILE_GET_INFO( get_charinfo )
r17669r17670
199199VIDEO_START( bwing )
200200{
201201   bwing_state *state = machine.driver_data<bwing_state>();
202   UINT32 *dwptr;
202//   UINT32 *dwptr;
203203   int i;
204204
205205   state->m_charmap = tilemap_create(machine, get_charinfo, TILEMAP_SCAN_COLS, 8, 8, 32, 32);
r17669r17670
224224      state->m_sreg[i] = 0;
225225
226226//  state->m_fgfx = machine.gfx[2];
227   gfx_element_set_source(machine.gfx[2], state->m_srbase[1]);
227   machine.gfx[2]->set_source(state->m_srbase[1]);
228228
229229//  state->m_bgfx = machine.gfx[3];
230   gfx_element_set_source(machine.gfx[3], state->m_srbase[1] + 0x1000);
231
232   dwptr = machine.gfx[2]->pen_usage;
230   machine.gfx[3]->set_source(state->m_srbase[1] + 0x1000);
231/*
232   WTF??
233   
234   dwptr = machine.gfx[2]->pen_usage();
233235   if (dwptr)
234236   {
235237      dwptr[0] = 0;
236238      for(i = 1; i < BW_NTILES; i++)
237239         dwptr[i] = -1;
238240   }
241*/
239242}
240243
241244//****************************************************************************
trunk/src/mame/video/cave.c
r17669r17670
442442
443443   state->m_background_color = machine.config().m_gfxdecodeinfo[0].color_codes_start +
444444               (machine.config().m_gfxdecodeinfo[0].total_color_codes - 1) *
445                  machine.gfx[0]->color_granularity;
445                  machine.gfx[0]->granularity();
446446
447447   switch (state->m_kludge)
448448   {
trunk/src/mame/video/williams.c
r17669r17670
378378static TILE_GET_INFO( get_tile_info )
379379{
380380   williams_state *state = machine.driver_data<williams_state>();
381   int mask = machine.gfx[0]->total_elements - 1;
381   int mask = machine.gfx[0]->elements() - 1;
382382   int data = state->m_williams2_tileram[tile_index];
383383   int y = (tile_index >> 1) & 7;
384384   int color = 0;
trunk/src/mame/video/fuukifg3.c
r17669r17670
110110   state->m_tilemap[2]->set_transparent_pen(0x0f);   // 4 bits
111111   state->m_tilemap[3]->set_transparent_pen(0x0f);   // 4 bits
112112
113   //machine.gfx[1]->color_granularity = 16; /* 256 colour tiles with palette selectable on 16 colour boundaries */
114   //machine.gfx[2]->color_granularity = 16;
113   //machine.gfx[1]->set_granularity(16); /* 256 colour tiles with palette selectable on 16 colour boundaries */
114   //machine.gfx[2]->set_granularity(16);
115115}
116116
117117
r17669r17670
147147{
148148   fuuki32_state *state = screen.machine().driver_data<fuuki32_state>();
149149   int offs;
150   const gfx_element *gfx = screen.machine().gfx[0];
150   gfx_element *gfx = screen.machine().gfx[0];
151151   bitmap_ind8 &priority_bitmap = screen.machine().priority_bitmap;
152152   const rectangle &visarea = screen.visible_area();
153153   int max_x =   visarea.max_x + 1;
trunk/src/mame/video/kaneko_spr.c
r17669r17670
218218}
219219
220220// custom function to draw a single sprite. needed to keep correct sprites - sprites and sprites - tilemaps priorities
221void kaneko16_sprite_device::kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
221void kaneko16_sprite_device::kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
222222      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
223223      int priority)
224224{
225   pen_t pen_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
226   const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
225   pen_t pen_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors());
226   const UINT8 *source_base = gfx->get_data(code % gfx->elements());
227227   bitmap_ind8 &priority_bitmap = gfx->machine().priority_bitmap;
228   int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16;
229   int sprite_screen_width = ((1<<16)*gfx->width+0x8000)>>16;
228   int sprite_screen_height = ((1<<16)*gfx->height()+0x8000)>>16;
229   int sprite_screen_width = ((1<<16)*gfx->width()+0x8000)>>16;
230230
231231   if (sprite_screen_width && sprite_screen_height)
232232   {
233233      /* compute sprite increment per screen pixel */
234      int dx = (gfx->width<<16)/sprite_screen_width;
235      int dy = (gfx->height<<16)/sprite_screen_height;
234      int dx = (gfx->width()<<16)/sprite_screen_width;
235      int dy = (gfx->height()<<16)/sprite_screen_height;
236236
237237      int ex = sx+sprite_screen_width;
238238      int ey = sy+sprite_screen_height;
r17669r17670
290290
291291         for( y=sy; y<ey; y++ )
292292         {
293            const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
293            const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
294294            UINT16 *dest = &dest_bmp.pix16(y);
295295            UINT8 *pri = &priority_bitmap.pix8(y);
296296
trunk/src/mame/video/thepit.c
r17669r17670
109109static TILE_GET_INFO( get_tile_info )
110110{
111111   thepit_state *state = machine.driver_data<thepit_state>();
112   UINT8 fore_color = state->m_colorram[tile_index] % machine.gfx[0]->total_colors;
112   UINT8 fore_color = state->m_colorram[tile_index] % machine.gfx[0]->colors();
113113   UINT8 code = state->m_videoram[tile_index];
114114   SET_TILE_INFO(2 * state->m_graphics_bank, code, fore_color, 0);
115115}
trunk/src/mame/video/kaneko_spr.h
r17669r17670
8282
8383   void kaneko16_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16* spriteram16, int spriteram16_bytes);
8484
85   void kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
85   void kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
8686         UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
8787         int priority);
8888
trunk/src/mame/video/pirates.c
r17669r17670
7474static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
7575{
7676   pirates_state *state = machine.driver_data<pirates_state>();
77   const gfx_element *gfx = machine.gfx[1];
77   gfx_element *gfx = machine.gfx[1];
7878   UINT16 *source = state->m_spriteram + 4;
7979   UINT16 *finish = source + 0x800/2-4;
8080
trunk/src/mame/video/exerion.c
r17669r17670
372372      int code2 = code;
373373
374374      int color = ((flags >> 1) & 0x03) | ((code >> 5) & 0x04) | (code & 0x08) | (state->m_sprite_palette * 16);
375      const gfx_element *gfx = doubled ? screen.machine().gfx[2] : screen.machine().gfx[1];
375      gfx_element *gfx = doubled ? screen.machine().gfx[2] : screen.machine().gfx[1];
376376
377377      if (state->m_cocktail_flip)
378378      {
379         x = 64*8 - gfx->width - x;
380         y = 32*8 - gfx->height - y;
381         if (wide) y -= gfx->height;
379         x = 64*8 - gfx->width() - x;
380         y = 32*8 - gfx->height() - y;
381         if (wide) y -= gfx->height();
382382         xflip = !xflip;
383383         yflip = !yflip;
384384      }
r17669r17670
390390         else
391391            code &= ~0x10, code2 |= 0x10;
392392
393         drawgfx_transmask(bitmap, cliprect, gfx, code2, color, xflip, yflip, x, y + gfx->height,
393         drawgfx_transmask(bitmap, cliprect, gfx, code2, color, xflip, yflip, x, y + gfx->height(),
394394                 colortable_get_transpen_mask(screen.machine().colortable, gfx, color, 0x10));
395395      }
396396
trunk/src/mame/video/wrally.c
r17669r17670
108108{
109109   wrally_state *state = machine.driver_data<wrally_state>();
110110   int i, px, py;
111   const gfx_element *gfx = machine.gfx[0];
111   gfx_element *gfx = machine.gfx[0];
112112
113113   for (i = 6/2; i < (0x1000 - 6)/2; i += 4) {
114114      int sx = state->m_spriteram[i+2] & 0x03ff;
r17669r17670
135135               sx - 0x0f,sy,0);
136136      } else {
137137         /* get a pointer to the current sprite's gfx data */
138         const UINT8 *gfx_src = gfx_element_get_data(gfx, number % gfx->total_elements);
138         const UINT8 *gfx_src = gfx->get_data(number % gfx->elements());
139139
140         for (py = 0; py < gfx->height; py++){
140         for (py = 0; py < gfx->height(); py++){
141141            /* get a pointer to the current line in the screen bitmap */
142142            int ypos = ((sy + py) & 0x1ff);
143143            UINT16 *srcy = &bitmap.pix16(ypos);
144144
145            int gfx_py = yflip ? (gfx->height - 1 - py) : py;
145            int gfx_py = yflip ? (gfx->height() - 1 - py) : py;
146146
147147            if ((ypos < cliprect.min_y) || (ypos > cliprect.max_y)) continue;
148148
149            for (px = 0; px < gfx->width; px++){
149            for (px = 0; px < gfx->width(); px++){
150150               /* get current pixel */
151151               int xpos = (((sx + px) & 0x3ff) - 0x0f) & 0x3ff;
152152               UINT16 *pixel = srcy + xpos;
153153               int src_color = *pixel;
154154
155               int gfx_px = xflip ? (gfx->width - 1 - px) : px;
155               int gfx_px = xflip ? (gfx->width() - 1 - px) : px;
156156
157157               /* get asociated pen for the current sprite pixel */
158               int gfx_pen = gfx_src[gfx->line_modulo*gfx_py + gfx_px];
158               int gfx_pen = gfx_src[gfx->rowbytes()*gfx_py + gfx_px];
159159
160160               /* pens 8..15 are used to select a palette */
161161               if ((gfx_pen < 8) || (gfx_pen >= 16)) continue;
trunk/src/mame/video/gp9001.c
r17669r17670
758758
759759void gp9001vdp_device::draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8* primap )
760760{
761   const gfx_element *gfx = machine.gfx[tile_region+1];
761   gfx_element *gfx = machine.gfx[tile_region+1];
762762
763763   int offs, old_x, old_y;
764764
r17669r17670
866866                        flipx,flipy,
867867                        sx,sy,0);
868868                    */
869               sprite %= gfx->total_elements;
870               color %= gfx->total_colors;
869               sprite %= gfx->elements();
870               color %= gfx->colors();
871871
872872               {
873873                  int yy, xx;
874                  const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color];
875                  const UINT8* srcdata = gfx_element_get_data(gfx, sprite);
874                  const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * color];
875                  const UINT8* srcdata = gfx->get_data(sprite);
876876                  int count = 0;
877877                  int ystart, yend, yinc;
878878                  int xstart, xend, xinc;
trunk/src/mame/video/m10.c
r17669r17670
7373   if (m_chargen[offset] != data)
7474   {
7575      m_chargen[offset] = data;
76      gfx_element_mark_dirty(m_back_gfx, offset >> (3 + 5));
76      m_back_gfx->mark_dirty(offset >> (3 + 5));
7777   }
7878}
7979
r17669r17670
8484   if (m_chargen[offset] != data)
8585   {
8686      m_chargen[offset] = data;
87      gfx_element_mark_dirty(machine().gfx[0], offset >> 3);
87      machine().gfx[0]->mark_dirty(offset >> 3);
8888   }
8989}
9090
r17669r17670
109109   state->m_tx_tilemap->set_scrolldx(0, 62);
110110   state->m_tx_tilemap->set_scrolldy(0, 0);
111111
112   state->m_back_gfx = gfx_element_alloc(machine, &backlayout, state->m_chargen, 8, 0);
112   state->m_back_gfx = auto_alloc(machine, gfx_element(machine, backlayout, state->m_chargen, 8, 0));
113113
114114   machine.gfx[1] = state->m_back_gfx;
115115   return ;
r17669r17670
119119{
120120   m10_state *state = machine.driver_data<m10_state>();
121121
122   machine.gfx[0] = gfx_element_alloc(machine, &charlayout, state->m_chargen, 8, 0);
122   machine.gfx[0] = auto_alloc(machine, gfx_element(machine, charlayout, state->m_chargen, 8, 0));
123123
124124   state->m_tx_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan, 8, 8, 32, 32);
125125   state->m_tx_tilemap->set_scrolldx(0, 116);
trunk/src/mame/drivers/mediagx.c
r17669r17670
236236   }
237237}
238238
239static void draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, const gfx_element *gfx, int ch, int att, int x, int y)
239static void draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y)
240240{
241241   int i,j;
242242   const UINT8 *dp;
243243   int index = 0;
244244   const pen_t *pens = gfx->machine().pens;
245245
246   dp = gfx_element_get_data(gfx, ch);
246   dp = gfx->get_data(ch);
247247
248248   for (j=y; j < y+8; j++)
249249   {
r17669r17670
252252      {
253253         UINT8 pen = dp[index++];
254254         if (pen)
255            p[i] = pens[gfx->color_base + (att & 0xf)];
255            p[i] = pens[gfx->colorbase() + (att & 0xf)];
256256         else
257257         {
258258            if (((att >> 4) & 7) > 0)
259               p[i] = pens[gfx->color_base + ((att >> 4) & 0x7)];
259               p[i] = pens[gfx->colorbase() + ((att >> 4) & 0x7)];
260260         }
261261      }
262262   }
r17669r17670
357357{
358358   mediagx_state *state = machine.driver_data<mediagx_state>();
359359   int i, j;
360   const gfx_element *gfx = machine.gfx[0];
360   gfx_element *gfx = machine.gfx[0];
361361   UINT32 *cga = state->m_cga_ram;
362362   int index = 0;
363363
trunk/src/mame/drivers/summit.c
r17669r17670
4040static SCREEN_UPDATE_IND16(summit)
4141{
4242   summit_state *state = screen.machine().driver_data<summit_state>();
43   const gfx_element *gfx = screen.machine().gfx[0];
43   gfx_element *gfx = screen.machine().gfx[0];
4444   int count = 0x0000;
4545
4646   int y,x;
trunk/src/mame/drivers/mwarr.c
r17669r17670
412412   mwarr_state *state = machine.driver_data<mwarr_state>();
413413   const UINT16 *source = state->m_sprites_buffer + 0x800 - 4;
414414   const UINT16 *finish = state->m_sprites_buffer;
415   const gfx_element *gfx = machine.gfx[0];
415   gfx_element *gfx = machine.gfx[0];
416416   int x, y, color, flipx, dy, pri, pri_mask, i;
417417
418418   while (source >= finish)
trunk/src/mame/drivers/coinmvga.c
r17669r17670
250250static SCREEN_UPDATE_IND16( coinmvga )
251251{
252252   coinmvga_state *state = screen.machine().driver_data<coinmvga_state>();
253   const gfx_element *gfx = screen.machine().gfx[0];
253   gfx_element *gfx = screen.machine().gfx[0];
254254   int count = 0x04000/2;
255255
256256   int y,x;
trunk/src/mame/drivers/fastfred.c
r17669r17670
127127static MACHINE_START( imago )
128128{
129129   fastfred_state *state = machine.driver_data<fastfred_state>();
130   gfx_element_set_source(machine.gfx[1], state->m_imago_sprites);
130   machine.gfx[1]->set_source(state->m_imago_sprites);
131131}
132132
133133WRITE8_MEMBER(fastfred_state::imago_dma_irq_w)
r17669r17670
154154   sprites_data = rom[m_imago_sprites_address + 0x2000*2 + m_imago_sprites_bank * 0x1000];
155155   m_imago_sprites[offset + 0x800*2] = sprites_data;
156156
157   gfx_element_mark_dirty(machine().gfx[1], offset/32);
157   machine().gfx[1]->mark_dirty(offset/32);
158158}
159159
160160READ8_MEMBER(fastfred_state::imago_sprites_offset_r)
trunk/src/mame/drivers/cybertnk.c
r17669r17670
289289{
290290   cybertnk_state *state = screen.machine().driver_data<cybertnk_state>();
291291   int i;
292   const gfx_element *gfx = screen.machine().gfx[3];
292   gfx_element *gfx = screen.machine().gfx[3];
293293
294294
295295   for (i=0;i<0x1000/4;i+=4)
trunk/src/mame/drivers/pinkiri8.c
r17669r17670
204204{
205205   pinkiri8_state *state = screen.machine().driver_data<pinkiri8_state>();
206206   int col_bank;
207   const gfx_element *gfx = screen.machine().gfx[0];
207   gfx_element *gfx = screen.machine().gfx[0];
208208
209209   /* update palette */
210210   for (int pen = 0; pen < 0x800 ; pen++)
trunk/src/mame/drivers/chsuper.c
r17669r17670
5959
6060UINT32 chsuper_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
6161{
62   const gfx_element *gfx = machine().gfx[0];
62   gfx_element *gfx = machine().gfx[0];
6363   int count = 0x0000;
6464   int y,x;
6565
trunk/src/mame/drivers/igs017.c
r17669r17670
314314{
315315   igs017_state *state = machine.driver_data<igs017_state>();
316316   // prepare GfxElement on the fly
317   gfx_element gfx(machine);
318317
319318   // Bounds checking
320319   if ( addr + dimx * dimy >= state->m_sprites_gfx_size )
321320      return;
322321
323   gfx_element_build_temporary(&gfx, machine, state->m_sprites_gfx + addr, dimx, dimy, dimx, 0x100, 32, 0);
322   gfx_element gfx(machine, state->m_sprites_gfx + addr, dimx, dimy, dimx, 0x100, 32);
324323
325324   drawgfx_transpen(   bitmap,cliprect, &gfx,
326325            0, color,
trunk/src/mame/drivers/amaticmg.c
r17669r17670
461461static SCREEN_UPDATE_IND16( amaticmg )
462462{
463463   amaticmg_state *state = screen.machine().driver_data<amaticmg_state>();
464   const gfx_element *gfx = screen.machine().gfx[0];
464   gfx_element *gfx = screen.machine().gfx[0];
465465   int y,x;
466466   int count = 0;
467467
r17669r17670
487487static SCREEN_UPDATE_IND16( amaticmg2 )
488488{
489489   amaticmg_state *state = screen.machine().driver_data<amaticmg_state>();
490   const gfx_element *gfx = screen.machine().gfx[0];
490   gfx_element *gfx = screen.machine().gfx[0];
491491   int y,x;
492492   int count = 16;
493493
trunk/src/mame/drivers/avt.c
r17669r17670
508508   avt_state *state = screen.machine().driver_data<avt_state>();
509509   int x,y;
510510   int count;
511   const gfx_element *gfx = screen.machine().gfx[0];
511   gfx_element *gfx = screen.machine().gfx[0];
512512
513513   count = 0;
514514
trunk/src/mame/drivers/pgm.c
r17669r17670
36023602
36033603   glcopy.total = (gfx2_size_needed / glcopy.charincrement)*8;
36043604
3605   machine.gfx[1] = gfx_element_alloc(machine, &glcopy, (UINT8 *)dst, 32, 0x400);
3605   machine.gfx[1] = auto_alloc(machine, gfx_element(machine, glcopy, (UINT8 *)dst, 32, 0x400));
36063606
36073607
36083608}
trunk/src/mame/drivers/sub.c
r17669r17670
140140static SCREEN_UPDATE_IND16(sub)
141141{
142142   sub_state *state = screen.machine().driver_data<sub_state>();
143   const gfx_element *gfx = screen.machine().gfx[0];
144   const gfx_element *gfx_1 = screen.machine().gfx[1];
143   gfx_element *gfx = screen.machine().gfx[0];
144   gfx_element *gfx_1 = screen.machine().gfx[1];
145145   int y,x;
146146   int count = 0;
147147
trunk/src/mame/drivers/mpoker.c
r17669r17670
208208   mpoker_state *state = screen.machine().driver_data<mpoker_state>();
209209   int y,x;
210210   int count;
211   const gfx_element *gfx = screen.machine().gfx[0];
211   gfx_element *gfx = screen.machine().gfx[0];
212212
213213   count = 0;
214214   for (y=0;y<32;y++)
trunk/src/mame/drivers/dmndrby.c
r17669r17670
349349   dmndrby_state *state = screen.machine().driver_data<dmndrby_state>();
350350   int x,y,count;
351351   int off,scrolly;
352   const gfx_element *gfx = screen.machine().gfx[0];
353   const gfx_element *sprites = screen.machine().gfx[1];
354   const gfx_element *track = screen.machine().gfx[2];
352   gfx_element *gfx = screen.machine().gfx[0];
353   gfx_element *sprites = screen.machine().gfx[1];
354   gfx_element *track = screen.machine().gfx[2];
355355
356356   bitmap.fill(get_black_pen(screen.machine()), cliprect);
357357
trunk/src/mame/drivers/cmmb.c
r17669r17670
7676{
7777   cmmb_state *state = screen.machine().driver_data<cmmb_state>();
7878   UINT8 *videoram = state->m_videoram;
79   const gfx_element *gfx = screen.machine().gfx[0];
79   gfx_element *gfx = screen.machine().gfx[0];
8080   int count = 0x00000;
8181
8282   int y,x;
r17669r17670
113113   offset&=0xfff;
114114
115115   /* dirty char */
116   gfx_element_mark_dirty(machine().gfx[0], offset >> 4);
117    gfx_element_mark_dirty(machine().gfx[1], offset >> 5);
116   machine().gfx[0]->mark_dirty(offset >> 4);
117    machine().gfx[1]->mark_dirty(offset >> 5);
118118}
119119
120120
trunk/src/mame/drivers/rgum.c
r17669r17670
4242{
4343   rgum_state *state = screen.machine().driver_data<rgum_state>();
4444   int x,y,count;
45   const gfx_element *gfx = screen.machine().gfx[0];
45   gfx_element *gfx = screen.machine().gfx[0];
4646
4747   count = 0;
4848
trunk/src/mame/drivers/namcos23.c
r17669r17670
14631463WRITE32_MEMBER(namcos23_state::s23_txtchar_w)
14641464{
14651465   COMBINE_DATA(&m_charram[offset]);
1466   gfx_element_mark_dirty(machine().gfx[0], offset/32);
1466   machine().gfx[0]->mark_dirty(offset/32);
14671467}
14681468
14691469static UINT8 nthbyte( const UINT32 *pSource, int offs )
r17669r17670
23982398static VIDEO_START( ss23 )
23992399{
24002400   namcos23_state *state = machine.driver_data<namcos23_state>();
2401   gfx_element_set_source(machine.gfx[0], reinterpret_cast<UINT8 *>(state->m_charram.target()));
2401   machine.gfx[0]->set_source(reinterpret_cast<UINT8 *>(state->m_charram.target()));
24022402   state->m_bgtilemap = tilemap_create(machine, TextTilemapGetInfo, TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
24032403   state->m_bgtilemap->set_transparent_pen(0xf);
24042404
r17669r17670
24242424   render_run( screen.machine(), bitmap );
24252425
24262426   gfx_element *gfx = screen.machine().gfx[0];
2427   memset(gfx->dirty, 1, gfx->total_elements);
2427   gfx->mark_all_dirty();
24282428
24292429   state->m_bgtilemap->draw(bitmap, cliprect, 0/*flags*/, 0/*priority*/ ); /* opaque */
24302430   return 0;
trunk/src/mame/drivers/liberate.c
r17669r17670
157157   offset &= 0x7ff;
158158
159159   /* dirty char */
160   gfx_element_mark_dirty(machine().gfx[0], offset >> 3);
161//  gfx_element_mark_dirty(machine().gfx[0], (offset | 0x1800) >> 3);
160   machine().gfx[0]->mark_dirty(offset >> 3);
161//  machine().gfx[0]->mark_dirty((offset | 0x1800) >> 3);
162162}
163163
164164WRITE8_MEMBER(liberate_state::prosoccr_char_bank_w)
r17669r17670
223223   offset &= 0x7ff;
224224
225225   /* dirty char */
226   gfx_element_mark_dirty(machine().gfx[3], (offset + 0x800) >> 3);
227   gfx_element_mark_dirty(machine().gfx[3 + 4], (offset + 0x800) >> 5);
226   machine().gfx[3]->mark_dirty((offset + 0x800) >> 3);
227   machine().gfx[3 + 4]->mark_dirty((offset + 0x800) >> 5);
228228}
229229
230230
trunk/src/mame/drivers/vamphalf.c
r17669r17670
588588static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap)
589589{
590590   vamphalf_state *state = screen.machine().driver_data<vamphalf_state>();
591   const gfx_element *gfx = screen.machine().gfx[0];
591   gfx_element *gfx = screen.machine().gfx[0];
592592   UINT32 cnt;
593593   int block, offs;
594594   int code,color,x,y,fx,fy;
r17669r17670
674674static void draw_sprites_aoh(screen_device &screen, bitmap_ind16 &bitmap)
675675{
676676   vamphalf_state *state = screen.machine().driver_data<vamphalf_state>();
677   const gfx_element *gfx = screen.machine().gfx[0];
677   gfx_element *gfx = screen.machine().gfx[0];
678678   UINT32 cnt;
679679   int block, offs;
680680   int code,color,x,y,fx,fy;
trunk/src/mame/drivers/bnstars.c
r17669r17670
486486      else
487487         pri_mask = 0xfe;
488488
489      gfx_element_set_source_clip(gfx, tx, xsize, ty, ysize);
489      gfx->set_source_clip(tx, xsize, ty, ysize);
490490      pdrawgfxzoom_transpen(bitmap, cliprect, gfx,
491491            code,
492492            color,
r17669r17670
14881488   decrypt_ms32_tx(machine(), 0x00020,0x7e, "gfx7");
14891489   decrypt_ms32_bg(machine(), 0x00001,0x9b, "gfx6");
14901490
1491   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
1491   membank("bank1")->set_base(memregion("maincpu")->base());
14921492}
14931493
14941494GAME( 1997, bnstars1, 0,        bnstars, bnstars, bnstars_state, bnstars, ROT0,   "Jaleco", "Vs. Janshi Brandnew Stars", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND )
trunk/src/mame/drivers/buster.c
r17669r17670
3131static SCREEN_UPDATE_IND16(buster)
3232{
3333   buster_state *state = screen.machine().driver_data<buster_state>();
34   const gfx_element *gfx = screen.machine().gfx[0];
34   gfx_element *gfx = screen.machine().gfx[0];
3535   int count = 0x0000;
3636
3737   int y,x;
trunk/src/mame/drivers/mastboy.c
r17669r17670
484484static VIDEO_START(mastboy)
485485{
486486   mastboy_state *state = machine.driver_data<mastboy_state>();
487   gfx_element_set_source(machine.gfx[0], state->m_vram);
487   machine.gfx[0]->set_source(state->m_vram);
488488}
489489
490490static SCREEN_UPDATE_IND16(mastboy)
r17669r17670
589589         m_vram[offs] = data^0xff;
590590
591591         /* Decode the new tile */
592         gfx_element_mark_dirty(machine().gfx[0], offs/32);
592         machine().gfx[0]->mark_dirty(offs/32);
593593      }
594594   }
595595   else
trunk/src/mame/drivers/jclub2.c
r17669r17670
229229   state->m_tmap->set_transparent_pen(0);
230230   state->m_tmap2->set_transparent_pen(0);
231231
232   machine.gfx[0]->color_granularity = 64; /* 256 colour sprites with palette selectable on 64 colour boundaries */
232   machine.gfx[0]->set_granularity(64); /* 256 colour sprites with palette selectable on 64 colour boundaries */
233233}
234234
235235static SCREEN_UPDATE_IND16( darkhors )
trunk/src/mame/drivers/aristmk4.c
r17669r17670
324324static VIDEO_START(aristmk4)
325325{
326326   int tile;
327   for (tile = 0; tile < machine.gfx[0]->total_elements; tile++)
327   for (tile = 0; tile < machine.gfx[0]->elements(); tile++)
328328   {
329      gfx_element_decode(machine.gfx[0], tile);
329      machine.gfx[0]->decode(tile);
330330   }
331331}
332332
r17669r17670
368368static SCREEN_UPDATE_IND16(aristmk4)
369369{
370370   aristmk4_state *state = screen.machine().driver_data<aristmk4_state>();
371   const gfx_element *gfx = screen.machine().gfx[0];
371   gfx_element *gfx = screen.machine().gfx[0];
372372   int x,y;
373373   int count = 0;
374374   int color;
r17669r17670
385385         tile = (state->m_mkiv_vram[count+1]|state->m_mkiv_vram[count]<<8) & 0x3ff;
386386         bgtile = (state->m_mkiv_vram[count+1]|state->m_mkiv_vram[count]<<8) & 0xff; // first 256 tiles
387387         uBackgroundColour(screen.machine());   // read sw7
388         gfx_element_decode(gfx, bgtile);   // force the machine to update only the first 256 tiles.
388         gfx->decode(bgtile);   // force the machine to update only the first 256 tiles.
389389                        // as we only update the background, not the entire display.
390390         flipx = ((state->m_mkiv_vram[count]) & 0x04);
391391         flipy = ((state->m_mkiv_vram[count]) & 0x08);
trunk/src/mame/drivers/murogmbl.c
r17669r17670
9595static SCREEN_UPDATE_IND16(murogmbl)
9696{
9797   murogmbl_state *state = screen.machine().driver_data<murogmbl_state>();
98   const gfx_element *gfx = screen.machine().gfx[0];
98   gfx_element *gfx = screen.machine().gfx[0];
9999   int count = 0;
100100
101101   int y, x;
trunk/src/mame/drivers/bmcpokr.c
r17669r17670
200200SCREEN_UPDATE_IND16( bmcpokr )
201201{
202202   bmcpokr_state *state = screen.machine().driver_data<bmcpokr_state>();
203   const gfx_element *gfx = screen.machine().gfx[0];
203   gfx_element *gfx = screen.machine().gfx[0];
204204
205205   int count = 0;
206206   for (int y=0;y<32;y++)
trunk/src/mame/drivers/1945kiii.c
r17669r17670
9999static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
100100{
101101   k3_state *state = machine.driver_data<k3_state>();
102   const gfx_element *gfx = machine.gfx[0];
102   gfx_element *gfx = machine.gfx[0];
103103   UINT16 *source = state->m_spriteram_1;
104104   UINT16 *source2 = state->m_spriteram_2;
105105   UINT16 *finish = source + 0x1000 / 2;
trunk/src/mame/drivers/namcoic.c
r17669r17670
273273/**************************************************************************************/
274274
275275void namcos2_shared_state::zdrawgfxzoom(
276      bitmap_ind16 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
276      bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
277277      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
278278      int scalex, int scaley, int zpos )
279279{
r17669r17670
283283      if( gfx )
284284      {
285285         int shadow_offset = (gfx->machine().config().m_video_attributes&VIDEO_HAS_SHADOWS)?gfx->machine().total_colors():0;
286         const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
287         const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
288         int sprite_screen_height = (scaley*gfx->height+0x8000)>>16;
289         int sprite_screen_width = (scalex*gfx->width+0x8000)>>16;
286         const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
287         const UINT8 *source_base = gfx->get_data(code % gfx->elements());
288         int sprite_screen_height = (scaley*gfx->height()+0x8000)>>16;
289         int sprite_screen_width = (scalex*gfx->width()+0x8000)>>16;
290290         if (sprite_screen_width && sprite_screen_height)
291291         {
292292            /* compute sprite increment per screen pixel */
293            int dx = (gfx->width<<16)/sprite_screen_width;
294            int dy = (gfx->height<<16)/sprite_screen_height;
293            int dx = (gfx->width()<<16)/sprite_screen_width;
294            int dy = (gfx->height()<<16)/sprite_screen_height;
295295
296296            int ex = sx+sprite_screen_width;
297297            int ey = sy+sprite_screen_height;
r17669r17670
350350               {
351351                  for( y=sy; y<ey; y++ )
352352                  {
353                     const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
353                     const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
354354                     UINT16 *dest = &dest_bmp.pix16(y);
355355                     UINT8 *pri = &priority_bitmap.pix8(y);
356356                     int x, x_index = x_index_base;
r17669r17670
415415} /* zdrawgfxzoom */
416416
417417void namcos2_shared_state::zdrawgfxzoom(
418      bitmap_rgb32 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
418      bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
419419      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
420420      int scalex, int scaley, int zpos )
421421{
r17669r17670
482482               gfx_element *gfx = machine().gfx[rgn];
483483
484484               if( (word0&0x0200)==0 )
485                  gfx_element_set_source_clip(gfx, (word1&0x0001) ? 16 : 0, 16, (word1&0x0002) ? 16 : 0, 16);
485                  gfx->set_source_clip((word1&0x0001) ? 16 : 0, 16, (word1&0x0002) ? 16 : 0, 16);
486486               else
487                  gfx_element_set_source_clip(gfx, 0, 32, 0, 32);
487                  gfx->set_source_clip(0, 32, 0, 32);
488488
489489               zdrawgfxzoom(
490490                  bitmap,
r17669r17670
13441344   else
13451345   {
13461346      offset -= 0x10000/2;
1347      gfx_element_mark_dirty(m_gfx, offset / WORDS_PER_ROAD_TILE);
1347      m_gfx->mark_dirty(offset / WORDS_PER_ROAD_TILE);
13481348   }
13491349}
13501350
r17669r17670
14451445void namco_c45_road_device::device_start()
14461446{
14471447   // create a gfx_element describing the road graphics
1448   m_gfx = gfx_element_alloc(machine(), &s_tile_layout, 0x10000 + (UINT8 *)&m_ram[0], 0x3f, 0xf00);
1448   m_gfx = auto_alloc(machine(), gfx_element(machine(), s_tile_layout, 0x10000 + (UINT8 *)&m_ram[0], 0x3f, 0xf00));
14491449
14501450   // create a tilemap for the road
14511451   m_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(namco_c45_road_device::get_road_info), this),
r17669r17670
14591459
14601460void namco_c45_road_device::device_stop()
14611461{
1462   gfx_element_free(m_gfx);
1462   auto_free(machine(), m_gfx);
14631463}
14641464
14651465
trunk/src/mame/drivers/taito_l.c
r17669r17670
175175   state->m_cur_rombank = state->m_cur_rombank2 = 0;
176176   state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base());
177177
178   gfx_element_set_source(machine.gfx[2], state->m_rambanks);
178   machine.gfx[2]->set_source(state->m_rambanks);
179179
180180   state->m_adpcm_pos = 0;
181181   state->m_adpcm_data = -1;
trunk/src/mame/drivers/srmp5.c
r17669r17670
212212      {
213213         if (state->m_tileduty[i] == 1)
214214         {
215            gfx_element_decode(screen.machine().gfx[0], i);
215            screen.machine().gfx[0]->decode(i);
216216            state->m_tileduty[i] = 0;
217217         }
218218      }
trunk/src/mame/drivers/cyclemb.c
r17669r17670
156156static void cyclemb_draw_tilemap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
157157{
158158   cyclemb_state *state = screen.machine().driver_data<cyclemb_state>();
159   const gfx_element *gfx = screen.machine().gfx[0];
159   gfx_element *gfx = screen.machine().gfx[0];
160160   int x,y,count;
161161   UINT8 flip_screen = state->flip_screen();
162162
r17669r17670
257257static void skydest_draw_tilemap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
258258{
259259   cyclemb_state *state = screen.machine().driver_data<cyclemb_state>();
260   const gfx_element *gfx = screen.machine().gfx[0];
260   gfx_element *gfx = screen.machine().gfx[0];
261261   int x,y;
262262   //UINT8 flip_screen = state->flip_screen();
263263
trunk/src/mame/drivers/mpu4vid.c
r17669r17670
532532   mpu4vid_state *state = space->machine().driver_data<mpu4vid_state>();
533533   COMBINE_DATA(&state->m_vid_vidram[offset]);
534534   offset <<= 1;
535   gfx_element_mark_dirty(space->machine().gfx[state->m_gfx_index+0], offset/0x20);
536   gfx_element_mark_dirty(space->machine().gfx[state->m_gfx_index+1], offset/0x20);
537   gfx_element_mark_dirty(space->machine().gfx[state->m_gfx_index+2], offset/0x20);
538   gfx_element_mark_dirty(space->machine().gfx[state->m_gfx_index+3], offset/0x20);
535   space->machine().gfx[state->m_gfx_index+0]->mark_dirty(offset/0x20);
536   space->machine().gfx[state->m_gfx_index+1]->mark_dirty(offset/0x20);
537   space->machine().gfx[state->m_gfx_index+2]->mark_dirty(offset/0x20);
538   space->machine().gfx[state->m_gfx_index+3]->mark_dirty(offset/0x20);
539539}
540540
541541
r17669r17670
557557   assert(state->m_gfx_index != MAX_GFX_ELEMENTS);
558558
559559   /* create the char set (gfx will then be updated dynamically from RAM) */
560   machine.gfx[state->m_gfx_index+0] = gfx_element_alloc(machine, &mpu4_vid_char_8x8_layout, reinterpret_cast<UINT8 *>(state->m_vid_vidram.target()), machine.total_colors() / 16, 0);
561   machine.gfx[state->m_gfx_index+1] = gfx_element_alloc(machine, &mpu4_vid_char_8x16_layout, reinterpret_cast<UINT8 *>(state->m_vid_vidram.target()), machine.total_colors() / 16, 0);
562   machine.gfx[state->m_gfx_index+2] = gfx_element_alloc(machine, &mpu4_vid_char_16x8_layout, reinterpret_cast<UINT8 *>(state->m_vid_vidram.target()), machine.total_colors() / 16, 0);
563   machine.gfx[state->m_gfx_index+3] = gfx_element_alloc(machine, &mpu4_vid_char_16x16_layout, reinterpret_cast<UINT8 *>(state->m_vid_vidram.target()), machine.total_colors() / 16, 0);
560   machine.gfx[state->m_gfx_index+0] = auto_alloc(machine, gfx_element(machine, mpu4_vid_char_8x8_layout, reinterpret_cast<UINT8 *>(state->m_vid_vidram.target()), machine.total_colors() / 16, 0));
561   machine.gfx[state->m_gfx_index+1] = auto_alloc(machine, gfx_element(machine, mpu4_vid_char_8x16_layout, reinterpret_cast<UINT8 *>(state->m_vid_vidram.target()), machine.total_colors() / 16, 0));
562   machine.gfx[state->m_gfx_index+2] = auto_alloc(machine, gfx_element(machine, mpu4_vid_char_16x8_layout, reinterpret_cast<UINT8 *>(state->m_vid_vidram.target()), machine.total_colors() / 16, 0));
563   machine.gfx[state->m_gfx_index+3] = auto_alloc(machine, gfx_element(machine, mpu4_vid_char_16x16_layout, reinterpret_cast<UINT8 *>(state->m_vid_vidram.target()), machine.total_colors() / 16, 0));
564564
565565   state->m_scn2674->init_stuff();
566566
trunk/src/mame/drivers/trvmadns.c
r17669r17670
161161WRITE8_MEMBER(trvmadns_state::trvmadns_gfxram_w)
162162{
163163   m_gfxram[offset] = data;
164   gfx_element_mark_dirty(machine().gfx[0], offset/16);
164   machine().gfx[0]->mark_dirty(offset/16);
165165}
166166
167167WRITE8_MEMBER(trvmadns_state::trvmadns_palette_w)
r17669r17670
287287
288288//  fg_tilemap->set_transparent_pen(1);
289289
290   gfx_element_set_source(machine.gfx[0], state->m_gfxram);
290   machine.gfx[0]->set_source(state->m_gfxram);
291291}
292292
293293static SCREEN_UPDATE_IND16( trvmadns )
294294{
295295   trvmadns_state *state = screen.machine().driver_data<trvmadns_state>();
296296   int x,y,count;
297   const gfx_element *gfx = screen.machine().gfx[0];
297   gfx_element *gfx = screen.machine().gfx[0];
298298
299299   bitmap.fill(0xd, cliprect);
300300
trunk/src/mame/drivers/segas18.c
r17669r17670
396396   // tile banking
397397   if (offset < 8)
398398   {
399      int maxbanks = machine().gfx[0]->total_elements / 1024;
399      int maxbanks = machine().gfx[0]->elements() / 1024;
400400      if (data >= maxbanks)
401401         data %= maxbanks;
402402      segaic16_tilemap_set_bank(machine(), 0, offset, data);
trunk/src/mame/drivers/coolridr.c
r17669r17670
334334{
335335   coolridr_state *state = screen.machine().driver_data<coolridr_state>();
336336   /* planes seems to basically be at 0x8000 and 0x28000... */
337   const gfx_element *gfx = screen.machine().gfx[2];
337   gfx_element *gfx = screen.machine().gfx[2];
338338   UINT32 count;
339339   int y,x;
340340
r17669r17670
691691      gfx[offset*4+2] = (m_h1_charram[offset] & 0x0000ff00) >> 8;
692692      gfx[offset*4+3] = (m_h1_charram[offset] & 0x000000ff) >> 0;
693693
694      gfx_element_mark_dirty(machine().gfx[2], offset/64); //*4/256
694      machine().gfx[2]->mark_dirty(offset/64); //*4/256
695695   }
696696}
697697
trunk/src/mame/drivers/tmmjprd.c
r17669r17670
9595{
9696   tmmjprd_state *state = machine.driver_data<tmmjprd_state>();
9797   int xpos,ypos,tileno,xflip,yflip, colr;
98   const gfx_element *gfx = machine.gfx[0];
98   gfx_element *gfx = machine.gfx[0];
9999   int xoffs;
100100   //  int todraw = (state->m_spriteregs[5]&0x0fff0000)>>16; // how many sprites to draw (start/end reg..) what is the other half?
101101
trunk/src/mame/drivers/suprnova.c
r17669r17670
669669
670670   COMBINE_DATA(&m_v3t_ram[offset]);
671671
672   gfx_element_mark_dirty(machine().gfx[1], offset/0x40);
673   gfx_element_mark_dirty(machine().gfx[3], offset/0x20);
672   machine().gfx[1]->mark_dirty(offset/0x40);
673   machine().gfx[3]->mark_dirty(offset/0x20);
674674
675675   data = m_v3t_ram[offset];
676676// i think we need to swap around to decode .. endian issues?
trunk/src/mame/drivers/acefruit.c
r17669r17670
118118            int x;
119119            static const int spriteskip[] = { 1, 2, 4 };
120120            int spritesize = spriteskip[ color - 5 ];
121            const gfx_element *gfx = screen.machine().gfx[ 0 ];
121            gfx_element *gfx = screen.machine().gfx[ 0 ];
122122
123123            for( x = 0; x < 16; x++ )
124124            {
125125               int sprite = ( state->m_spriteram[ ( spriteindex / 64 ) % 6 ] & 0xf ) ^ 0xf;
126               const UINT8 *gfxdata = gfx_element_get_data(gfx, sprite);
126               const UINT8 *gfxdata = gfx->get_data(sprite);
127127
128128               for( y = 0; y < 8; y++ )
129129               {
130130                  UINT16 *dst = &bitmap.pix16(y + ( row * 8 ), x + ( col * 16 ) );
131                  *( dst ) = *( gfxdata + ( ( spriterow + y ) * gfx->line_modulo ) + ( ( spriteindex % 64 ) >> 1 ) );
131                  *( dst ) = *( gfxdata + ( ( spriterow + y ) * gfx->rowbytes() ) + ( ( spriteindex % 64 ) >> 1 ) );
132132               }
133133
134134               spriteindex += spritesize;
trunk/src/mame/drivers/limenko.c
r17669r17670
319319   SET_TILE_INFO(0,tile,color,0);
320320}
321321
322static void draw_single_sprite(bitmap_ind16 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
322static void draw_single_sprite(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
323323      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
324324      int priority)
325325{
326326   limenko_state *state = gfx->machine().driver_data<limenko_state>();
327   int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
328   const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
327   int pal_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors());
328   const UINT8 *source_base = gfx->get_data(code % gfx->elements());
329329
330   int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16;
331   int sprite_screen_width = ((1<<16)*gfx->width+0x8000)>>16;
330   int sprite_screen_height = ((1<<16)*gfx->height()+0x8000)>>16;
331   int sprite_screen_width = ((1<<16)*gfx->width()+0x8000)>>16;
332332
333333   if (sprite_screen_width && sprite_screen_height)
334334   {
335335      /* compute sprite increment per screen pixel */
336      int dx = (gfx->width<<16)/sprite_screen_width;
337      int dy = (gfx->height<<16)/sprite_screen_height;
336      int dx = (gfx->width()<<16)/sprite_screen_width;
337      int dy = (gfx->height()<<16)/sprite_screen_height;
338338
339339      int ex = sx+sprite_screen_width;
340340      int ey = sy+sprite_screen_height;
r17669r17670
392392
393393         for( y=sy; y<ey; y++ )
394394         {
395            const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
395            const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
396396            UINT16 *dest = &dest_bmp.pix16(y);
397397            UINT8 *pri = &state->m_sprites_bitmap_pri.pix8(y);
398398
r17669r17670
428428   UINT8 *gfx_max   = base_gfx + state->memregion("gfx1")->bytes();
429429
430430   UINT8 *gfxdata;
431   gfx_element gfx(machine);
432431
433432   for(i = 0; i <= count*2; i += 2)
434433   {
r17669r17670
463462         continue;
464463
465464      /* prepare GfxElement on the fly */
466      gfx_element_build_temporary(&gfx, machine, gfxdata, width, height, width, 0, 256, 0);
465      gfx_element gfx(machine, gfxdata, width, height, width, 0, 256);
467466
468467      draw_single_sprite(state->m_sprites_bitmap,cliprect,&gfx,0,color,flipx,flipy,x,y,pri);
469468
trunk/src/mame/drivers/poo.c
r17669r17670
7878   poo_state *state = screen.machine().driver_data<poo_state>();
7979   int y,x;
8080   int count;
81   const gfx_element *gfx = screen.machine().gfx[0];
81   gfx_element *gfx = screen.machine().gfx[0];
8282
8383   count = 0;
8484
trunk/src/mame/drivers/drtomy.c
r17669r17670
7878{
7979   drtomy_state *state = machine.driver_data<drtomy_state>();
8080   int i, x, y, ex, ey;
81   const gfx_element *gfx = machine.gfx[0];
81   gfx_element *gfx = machine.gfx[0];
8282
8383   static const int x_offset[2] = {0x0, 0x2};
8484   static const int y_offset[2] = {0x0, 0x1};
trunk/src/mame/drivers/galaxian.c
r17669r17670
29392939
29402940      for (x=0;x<0x200;x++)
29412941      {
2942         gfx_element_mark_dirty(machine.gfx[0], x);
2942         machine.gfx[0]->mark_dirty(x);
29432943      }
29442944
29452945      for (x=0;x<0x80;x++)
29462946      {
2947         gfx_element_mark_dirty(machine.gfx[1], x);
2947         machine.gfx[1]->mark_dirty(x);
29482948      }
29492949   }
29502950
trunk/src/mame/drivers/tasman.c
r17669r17670
5757{
5858   #if CUSTOM_DRAW
5959   kongambl_state *state = screen.machine().driver_data<kongambl_state>();
60   const gfx_element *gfx = screen.machine().gfx[0];
60   gfx_element *gfx = screen.machine().gfx[0];
6161   UINT32 count;
6262
6363   count = 0;
trunk/src/mame/drivers/raiden2.c
r17669r17670
629629{
630630   UINT16 *source = sprites + sprites_cur_start/2 - 4;
631631
632   const gfx_element *gfx = machine.gfx[2];
632   gfx_element *gfx = machine.gfx[2];
633633
634634//  static int ytlim = 1;
635635//  static int xtlim = 1;
trunk/src/mame/drivers/mogura.c
r17669r17670
8080static VIDEO_START( mogura )
8181{
8282   mogura_state *state = machine.driver_data<mogura_state>();
83   gfx_element_set_source(machine.gfx[0], state->m_gfxram);
83   machine.gfx[0]->set_source(state->m_gfxram);
8484   state->m_tilemap = tilemap_create(machine, get_mogura_tile_info, TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
8585}
8686
r17669r17670
120120{
121121   m_gfxram[offset] = data ;
122122
123   gfx_element_mark_dirty(machine().gfx[0], offset / 16);
123   machine().gfx[0]->mark_dirty(offset / 16);
124124}
125125
126126
trunk/src/mame/drivers/ddealer.c
r17669r17670
181181
182182static void ddealer_draw_video_layer( running_machine &machine, UINT16* vreg_base, UINT16* top, UINT16* bottom, bitmap_ind16 &bitmap, const rectangle &cliprect, int flipy)
183183{
184   const gfx_element *gfx = machine.gfx[1];
184   gfx_element *gfx = machine.gfx[1];
185185
186186   INT16 sx, sy;
187187   int x,y, count;
trunk/src/mame/drivers/vpoker.c
r17669r17670
136136{
137137   vpoker_state *state = screen.machine().driver_data<vpoker_state>();
138138   UINT8 *videoram = state->m_videoram;
139   const gfx_element *gfx = screen.machine().gfx[0];
139   gfx_element *gfx = screen.machine().gfx[0];
140140   int count = 0x0000;
141141
142142   int y,x;
trunk/src/mame/drivers/cps3.c
r17669r17670
410410
411411static void copy_from_nvram(running_machine &machine);
412412
413INLINE void cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle &clip,const gfx_element *gfx,
413INLINE void cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx,
414414      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
415415      int transparency,int transparent_color,
416416      int scalex, int scaley,bitmap_ind8 *pri_buffer,UINT32 pri_mask)
r17669r17670
447447   {
448448      if( gfx )
449449      {
450//          const pen_t *pal = &gfx->colortable[gfx->color_granularity * (color % gfx->total_colors)];
451         UINT32 palbase = (gfx->color_granularity * color) & 0x1ffff;
450//          const pen_t *pal = &gfx->colortable[gfx->granularity() * (color % gfx->colors())];
451         UINT32 palbase = (gfx->granularity() * color) & 0x1ffff;
452452         const pen_t *pal = &state->m_mame_colours[palbase];
453         const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
453         const UINT8 *source_base = gfx->get_data(code % gfx->elements());
454454
455         int sprite_screen_height = (scaley*gfx->height+0x8000)>>16;
456         int sprite_screen_width = (scalex*gfx->width+0x8000)>>16;
455         int sprite_screen_height = (scaley*gfx->height()+0x8000)>>16;
456         int sprite_screen_width = (scalex*gfx->width()+0x8000)>>16;
457457
458458         if (sprite_screen_width && sprite_screen_height)
459459         {
460460            /* compute sprite increment per screen pixel */
461            int dx = (gfx->width<<16)/sprite_screen_width;
462            int dy = (gfx->height<<16)/sprite_screen_height;
461            int dx = (gfx->width()<<16)/sprite_screen_width;
462            int dy = (gfx->height()<<16)/sprite_screen_height;
463463
464464            int ex = sx+sprite_screen_width;
465465            int ey = sy+sprite_screen_height;
r17669r17670
520520                  {
521521                     for( y=sy; y<ey; y++ )
522522                     {
523                        const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
523                        const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
524524                        UINT32 *dest = &dest_bmp.pix32(y);
525525
526526                        int x, x_index = x_index_base;
r17669r17670
539539                  {
540540                     for( y=sy; y<ey; y++ )
541541                     {
542                        const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
542                        const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
543543                        UINT32 *dest = &dest_bmp.pix32(y);
544544
545545                        int x, x_index = x_index_base;
r17669r17670
559559                  {
560560                     for( y=sy; y<ey; y++ )
561561                     {
562                        const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
562                        const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
563563                        UINT32 *dest = &dest_bmp.pix32(y);
564564
565565                        int x, x_index = x_index_base;
r17669r17670
579579                  {
580580                     for( y=sy; y<ey; y++ )
581581                     {
582                        const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
582                        const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
583583                        UINT32 *dest = &dest_bmp.pix32(y);
584584
585585                        int x, x_index = x_index_base;
r17669r17670
589589                           if( c != transparent_color )
590590                           {
591591                              /* blending isn't 100% understood */
592                              if (gfx->color_granularity == 64)
592                              if (gfx->granularity() == 64)
593593                              {
594594                                 // OK for sfiii2 spotlight
595595                                 if (c&0x01) dest[x] |= 0x2000;
r17669r17670
827827   state_save_register_global_pointer(machine, state->m_char_ram, 0x800000 /4);
828828
829829   /* create the char set (gfx will then be updated dynamically from RAM) */
830   machine.gfx[0] = gfx_element_alloc(machine, &cps3_tiles8x8_layout, (UINT8 *)state->m_ss_ram, machine.total_colors() / 16, 0);
830   machine.gfx[0] = auto_alloc(machine, gfx_element(machine, cps3_tiles8x8_layout, (UINT8 *)state->m_ss_ram, machine.total_colors() / 16, 0));
831831
832832   //decode_ssram();
833833
834834   /* create the char set (gfx will then be updated dynamically from RAM) */
835   machine.gfx[1] = gfx_element_alloc(machine, &cps3_tiles16x16_layout, (UINT8 *)state->m_char_ram, machine.total_colors() / 64, 0);
836   machine.gfx[1]->color_granularity = 64;
835   machine.gfx[1] = auto_alloc(machine, gfx_element(machine, cps3_tiles16x16_layout, (UINT8 *)state->m_char_ram, machine.total_colors() / 64, 0));
836   machine.gfx[1]->set_granularity(64);
837837
838838   //decode_charram();
839839
r17669r17670
926926         yflip  = (dat & 0x00000800)>>11;
927927         xflip  = (dat & 0x00001000)>>12;
928928
929         if (!bpp) machine.gfx[1]->color_granularity=256;
930         else machine.gfx[1]->color_granularity=64;
929         if (!bpp) machine.gfx[1]->set_granularity(256);
930         else machine.gfx[1]->set_granularity(64);
931931
932932         cps3_drawgfxzoom(bitmap,clip,machine.gfx[1],tileno,colour,xflip,yflip,(x*16)-scrollx%16,drawline-tilesubline,CPS3_TRANSPARENCY_PEN_INDEX,0, 0x10000, 0x10000, NULL, 0);
933933      }
r17669r17670
11571157                        /* use the bpp value from the main list or the sublists? */
11581158                        if (whichbpp)
11591159                        {
1160                           if (!global_bpp) screen.machine().gfx[1]->color_granularity=256;
1161                           else screen.machine().gfx[1]->color_granularity=64;
1160                           if (!global_bpp) screen.machine().gfx[1]->set_granularity(256);
1161                           else screen.machine().gfx[1]->set_granularity(64);
11621162                        }
11631163                        else
11641164                        {
1165                           if (!bpp) screen.machine().gfx[1]->color_granularity=256;
1166                           else screen.machine().gfx[1]->color_granularity=64;
1165                           if (!bpp) screen.machine().gfx[1]->set_granularity(256);
1166                           else screen.machine().gfx[1]->set_granularity(64);
11671167                        }
11681168
11691169                        {
r17669r17670
12641264      // we only want to endian-flip the character data, the tilemap info is fine
12651265      data = LITTLE_ENDIANIZE_INT32(data);
12661266      mem_mask = LITTLE_ENDIANIZE_INT32(mem_mask);
1267      gfx_element_mark_dirty(machine().gfx[0], offset/16);
1267      machine().gfx[0]->mark_dirty(offset/16);
12681268   }
12691269
12701270   COMBINE_DATA(&m_ss_ram[offset]);
r17669r17670
13561356   mem_mask = LITTLE_ENDIANIZE_INT32(mem_mask);
13571357   data = LITTLE_ENDIANIZE_INT32(data);
13581358   COMBINE_DATA(&m_char_ram[fulloffset]);
1359   gfx_element_mark_dirty(machine().gfx[1], fulloffset/0x40);
1359   machine().gfx[1]->mark_dirty(fulloffset/0x40);
13601360}
13611361
13621362/* FLASH ROM ACCESS */
r17669r17670
18221822      while (state->m_rle_length)
18231823      {
18241824         dest[((destination+tranfercount)&0x7fffff)^3] = (state->m_last_normal_byte&0x3f);
1825         gfx_element_mark_dirty(machine.gfx[1], ((destination+tranfercount)&0x7fffff)/0x100);
1825         machine.gfx[1]->mark_dirty(((destination+tranfercount)&0x7fffff)/0x100);
18261826         //printf("RLE WRite Byte %08x, %02x\n", destination+tranfercount, real_byte);
18271827
18281828         tranfercount++;
r17669r17670
18411841      //printf("Write Normal Data\n");
18421842      dest[(destination&0x7fffff)^3] = real_byte;
18431843      state->m_last_normal_byte = real_byte;
1844      gfx_element_mark_dirty(machine.gfx[1], (destination&0x7fffff)/0x100);
1844      machine.gfx[1]->mark_dirty((destination&0x7fffff)/0x100);
18451845      return 1;
18461846   }
18471847}
r17669r17670
19121912      for(i=0;i<rle;++i)
19131913      {
19141914         destRAM[(dst_offset&0x7fffff)^3] = state->m_lastb;
1915         gfx_element_mark_dirty(machine.gfx[1], (dst_offset&0x7fffff)/0x100);
1915         machine.gfx[1]->mark_dirty((dst_offset&0x7fffff)/0x100);
19161916
19171917         dst_offset++;
19181918         ++l;
r17669r17670
19261926      state->m_lastb2=state->m_lastb;
19271927      state->m_lastb=b;
19281928      destRAM[(dst_offset&0x7fffff)^3] = b;
1929      gfx_element_mark_dirty(machine.gfx[1], (dst_offset&0x7fffff)/0x100);
1929      machine.gfx[1]->mark_dirty((dst_offset&0x7fffff)/0x100);
19301930      return 1;
19311931   }
19321932}
trunk/src/mame/drivers/neoprint.c
r17669r17670
7373{
7474   neoprint_state *state = machine.driver_data<neoprint_state>();
7575   int i, y, x;
76   const gfx_element *gfx = machine.gfx[0];
76   gfx_element *gfx = machine.gfx[0];
7777   INT16 scrollx, scrolly;
7878
7979   i = (state->m_npvidregs[((layer*8)+0x06)/2] & 7) * 0x1000/4;
trunk/src/mame/drivers/ssv.c
r17669r17670
930930
931931   offset += (m_scroll[0x76/2] & 0xf) * 0x40000/2;
932932   COMBINE_DATA(&m_eaglshot_gfxram[offset]);
933   gfx_element_mark_dirty(machine().gfx[0], offset / (16*8/2));
934   gfx_element_mark_dirty(machine().gfx[1], offset / (16*8/2));
933   machine().gfx[0]->mark_dirty(offset / (16*8/2));
934   machine().gfx[1]->mark_dirty(offset / (16*8/2));
935935}
936936
937937
trunk/src/mame/drivers/deco_ld.c
r17669r17670
149149
150150static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 *spriteram, UINT16 tile_bank )
151151{
152   const gfx_element *gfx = machine.gfx[1];
152   gfx_element *gfx = machine.gfx[1];
153153   int i,spr_offs,x,y,col,fx,fy;
154154
155155   /*
r17669r17670
195195static SCREEN_UPDATE_RGB32( rblaster )
196196{
197197   deco_ld_state *state = screen.machine().driver_data<deco_ld_state>();
198   const gfx_element *gfx = screen.machine().gfx[0];
198   gfx_element *gfx = screen.machine().gfx[0];
199199   int y,x;
200200
201201   bitmap.fill(0, cliprect);
trunk/src/mame/drivers/cvs.c
r17669r17670
166166   {
167167      offset |= (0 * 0x800) | 0x400 | m_character_ram_page_start;
168168      m_character_ram[offset] = data;
169      gfx_element_mark_dirty(machine().gfx[1], (offset / 8) % 256);
169      machine().gfx[1]->mark_dirty((offset / 8) % 256);
170170   }
171171   else
172172      s2636_work_ram_w(m_s2636_0, offset, data);
r17669r17670
189189   {
190190      offset |= (1 * 0x800) | 0x400 | m_character_ram_page_start;
191191      m_character_ram[offset] = data;
192      gfx_element_mark_dirty(machine().gfx[1], (offset / 8) % 256);
192      machine().gfx[1]->mark_dirty((offset / 8) % 256);
193193   }
194194   else
195195      s2636_work_ram_w(m_s2636_1, offset, data);
r17669r17670
212212   {
213213      offset |= (2 * 0x800) | 0x400 | m_character_ram_page_start;
214214      m_character_ram[offset] = data;
215      gfx_element_mark_dirty(machine().gfx[1], (offset / 8) % 256);
215      machine().gfx[1]->mark_dirty((offset / 8) % 256);
216216   }
217217   else
218218      s2636_work_ram_w(m_s2636_2, offset, data);
r17669r17670
994994
995995   /* allocate memory */
996996   if (machine.gfx[1] != NULL)
997      gfx_element_set_source(machine.gfx[1], state->m_character_ram);
997      machine.gfx[1]->set_source(state->m_character_ram);
998998
999999   start_393hz_timer(machine);
10001000
trunk/src/mame/drivers/powerbal.c
r17669r17670
393393   playmark_state *state = machine.driver_data<playmark_state>();
394394   UINT16 *spriteram = state->m_spriteram;
395395   int offs;
396   int height = machine.gfx[0]->height;
396   int height = machine.gfx[0]->height();
397397
398398   for (offs = 4; offs < state->m_spriteram.bytes() / 2; offs += 4)
399399   {
trunk/src/mame/drivers/blackt96.c
r17669r17670
179179{
180180   blackt96_state *state = machine.driver_data<blackt96_state>();
181181   /* the very first 'page' in the spriteram contains the x/y positions for each tile strip */
182   const gfx_element *gfxbg = machine.gfx[0];
183   const gfx_element *gfxspr = machine.gfx[1];
182   gfx_element *gfxbg = machine.gfx[0];
183   gfx_element *gfxspr = machine.gfx[1];
184184
185185   int base = column * (0x80/2);
186186   base += page * 2;
r17669r17670
225225   blackt96_state *state = screen.machine().driver_data<blackt96_state>();
226226   int count;
227227   int x,y;
228   const gfx_element *gfx = screen.machine().gfx[2];
228   gfx_element *gfx = screen.machine().gfx[2];
229229
230230   bitmap.fill(get_black_pen(screen.machine()), cliprect);
231231
trunk/src/mame/drivers/ace.c
r17669r17670
8282static VIDEO_START( ace )
8383{
8484   aceal_state *state = machine.driver_data<aceal_state>();
85   gfx_element_set_source(machine.gfx[1], state->m_characterram);
86   gfx_element_set_source(machine.gfx[2], state->m_characterram);
87   gfx_element_set_source(machine.gfx[3], state->m_characterram);
88   gfx_element_set_source(machine.gfx[4], state->m_scoreram);
85   machine.gfx[1]->set_source(state->m_characterram);
86   machine.gfx[2]->set_source(state->m_characterram);
87   machine.gfx[3]->set_source(state->m_characterram);
88   machine.gfx[4]->set_source(state->m_scoreram);
8989}
9090
9191static SCREEN_UPDATE_IND16( ace )
r17669r17670
144144         popmessage("write to %04x data = %02x\n", 0x8000 + offset, data);
145145      }
146146      m_characterram[offset] = data;
147      gfx_element_mark_dirty(machine().gfx[1], 0);
148      gfx_element_mark_dirty(machine().gfx[2], 0);
149      gfx_element_mark_dirty(machine().gfx[3], 0);
147      machine().gfx[1]->mark_dirty(0);
148      machine().gfx[2]->mark_dirty(0);
149      machine().gfx[3]->mark_dirty(0);
150150   }
151151}
152152
153153WRITE8_MEMBER(aceal_state::ace_scoreram_w)
154154{
155155   m_scoreram[offset] = data;
156   gfx_element_mark_dirty(machine().gfx[4], offset / 32);
156   machine().gfx[4]->mark_dirty(offset / 32);
157157}
158158
159159READ8_MEMBER(aceal_state::unk_r)
r17669r17670
323323
324324static void ace_postload(running_machine &machine)
325325{
326   gfx_element_mark_dirty(machine.gfx[1], 0);
327   gfx_element_mark_dirty(machine.gfx[2], 0);
328   gfx_element_mark_dirty(machine.gfx[3], 0);
329   gfx_element_mark_dirty(machine.gfx[4], 0);
326   machine.gfx[1]->mark_dirty(0);
327   machine.gfx[2]->mark_dirty(0);
328   machine.gfx[3]->mark_dirty(0);
329   machine.gfx[4]->mark_dirty(0);
330330}
331331
332332static MACHINE_START( ace )
trunk/src/mame/drivers/dreamwld.c
r17669r17670
165165static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
166166{
167167   dreamwld_state *state = machine.driver_data<dreamwld_state>();
168   const gfx_element *gfx = machine.gfx[0];
168   gfx_element *gfx = machine.gfx[0];
169169   UINT32 *source = state->m_spritebuf1;
170170   UINT32 *finish = state->m_spritebuf1 + 0x1000 / 4;
171171   UINT16 *redirect = (UINT16 *)state->memregion("spritelut")->base();
trunk/src/mame/drivers/flipjack.c
r17669r17670
191191   {
192192      for (x=0;x<32;x++)
193193      {
194         const gfx_element *gfx = screen.machine().gfx[0];
194         gfx_element *gfx = screen.machine().gfx[0];
195195         int tile = state->m_bank << 8 | state->m_vram[x+y*0x100];
196196         int color = state->m_cram[x+y*0x100] & 0x3f;
197197
trunk/src/mame/drivers/dominob.c
r17669r17670
8888
8989static VIDEO_START( dominob )
9090{
91   machine.gfx[0]->color_granularity = 8;
91   machine.gfx[0]->set_granularity(8);
9292}
9393
9494static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
trunk/src/mame/drivers/jackpool.c
r17669r17670
4646static SCREEN_UPDATE_IND16(jackpool)
4747{
4848   jackpool_state *state = screen.machine().driver_data<jackpool_state>();
49   const gfx_element *gfx = screen.machine().gfx[0];
49   gfx_element *gfx = screen.machine().gfx[0];
5050   int count;// = 0x00000/2;
5151
5252   int y,x;
trunk/src/mame/drivers/mirax.c
r17669r17670
163163static void draw_tilemap(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 draw_flag)
164164{
165165   mirax_state *state = machine.driver_data<mirax_state>();
166   const gfx_element *gfx = machine.gfx[0];
166   gfx_element *gfx = machine.gfx[0];
167167   int y,x;
168168   int res_x,res_y,wrapy;
169169
trunk/src/mame/drivers/gamecstl.c
r17669r17670
137137      palette_set_color(machine, i, cga_palette[i]);
138138}
139139
140static void draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, const gfx_element *gfx, int ch, int att, int x, int y)
140static void draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y)
141141{
142142   int i,j;
143143   const UINT8 *dp;
144144   int index = 0;
145   dp = gfx_element_get_data(gfx, ch);
145   dp = gfx->get_data(ch);
146146
147147   for (j=y; j < y+8; j++)
148148   {
r17669r17670
152152      {
153153         UINT8 pen = dp[index++];
154154         if (pen)
155            p[i] = gfx->color_base + (att & 0xf);
155            p[i] = gfx->colorbase() + (att & 0xf);
156156         else
157            p[i] = gfx->color_base  + ((att >> 4) & 0x7);
157            p[i] = gfx->colorbase()  + ((att >> 4) & 0x7);
158158      }
159159   }
160160}
r17669r17670
163163{
164164   gamecstl_state *state = screen.machine().driver_data<gamecstl_state>();
165165   int i, j;
166   const gfx_element *gfx = screen.machine().gfx[0];
166   gfx_element *gfx = screen.machine().gfx[0];
167167   UINT32 *cga = state->m_cga_ram;
168168   int index = 0;
169169
trunk/src/mame/drivers/segas16b.c
r17669r17670
68726872         if (dest == memregion("gfx1")->base())
68736873         {
68746874            // we need to re-decode the tiles if writing to this area to keep MAME happy
6875            gfx_element_mark_dirty(machine().gfx[0], (m_data_addr & 0x1ffff) / 8);
6875            machine().gfx[0]->mark_dirty((m_data_addr & 0x1ffff) / 8);
68766876         }
68776877      }
68786878   }
trunk/src/mame/drivers/srmp6.c
r17669r17670
162162   state->m_sprram_old = auto_alloc_array_clear(machine, UINT16, 0x80000/2);
163163
164164   /* create the char set (gfx will then be updated dynamically from RAM) */
165   machine.gfx[0] = gfx_element_alloc(machine, &tiles8x8_layout, (UINT8*)state->m_tileram, machine.total_colors() / 256, 0);
166   machine.gfx[0]->color_granularity=256;
165   machine.gfx[0] = auto_alloc(machine, gfx_element(machine, tiles8x8_layout, (UINT8*)state->m_tileram, machine.total_colors() / 256, 0));
166   machine.gfx[0]->set_granularity(256);
167167
168168   state->m_brightness = 0x60;
169169}
r17669r17670
391391      for(i=0;i<rle;++i)
392392      {
393393         tram[dst_offset + state->m_destl] = state->m_lastb;
394         gfx_element_mark_dirty(machine.gfx[0], (dst_offset + state->m_destl)/0x40);
394         machine.gfx[0]->mark_dirty((dst_offset + state->m_destl)/0x40);
395395
396396         dst_offset++;
397397         ++l;
r17669r17670
405405      state->m_lastb2 = state->m_lastb;
406406      state->m_lastb = b;
407407      tram[dst_offset + state->m_destl] = b;
408      gfx_element_mark_dirty(machine.gfx[0], (dst_offset + state->m_destl)/0x40);
408      machine.gfx[0]->mark_dirty((dst_offset + state->m_destl)/0x40);
409409
410410      return 1;
411411   }
trunk/src/mame/drivers/rabbit.c
r17669r17670
265265{
266266   rabbit_state *state = machine.driver_data<rabbit_state>();
267267   int xpos,ypos,tileno,xflip,yflip, colr;
268   const gfx_element *gfx = machine.gfx[1];
268   gfx_element *gfx = machine.gfx[1];
269269   int todraw = (state->m_spriteregs[5]&0x0fff0000)>>16; // how many sprites to draw (start/end reg..) what is the other half?
270270
271271   UINT32 *source = (state->m_spriteram+ (todraw*2))-2;
trunk/src/emu/tilemap.c
r17669r17670
114114   // iterate over all used gfx types and set the dirty flag if any of them have changed
115115   for (int gfxnum = 0; usedmask != 0; usedmask >>= 1, gfxnum++)
116116      if ((usedmask & 1) != 0)
117         if (m_gfx_dirtyseq[gfxnum] != machine().gfx[gfxnum]->dirtyseq)
117         if (m_gfx_dirtyseq[gfxnum] != machine().gfx[gfxnum]->dirtyseq())
118118         {
119            m_gfx_dirtyseq[gfxnum] = machine().gfx[gfxnum]->dirtyseq;
119            m_gfx_dirtyseq[gfxnum] = machine().gfx[gfxnum]->dirtyseq();
120120            isdirty = true;
121121         }
122122
r17669r17670
756756   if (m_tileinfo.gfxnum != 0xff && (m_gfx_used & (1 << m_tileinfo.gfxnum)) == 0)
757757   {
758758      m_gfx_used |= 1 << m_tileinfo.gfxnum;
759      m_gfx_dirtyseq[m_tileinfo.gfxnum] = machine().gfx[m_tileinfo.gfxnum]->dirtyseq;
759      m_gfx_dirtyseq[m_tileinfo.gfxnum] = machine().gfx[m_tileinfo.gfxnum]->dirtyseq();
760760   }
761761
762762g_profiler.stop();
trunk/src/emu/tilemap.h
r17669r17670
408408
409409   void set(running_machine &machine, int _gfxnum, int rawcode, int rawcolor, int _flags)
410410   {
411      const gfx_element *gfx = machine.gfx[_gfxnum];
412      int code = rawcode % gfx->total_elements;
413      pen_data = gfx_element_get_data(gfx, code);
414      palette_base = gfx->color_base + gfx->color_granularity * rawcolor;
411      gfx_element *gfx = machine.gfx[_gfxnum];
412      int code = rawcode % gfx->elements();
413      pen_data = gfx->get_data(code);
414      palette_base = gfx->colorbase() + gfx->granularity() * rawcolor;
415415      flags = _flags;
416416      gfxnum = _gfxnum;
417417   }
418418
419   void set(running_machine &machine, const gfx_element &gfx, int rawcode, int rawcolor, int _flags)
419   void set(running_machine &machine, gfx_element &gfx, int rawcode, int rawcolor, int _flags)
420420   {
421      int code = rawcode % gfx.total_elements;
422      pen_data = gfx_element_get_data(&gfx, code);
423      palette_base = gfx.color_base + gfx.color_granularity * rawcolor;
421      int code = rawcode % gfx.elements();
422      pen_data = gfx.get_data(code);
423      palette_base = gfx.colorbase() + gfx.granularity() * rawcolor;
424424      flags = _flags;
425425   }
426426};
trunk/src/emu/video.c
r17669r17670
528528
529529   // free all the graphics elements
530530   for (int i = 0; i < MAX_GFX_ELEMENTS; i++)
531      gfx_element_free(machine().gfx[i]);
531      auto_free(machine(), machine().gfx[i]);
532532
533533   // free the snapshot target
534534   machine().render().target_free(m_snap_target);
trunk/src/emu/emupal.c
r17669r17670
434434    color
435435-------------------------------------------------*/
436436
437UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx, int color, int transcolor)
437UINT32 colortable_get_transpen_mask(colortable_t *ctable, gfx_element *gfx, int color, int transcolor)
438438{
439   UINT32 entry = gfx->color_base + (color % gfx->total_colors) * gfx->color_granularity;
439   UINT32 entry = gfx->colorbase() + (color % gfx->colors()) * gfx->granularity();
440440   UINT32 mask = 0;
441441   UINT32 count, bit;
442442
443443   /* make sure we are in range */
444444   assert(ctable != NULL);
445445   assert(entry < ctable->entries);
446   assert(gfx->color_depth <= 32);
446   assert(gfx->depth() <= 32);
447447
448448   /* either gfx->color_depth entries or as many as we can get up until the end */
449   count = MIN(gfx->color_depth, ctable->entries - entry);
449   count = MIN(gfx->depth(), ctable->entries - entry);
450450
451451   /* set a bit anywhere the transcolor matches */
452452   for (bit = 0; bit < count; bit++)
r17669r17670
465465    (each group maps to a gfx color)
466466-------------------------------------------------*/
467467
468void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap_t *tmap, const gfx_element *gfx, int transcolor)
468void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap_t *tmap, gfx_element *gfx, int transcolor)
469469{
470470   int color;
471471
472472   assert(ctable != NULL);
473473   assert(gfx != NULL);
474474   assert(tmap != NULL);
475   assert(gfx->total_colors <= TILEMAP_NUM_GROUPS);
475   assert(gfx->colors() <= TILEMAP_NUM_GROUPS);
476476
477477   /* iterate over all colors in the tilemap */
478   for (color = 0; color < gfx->total_colors; color++)
478   for (color = 0; color < gfx->colors(); color++)
479479      tmap->set_transmask(color, colortable_get_transpen_mask(ctable, gfx, color, transcolor), 0);
480480}
481481
trunk/src/emu/emupal.h
r17669r17670
166166rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry);
167167
168168/* return a 32-bit transparency mask for a given gfx element and color */
169UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx, int color, int transcolor);
169UINT32 colortable_get_transpen_mask(colortable_t *ctable, gfx_element *gfx, int color, int transcolor);
170170
171171/* configure groups in a tilemap to represent transparency based on colortable entries (each group maps to a gfx color) */
172void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap_t *tmap, const gfx_element *gfx, int transcolor);
172void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap_t *tmap, gfx_element *gfx, int transcolor);
173173
174174/* return the number of entries in a colortable */
175175UINT32 colortable_palette_get_size(colortable_t *ctable);
trunk/src/emu/uigfx.c
r17669r17670
8484
8585/* graphics set handling */
8686static void gfxset_handle_keys(running_machine &machine, ui_gfx_state *state, int xcells, int ycells);
87static void gfxset_draw_item(running_machine &machine, const gfx_element *gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate);
87static void gfxset_draw_item(running_machine &machine, gfx_element *gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate);
8888static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx);
8989static void gfxset_handler(running_machine &machine, render_container *container, ui_gfx_state *state);
9090
r17669r17670
473473   cellboxheight = (cellboxbounds.y1 - cellboxbounds.y0) * (float)targheight;
474474
475475   /* compute the number of source pixels in a cell */
476   cellxpix = 1 + ((state->gfxset.rotate[state->gfxset.set] & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width);
477   cellypix = 1 + ((state->gfxset.rotate[state->gfxset.set] & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height);
476   cellxpix = 1 + ((state->gfxset.rotate[state->gfxset.set] & ORIENTATION_SWAP_XY) ? gfx->height() : gfx->width());
477   cellypix = 1 + ((state->gfxset.rotate[state->gfxset.set] & ORIENTATION_SWAP_XY) ? gfx->width() : gfx->height());
478478
479479   /* compute the largest pixel scale factor that still fits */
480480   xcells = state->gfxset.count[set];
r17669r17670
513513
514514   /* figure out the title and expand the outer box to fit */
515515   for (x = 0; x < MAX_GFX_ELEMENTS && machine.gfx[x] != NULL; x++) ;
516   sprintf(title, "GFX %d/%d %dx%d COLOR %X", state->gfxset.set, x - 1, gfx->width, gfx->height, state->gfxset.color[set]);
516   sprintf(title, "GFX %d/%d %dx%d COLOR %X", state->gfxset.set, x - 1, gfx->width(), gfx->height(), state->gfxset.color[set]);
517517   titlewidth = ui_font->string_width(chheight, machine.render().ui_aspect(), title);
518518   x0 = 0.0f;
519519   if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth)
r17669r17670
550550   for (y = 0; y < ycells; y += 1 + skip)
551551
552552      /* only display if there is data to show */
553      if (state->gfxset.offset[set] + y * xcells < gfx->total_elements)
553      if (state->gfxset.offset[set] + y * xcells < gfx->elements())
554554      {
555555         char buffer[10];
556556
r17669r17670
645645   if (ui_input_pressed_repeat(machine, IPT_UI_HOME, 4))
646646      state->gfxset.offset[set] = 0;
647647   if (ui_input_pressed_repeat(machine, IPT_UI_END, 4))
648      state->gfxset.offset[set] = gfx->total_elements;
648      state->gfxset.offset[set] = gfx->elements();
649649
650650   /* clamp within range */
651   if (state->gfxset.offset[set] + xcells * ycells > ((gfx->total_elements + xcells - 1) / xcells) * xcells)
652      state->gfxset.offset[set] = ((gfx->total_elements + xcells - 1) / xcells) * xcells - xcells * ycells;
651   if (state->gfxset.offset[set] + xcells * ycells > ((gfx->elements() + xcells - 1) / xcells) * xcells)
652      state->gfxset.offset[set] = ((gfx->elements() + xcells - 1) / xcells) * xcells - xcells * ycells;
653653   if (state->gfxset.offset[set] < 0)
654654      state->gfxset.offset[set] = 0;
655655
r17669r17670
660660      state->gfxset.color[set] += 1;
661661
662662   /* clamp within range */
663   if (state->gfxset.color[set] >= (int)gfx->total_colors)
664      state->gfxset.color[set] = gfx->total_colors - 1;
663   if (state->gfxset.color[set] >= (int)gfx->colors())
664      state->gfxset.color[set] = gfx->colors() - 1;
665665   if (state->gfxset.color[set] < 0)
666666      state->gfxset.color[set] = 0;
667667
r17669r17670
689689   int x, y;
690690
691691   /* compute the number of source pixels in a cell */
692   cellxpix = 1 + ((state->gfxset.rotate[set] & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width);
693   cellypix = 1 + ((state->gfxset.rotate[set] & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height);
692   cellxpix = 1 + ((state->gfxset.rotate[set] & ORIENTATION_SWAP_XY) ? gfx->height() : gfx->width());
693   cellypix = 1 + ((state->gfxset.rotate[set] & ORIENTATION_SWAP_XY) ? gfx->width() : gfx->height());
694694
695695   /* realloc the bitmap if it is too small */
696696   if (state->bitmap == NULL || state->texture == NULL || state->bitmap->bpp() != 32 || state->bitmap->width() != cellxpix * xcells || state->bitmap->height() != cellypix * ycells)
r17669r17670
720720         cellbounds.set(0, state->bitmap->width() - 1, y * cellypix, (y + 1) * cellypix - 1);
721721
722722         /* only display if there is data to show */
723         if (state->gfxset.offset[set] + y * xcells < gfx->total_elements)
723         if (state->gfxset.offset[set] + y * xcells < gfx->elements())
724724         {
725725            /* draw the individual cells */
726726            for (x = 0; x < xcells; x++)
r17669r17670
732732               cellbounds.max_x = (x + 1) * cellxpix - 1;
733733
734734               /* only render if there is data */
735               if (index < gfx->total_elements)
735               if (index < gfx->elements())
736736                  gfxset_draw_item(machine, gfx, index, *state->bitmap, cellbounds.min_x, cellbounds.min_y, state->gfxset.color[set], state->gfxset.rotate[set]);
737737
738738               /* otherwise, fill with transparency */
r17669r17670
758758    the view
759759-------------------------------------------------*/
760760
761static void gfxset_draw_item(running_machine &machine, const gfx_element *gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate)
761static void gfxset_draw_item(running_machine &machine, gfx_element *gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate)
762762{
763763   static const pen_t default_palette[] =
764764   {
765765      MAKE_RGB(0,0,0), MAKE_RGB(0,0,255), MAKE_RGB(0,255,0), MAKE_RGB(0,255,255),
766766      MAKE_RGB(255,0,0), MAKE_RGB(255,0,255), MAKE_RGB(255,255,0), MAKE_RGB(255,255,255)
767767   };
768   int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width;
769   int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height;
768   int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height() : gfx->width();
769   int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width() : gfx->height();
770770   const rgb_t *palette = (machine.total_colors() != 0) ? palette_entry_list_raw(machine.palette) : NULL;
771771   UINT32 palette_mask = ~0;
772772   int x, y;
773773
774774   if (palette != NULL)
775      palette += gfx->color_base + color * gfx->color_granularity;
775      palette += gfx->colorbase() + color * gfx->granularity();
776776   else
777777   {
778778      palette = default_palette;
r17669r17670
783783   for (y = 0; y < height; y++)
784784   {
785785      UINT32 *dest = &bitmap.pix32(dsty + y, dstx);
786      const UINT8 *src = gfx_element_get_data(gfx, index);
786      const UINT8 *src = gfx->get_data(index);
787787
788788      /* loop over columns in the cell */
789789      for (x = 0; x < width; x++)
r17669r17670
795795         if (!(rotate & ORIENTATION_SWAP_XY))
796796         {
797797            if (rotate & ORIENTATION_FLIP_X)
798               effx = gfx->width - 1 - effx;
798               effx = gfx->width() - 1 - effx;
799799            if (rotate & ORIENTATION_FLIP_Y)
800               effy = gfx->height - 1 - effy;
800               effy = gfx->height() - 1 - effy;
801801         }
802802         else
803803         {
804804            int temp;
805805            if (rotate & ORIENTATION_FLIP_X)
806               effx = gfx->height - 1 - effx;
806               effx = gfx->height() - 1 - effx;
807807            if (rotate & ORIENTATION_FLIP_Y)
808               effy = gfx->width - 1 - effy;
808               effy = gfx->width() - 1 - effy;
809809            temp = effx; effx = effy; effy = temp;
810810         }
811811
812812         /* get a pointer to the start of this source row */
813         s = src + effy * gfx->line_modulo;
813         s = src + effy * gfx->rowbytes();
814814
815815         /* extract the pixel */
816816         *dest++ = 0xff000000 | palette[s[effx] & palette_mask];
trunk/src/emu/machine/tc009xlvc.c
r17669r17670
8383WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_pcg1_w)
8484{
8585   m_pcg1_ram[offset] = data;
86   gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0x4000) / 32);
86   machine().gfx[m_gfx_index]->mark_dirty((offset+0x4000) / 32);
8787   tx_tilemap->mark_all_dirty();
8888}
8989
r17669r17670
9595WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_pcg2_w)
9696{
9797   m_pcg2_ram[offset] = data;
98   gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0xc000) / 32);
98   machine().gfx[m_gfx_index]->mark_dirty((offset+0xc000) / 32);
9999   tx_tilemap->mark_all_dirty();
100100}
101101
r17669r17670
108108{
109109   m_vram0[offset] = data;
110110   bg0_tilemap->mark_tile_dirty(offset/2);
111   gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0x8000) / 32);
111   machine().gfx[m_gfx_index]->mark_dirty((offset+0x8000) / 32);
112112   tx_tilemap->mark_all_dirty();
113113
114114}
r17669r17670
122122{
123123   m_vram1[offset] = data;
124124   bg1_tilemap->mark_tile_dirty(offset/2);
125   gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0x9000) / 32);
125   machine().gfx[m_gfx_index]->mark_dirty((offset+0x9000) / 32);
126126   tx_tilemap->mark_all_dirty();
127127}
128128
r17669r17670
135135{
136136   m_tvram[offset] = data;
137137   tx_tilemap->mark_tile_dirty(offset/2);
138   gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0xa000) / 32);
138   machine().gfx[m_gfx_index]->mark_dirty((offset+0xa000) / 32);
139139   tx_tilemap->mark_all_dirty();
140140}
141141
r17669r17670
147147WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_spr_w)
148148{
149149   m_sprram[offset] = data;
150   gfx_element_mark_dirty(machine().gfx[m_gfx_index], (offset+0xb000) / 32);
150   machine().gfx[m_gfx_index]->mark_dirty((offset+0xb000) / 32);
151151   tx_tilemap->mark_all_dirty();
152152}
153153
r17669r17670
276276
277277   //printf("m_gfx_index %d\n", m_gfx_index);
278278
279   machine().gfx[m_gfx_index] = gfx_element_alloc(machine(), &char_layout, (UINT8 *)m_pcg_ram, machine().total_colors() / 16, 0);
279   machine().gfx[m_gfx_index] = auto_alloc(machine(), gfx_element(machine(), char_layout, (UINT8 *)m_pcg_ram, machine().total_colors() / 16, 0));
280280}
281281
282282void tc0091lvc_device::device_reset()
r17669r17670
292292
293293void tc0091lvc_device::draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 global_flip )
294294{
295   const gfx_element *gfx = machine.gfx[1];
295   gfx_element *gfx = machine.gfx[1];
296296   int count;
297297
298298   for(count=0;count<0x3e7;count+=8)
trunk/src/emu/drawgfx.c
r17669r17670
2525
2626
2727/***************************************************************************
28    FUNCTION PROTOTYPES
29***************************************************************************/
30
31static void decodechar(const gfx_element *gfx, UINT32 code, const UINT8 *src);
32
33
34
35/***************************************************************************
3628    INLINE FUNCTIONS
3729***************************************************************************/
3830
r17669r17670
208200      glcopy.total = total;
209201
210202      // allocate the graphics
211      machine.gfx[curgfx] = gfx_element_alloc(machine, &glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, gfxdecode->total_color_codes, gfxdecode->color_codes_start);
203      machine.gfx[curgfx] = auto_alloc(machine, gfx_element(machine, glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, gfxdecode->total_color_codes, gfxdecode->color_codes_start));
212204   }
213205}
214206
215207
216208
217/*-------------------------------------------------
218    gfx_element_alloc - allocate a gfx_element structure
219    based on a given layout
220-------------------------------------------------*/
209//-------------------------------------------------
210//  gfx_element - constructor
211//-------------------------------------------------
221212
222gfx_element *gfx_element_alloc(running_machine &machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base)
213gfx_element::gfx_element(running_machine &machine)
214   : m_width(0),
215     m_height(0),
216     m_startx(0),
217     m_starty(0),
218     m_origwidth(0),
219     m_origheight(0),
220     m_total_elements(0),
221     m_color_base(0),
222     m_color_depth(0),
223     m_color_granularity(0),
224     m_total_colors(0),
225     m_line_modulo(0),
226     m_char_modulo(0),
227     m_srcdata(NULL),
228     m_dirtyseq(1),
229     m_gfxdata(NULL),
230     m_layout_is_raw(false),
231     m_layout_planes(0),
232     m_layout_charincrement(0),
233     m_machine(machine)
223234{
224   int israw = (gl->planeoffset[0] == GFX_RAW);
225   int planes = gl->planes;
226   UINT16 width = gl->width;
227   UINT16 height = gl->height;
228   UINT32 total = gl->total;
229   gfx_element *gfx;
235}
230236
231   // allocate memory for the gfx_element structure
232   gfx = auto_alloc_clear(machine, gfx_element(machine));
237gfx_element::gfx_element(running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity)
238   : m_width(width),
239     m_height(height),
240     m_startx(0),
241     m_starty(0),
242     m_origwidth(width),
243     m_origheight(height),
244     m_total_elements(1),
245     m_color_base(color_base),
246     m_color_depth(color_granularity),
247     m_color_granularity(color_granularity),
248     m_total_colors((machine.total_colors() - color_base) / color_granularity),
249     m_line_modulo(rowbytes),
250     m_char_modulo(0),
251     m_srcdata(base),
252     m_dirtyseq(1),
253     m_gfxdata(NULL),
254     m_layout_is_raw(false),
255     m_layout_planes(0),
256     m_layout_charincrement(0),
257     m_machine(machine)
258{
259}
233260
234   // fill in the data
235   gfx->width = width;
236   gfx->height = height;
261gfx_element::gfx_element(running_machine &machine, const gfx_layout &gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base)
262   : m_width(0),
263     m_height(0),
264     m_startx(0),
265     m_starty(0),
266     m_origwidth(0),
267     m_origheight(0),
268     m_total_elements(0),
269     m_color_base(color_base),
270     m_color_depth(0),
271     m_color_granularity(0),
272     m_total_colors(total_colors),
273     m_line_modulo(0),
274     m_char_modulo(0),
275     m_srcdata(NULL),
276     m_dirtyseq(1),
277     m_gfxdata(NULL),
278     m_layout_is_raw(false),
279     m_layout_planes(0),
280     m_layout_charincrement(0),
281     m_machine(machine)
282{
283   // set the layout
284   set_layout(gl, srcdata);
285}
237286
238   gfx->origwidth = width;
239   gfx->origheight = height;
240   gfx->total_elements = total;
241287
242   gfx->color_base = color_base;
243   gfx->color_depth = 1 << planes;
244   gfx->color_granularity = 1 << planes;
245   gfx->total_colors = total_colors;
288//-------------------------------------------------
289//  set_layout - set the layout for a gfx_element
290//-------------------------------------------------
246291
247   gfx->srcdata = srcdata;
292void gfx_element::set_layout(const gfx_layout &gl, const UINT8 *srcdata)
293{
294   // configure ourselves
295   m_width = m_origwidth = gl.width;
296   m_height = m_origheight = gl.height;
297   m_startx = m_starty = 0;
298   m_total_elements = gl.total;
299   m_color_depth = m_color_granularity = 1 << gl.planes;
248300
249   // copy the layout
250   gfx->layout = *gl;
251   if (gfx->layout.extxoffs != NULL)
252   {
253      if (gfx->layout.width < ARRAY_LENGTH(gfx->layout.xoffset))
254      {
255         memcpy(gfx->layout.xoffset, gfx->layout.extxoffs, sizeof(gfx->layout.xoffset[0]) * gfx->layout.width);
256         gfx->layout.extxoffs = NULL;
257      }
258      else
259      {
260         UINT32 *buffer = auto_alloc_array(machine, UINT32, gfx->layout.width);
261         memcpy(buffer, gfx->layout.extxoffs, sizeof(gfx->layout.extxoffs[0]) * gfx->layout.width);
262         gfx->layout.extxoffs = buffer;
263      }
264   }
301   // copy data from the layout
302   m_layout_is_raw = (gl.planeoffset[0] == GFX_RAW);
303   m_layout_planes = gl.planes;
304   m_layout_charincrement = gl.charincrement;
305   m_layout_planeoffset.resize(m_layout_planes);
306   m_layout_xoffset.resize(m_width);
307   m_layout_yoffset.resize(m_height);
265308
266   if (gfx->layout.extyoffs != NULL)
267   {
268      if (gfx->layout.height < ARRAY_LENGTH(gfx->layout.yoffset))
269      {
270         memcpy(gfx->layout.yoffset, gfx->layout.extyoffs, sizeof(gfx->layout.yoffset[0]) * gfx->layout.height);
271         gfx->layout.extyoffs = NULL;
272      }
273      else
274      {
275         UINT32 *buffer = auto_alloc_array(machine, UINT32, gfx->layout.height);
276         memcpy(buffer, gfx->layout.extyoffs, sizeof(gfx->layout.extyoffs[0]) * gfx->layout.height);
277         gfx->layout.extyoffs = buffer;
278      }
279   }
280
281   // allocate a pen usage array for entries with 32 pens or less
282   if (gfx->color_depth <= 32)
283      gfx->pen_usage = auto_alloc_array(machine, UINT32, gfx->total_elements);
284
285   // allocate a dirty array
286   gfx->dirty = auto_alloc_array(machine, UINT8, gfx->total_elements);
287   memset(gfx->dirty, 1, gfx->total_elements * sizeof(*gfx->dirty));
288
289309   // raw graphics case
290   if (israw)
310   if (m_layout_is_raw)
291311   {
292312      // modulos are determined for us by the layout
293      gfx->line_modulo = (gl->extyoffs ? gl->extyoffs[0] : gl->yoffset[0]) / 8;
294      gfx->char_modulo = gl->charincrement / 8;
313      m_line_modulo = ((gl.extyoffs != NULL) ? gl.extyoffs[0] : gl.yoffset[0]) / 8;
314      m_char_modulo = gl.charincrement / 8;
295315
296      // don't free the data because we will get a pointer at decode time
297      gfx->flags |= GFX_ELEMENT_DONT_FREE;
298
299316      // RAW graphics must have a pointer up front
300      gfx->gfxdata = (UINT8 *)gfx->srcdata;
317      assert(srcdata != NULL);
318      m_gfxdata_allocated.reset();
319      m_gfxdata = const_cast<UINT8 *>(m_srcdata);
301320   }
302321
303322   // decoded graphics case
304323   else
305324   {
325      // copy offsets
326      for (int p = 0; p < m_layout_planes; p++)
327         m_layout_planeoffset[p] = gl.planeoffset[p];
328      for (int y = 0; y < m_height; y++)
329         m_layout_yoffset[y] = gl.yoffs(y);
330      for (int x = 0; x < m_width; x++)
331         m_layout_xoffset[x] = gl.xoffs(x);
332
306333      // we get to pick our own modulos
307      gfx->line_modulo = gfx->origwidth;
308      gfx->char_modulo = gfx->line_modulo * gfx->origheight;
334      m_line_modulo = m_origwidth;
335      m_char_modulo = m_line_modulo * m_origheight;
309336
310337      // allocate memory for the data
311      gfx->gfxdata = auto_alloc_array(machine, UINT8, gfx->total_elements * gfx->char_modulo);
338      m_gfxdata_allocated.resize(m_total_elements * m_char_modulo);
339      m_gfxdata = &m_gfxdata_allocated[0];
312340   }
313341
314   return gfx;
315}
342   // mark everything dirty
343   m_dirty.resize(m_total_elements);
344   memset(m_dirty, 1, m_total_elements);
316345
317
318/*-------------------------------------------------
319    gfx_element_decode - update a single code in
320    a gfx_element
321-------------------------------------------------*/
322
323void gfx_element_decode(const gfx_element *gfx, UINT32 code)
324{
325   decodechar(gfx, code, gfx->srcdata);
346   // allocate a pen usage array for entries with 32 pens or less
347   if (m_color_depth <= 32)
348      m_pen_usage.resize(m_total_elements);
349   else
350      m_pen_usage.reset();
351   
352   // set the source
353   set_source(srcdata);
326354}
327355
328356
329/*-------------------------------------------------
330    gfx_element_free - free a gfx_element
331-------------------------------------------------*/
357//-------------------------------------------------
358//  set_raw_layout - set the layout for a gfx_element
359//-------------------------------------------------
332360
333void gfx_element_free(gfx_element *gfx)
361void gfx_element::set_raw_layout(const UINT8 *srcdata, UINT32 width, UINT32 height, UINT32 total, UINT32 linemod, UINT32 charmod)
334362{
335   // ignore NULL frees
336   if (gfx == NULL)
337      return;
338
339   // free our data
340   auto_free(gfx->machine(), gfx->layout.extyoffs);
341   auto_free(gfx->machine(), gfx->layout.extxoffs);
342   auto_free(gfx->machine(), gfx->pen_usage);
343   auto_free(gfx->machine(), gfx->dirty);
344   auto_free(gfx->machine(), gfx->gfxdata);
345   auto_free(gfx->machine(), gfx);
363   gfx_layout layout = { 0 };
364   layout.width = width;
365   layout.height = height;
366   layout.total = total;
367   layout.planes = 8;
368   layout.planeoffset[0] = GFX_RAW;
369   layout.yoffset[0] = linemod;
370   layout.charincrement = charmod;
371   set_layout(layout, srcdata);
346372}
347373
348374
349/*-------------------------------------------------
350    gfx_element_build_temporary - create a
351    temporary one-off gfx_element
352-------------------------------------------------*/
375//-------------------------------------------------
376//  set_source_clip - set a source clipping rect
377//-------------------------------------------------
353378
354void gfx_element_build_temporary(gfx_element *gfx, running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags)
379void gfx_element::set_source_clip(UINT32 xoffs, UINT32 width, UINT32 yoffs, UINT32 height)
355380{
356   static UINT8 not_dirty = 0;
381   assert(xoffs < m_origwidth);
382   assert(yoffs < m_origheight);
383   assert(xoffs + width <= m_origwidth);
384   assert(yoffs + height <= m_origheight);
357385
358   gfx->width = width;
359   gfx->height = height;
360   gfx->startx = 0;
361   gfx->starty = 0;
362
363   gfx->origwidth = width;
364   gfx->origheight = height;
365   gfx->flags = flags;
366   gfx->total_elements = 1;
367
368   gfx->color_base = color_base;
369   gfx->color_depth = color_granularity;
370   gfx->color_granularity = color_granularity;
371   gfx->total_colors = (machine.total_colors() - color_base) / color_granularity;
372
373   gfx->pen_usage = NULL;
374
375   gfx->gfxdata = base;
376   gfx->line_modulo = rowbytes;
377   gfx->char_modulo = 0;
378   gfx->srcdata = base;
379   gfx->dirty = &not_dirty;
380   gfx->dirtyseq = 0;
386   m_width = width;
387   m_height = height;
388   m_startx = xoffs;
389   m_starty = yoffs;
381390}
382391
383392
384/*-------------------------------------------------
385    calc_penusage - calculate the pen usage for
386    a given graphics tile
387-------------------------------------------------*/
393//-------------------------------------------------
394//  decode - decode a single character
395//-------------------------------------------------
388396
389static void calc_penusage(const gfx_element *gfx, UINT32 code)
397void gfx_element::decode(UINT32 code)
390398{
391   const UINT8 *dp = gfx->gfxdata + code * gfx->char_modulo;
392   UINT32 usage = 0;
393   int x, y;
394
395   // if nothing allocated, don't do it
396   if (gfx->pen_usage == NULL)
397      return;
398
399   for (y = 0; y < gfx->origheight; y++)
399   // don't decode GFX_RAW
400   if (!m_layout_is_raw)
400401   {
401      for (x = 0; x < gfx->origwidth; x++)
402         usage |= 1 << dp[x];
403
404      dp += gfx->line_modulo;
405   }
406
407   // store the final result
408   gfx->pen_usage[code] = usage;
409}
410
411
412/*-------------------------------------------------
413    decodechar - decode a single character based
414    on a specified layout
415-------------------------------------------------*/
416
417static void decodechar(const gfx_element *gfx, UINT32 code, const UINT8 *src)
418{
419   const gfx_layout *gl = &gfx->layout;
420   int israw = (gl->planeoffset[0] == GFX_RAW);
421   int planes = gl->planes;
422   UINT32 charincrement = gl->charincrement;
423   const UINT32 *poffset = gl->planeoffset;
424   const UINT32 *xoffset = gl->extxoffs ? gl->extxoffs : gl->xoffset;
425   const UINT32 *yoffset = gl->extyoffs ? gl->extyoffs : gl->yoffset;
426   UINT8 *dp = gfx->gfxdata + code * gfx->char_modulo;
427   int plane, x, y;
428
429   if (!israw)
430   {
431402      // zap the data to 0
432      memset(dp, 0, gfx->char_modulo);
433      for (plane = 0; plane < planes; plane++)
403      UINT8 *decode_base = m_gfxdata + code * m_char_modulo;
404      memset(decode_base, 0, m_char_modulo);
405     
406      // iterate over planes
407      for (int plane = 0; plane < m_layout_planes; plane++)
434408      {
435         int planebit = 1 << (planes - 1 - plane);
436         int planeoffs = code * charincrement + poffset[plane];
409         int planebit = 1 << (m_layout_planes - 1 - plane);
410         int planeoffs = code * m_layout_charincrement + m_layout_planeoffset[plane];
437411
438         for (y = 0; y < gfx->origheight; y++)
412         // iterate over rows
413         for (int y = 0; y < m_origheight; y++)
439414         {
440            int yoffs = planeoffs + yoffset[y];
441
442            dp = gfx->gfxdata + code * gfx->char_modulo + y * gfx->line_modulo;
443            for (x = 0; x < gfx->origwidth; x++)
444               if (readbit(src, yoffs + xoffset[x]))
415            int yoffs = planeoffs + m_layout_yoffset[y];
416            UINT8 *dp = decode_base + y * rowbytes();
417           
418            // iterate over columns
419            for (int x = 0; x < m_origwidth; x++)
420               if (readbit(m_srcdata, yoffs + m_layout_xoffset[x]))
445421                  dp[x] |= planebit;
446422         }
447423      }
448424   }
449425
450   // compute pen usage
451   calc_penusage(gfx, code);
426   // (re)compute pen usage
427   if (code < m_pen_usage.count())
428   {
429      // iterate over data, creating a bitmask of live pens
430      const UINT8 *dp = m_gfxdata + code * m_char_modulo;
431      UINT32 usage = 0;
432      for (int y = 0; y < m_origheight; y++)
433      {
434         for (int x = 0; x < m_origwidth; x++)
435            usage |= 1 << dp[x];
436         dp += m_line_modulo;
437      }
452438
439      // store the final result
440      m_pen_usage[code] = usage;
441   }
442
453443   // no longer dirty
454   gfx->dirty[code] = 0;
444   m_dirty[code] = 0;
455445}
456446
457447
448
458449/***************************************************************************
459450    DRAWGFX IMPLEMENTATIONS
460451***************************************************************************/
r17669r17670
464455    no transparency
465456-------------------------------------------------*/
466457
467void drawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
458void drawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
468459      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty)
469460{
470   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
471   code %= gfx->total_elements;
461   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
462   code %= gfx->elements();
472463   DECLARE_NO_PRIORITY;
473464   DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
474465}
475466
476void drawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
467void drawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
477468      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty)
478469{
479   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
480   code %= gfx->total_elements;
470   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
471   code %= gfx->elements();
481472   DECLARE_NO_PRIORITY;
482473   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
483474}
r17669r17670
488479    a single transparent pen
489480-------------------------------------------------*/
490481
491void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
482void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
492483      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
493484      UINT32 transpen)
494485{
r17669r17670
497488      return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
498489
499490   // use pen usage to optimize
500   code %= gfx->total_elements;
501   if (gfx->pen_usage != NULL && !gfx->dirty[code])
491   code %= gfx->elements();
492   if (gfx->has_pen_usage())
502493   {
503494      // fully transparent; do nothing
504      UINT32 usage = gfx->pen_usage[code];
495      UINT32 usage = gfx->pen_usage(code);
505496      if ((usage & ~(1 << transpen)) == 0)
506497         return;
507498
r17669r17670
511502   }
512503
513504   // render
514   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
505   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
515506   DECLARE_NO_PRIORITY;
516507   DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
517508}
518509
519void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
510void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
520511      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
521512      UINT32 transpen)
522513{
r17669r17670
525516      return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
526517
527518   // use pen usage to optimize
528   code %= gfx->total_elements;
529   if (gfx->pen_usage != NULL && !gfx->dirty[code])
519   code %= gfx->elements();
520   if (gfx->has_pen_usage())
530521   {
531522      // fully transparent; do nothing
532      UINT32 usage = gfx->pen_usage[code];
523      UINT32 usage = gfx->pen_usage(code);
533524      if ((usage & ~(1 << transpen)) == 0)
534525         return;
535526
r17669r17670
539530   }
540531
541532   // render
542   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
533   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
543534   DECLARE_NO_PRIORITY;
544535   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
545536}
r17669r17670
551542    lookups
552543-------------------------------------------------*/
553544
554void drawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
545void drawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
555546      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
556547      UINT32 transpen)
557548{
558549   // early out if completely transparent
559   code %= gfx->total_elements;
560   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
550   code %= gfx->elements();
551   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
561552      return;
562553
563554   // render
r17669r17670
565556   DRAWGFX_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY);
566557}
567558
568void drawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
559void drawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
569560      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
570561      UINT32 transpen)
571562{
572563   // early out if completely transparent
573   code %= gfx->total_elements;
574   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
564   code %= gfx->elements();
565   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
575566      return;
576567
577568   // render
r17669r17670
586577    a mask
587578-------------------------------------------------*/
588579
589void drawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
580void drawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
590581      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
591582      UINT32 transmask)
592583{
r17669r17670
595586      return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
596587
597588   // use pen usage to optimize
598   code %= gfx->total_elements;
599   if (gfx->pen_usage != NULL && !gfx->dirty[code])
589   code %= gfx->elements();
590   if (gfx->has_pen_usage())
600591   {
601592      // fully transparent; do nothing
602      UINT32 usage = gfx->pen_usage[code];
593      UINT32 usage = gfx->pen_usage(code);
603594      if ((usage & ~transmask) == 0)
604595         return;
605596
r17669r17670
609600   }
610601
611602   // render
612   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
603   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
613604   DECLARE_NO_PRIORITY;
614605   DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
615606}
616607
617void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
608void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
618609      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
619610      UINT32 transmask)
620611{
r17669r17670
623614      return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
624615
625616   // use pen usage to optimize
626   code %= gfx->total_elements;
627   if (gfx->pen_usage != NULL && !gfx->dirty[code])
617   code %= gfx->elements();
618   if (gfx->has_pen_usage())
628619   {
629620      // fully transparent; do nothing
630      UINT32 usage = gfx->pen_usage[code];
621      UINT32 usage = gfx->pen_usage(code);
631622      if ((usage & ~transmask) == 0)
632623         return;
633624
r17669r17670
637628   }
638629
639630   // render
640   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
631   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
641632   DECLARE_NO_PRIORITY;
642633   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
643634}
r17669r17670
649640    transparent, opaque, or shadowing
650641-------------------------------------------------*/
651642
652void drawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
643void drawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
653644      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
654645      const UINT8 *pentable, const pen_t *shadowtable)
655646{
656647   assert(pentable != NULL);
657648
658649   // render
659   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
660   code %= gfx->total_elements;
650   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
651   code %= gfx->elements();
661652   DECLARE_NO_PRIORITY;
662653   DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY);
663654}
664655
665void drawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
656void drawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
666657      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
667658      const UINT8 *pentable, const pen_t *shadowtable)
668659{
669660   assert(pentable != NULL);
670661
671662   // render
672   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
673   code %= gfx->total_elements;
663   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
664   code %= gfx->elements();
674665   DECLARE_NO_PRIORITY;
675666   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY);
676667}
r17669r17670
682673    remaining pixels with a fixed alpha value
683674-------------------------------------------------*/
684675
685void drawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
676void drawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
686677      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
687678      UINT32 transpen, UINT8 alpha)
688679{
r17669r17670
691682      return drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen);
692683
693684   // early out if completely transparent
694   code %= gfx->total_elements;
695   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
685   code %= gfx->elements();
686   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
696687      return;
697688
698689   // get final code and color, and grab lookup tables
699   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
690   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
700691   DECLARE_NO_PRIORITY;
701692   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY);
702693}
r17669r17670
712703    element with no transparency
713704-------------------------------------------------*/
714705
715void drawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
706void drawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
716707      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
717708      UINT32 scalex, UINT32 scaley)
718709{
r17669r17670
721712      return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
722713
723714   // render
724   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
725   code %= gfx->total_elements;
715   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
716   code %= gfx->elements();
726717   DECLARE_NO_PRIORITY;
727718   DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
728719}
729720
730void drawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
721void drawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
731722      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
732723      UINT32 scalex, UINT32 scaley)
733724{
r17669r17670
736727      return drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
737728
738729   // render
739   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
740   code %= gfx->total_elements;
730   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
731   code %= gfx->elements();
741732   DECLARE_NO_PRIORITY;
742733   DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
743734}
r17669r17670
748739    element with a single transparent pen
749740-------------------------------------------------*/
750741
751void drawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
742void drawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
752743      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
753744      UINT32 scalex, UINT32 scaley, UINT32 transpen)
754745{
r17669r17670
761752      return drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
762753
763754   // use pen usage to optimize
764   code %= gfx->total_elements;
765   if (gfx->pen_usage != NULL && !gfx->dirty[code])
755   code %= gfx->elements();
756   if (gfx->has_pen_usage())
766757   {
767758      // fully transparent; do nothing
768      UINT32 usage = gfx->pen_usage[code];
759      UINT32 usage = gfx->pen_usage(code);
769760      if ((usage & ~(1 << transpen)) == 0)
770761         return;
771762
r17669r17670
775766   }
776767
777768   // render
778   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
769   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
779770   DECLARE_NO_PRIORITY;
780771   DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
781772}
782773
783void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
774void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
784775      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
785776      UINT32 scalex, UINT32 scaley, UINT32 transpen)
786777{
r17669r17670
793784      return drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
794785
795786   // use pen usage to optimize
796   code %= gfx->total_elements;
797   if (gfx->pen_usage != NULL && !gfx->dirty[code])
787   code %= gfx->elements();
788   if (gfx->has_pen_usage())
798789   {
799790      // fully transparent; do nothing
800      UINT32 usage = gfx->pen_usage[code];
791      UINT32 usage = gfx->pen_usage(code);
801792      if ((usage & ~(1 << transpen)) == 0)
802793         return;
803794
r17669r17670
807798   }
808799
809800   // render
810   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
801   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
811802   DECLARE_NO_PRIORITY;
812803   DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
813804}
r17669r17670
819810    color lookups
820811-------------------------------------------------*/
821812
822void drawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
813void drawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
823814      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
824815      UINT32 scalex, UINT32 scaley, UINT32 transpen)
825816{
r17669r17670
828819      return drawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen);
829820
830821   // early out if completely transparent
831   code %= gfx->total_elements;
832   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
822   code %= gfx->elements();
823   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
833824      return;
834825
835826   // render
r17669r17670
837828   DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY);
838829}
839830
840void drawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
831void drawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
841832      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
842833      UINT32 scalex, UINT32 scaley, UINT32 transpen)
843834{
r17669r17670
846837      return drawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen);
847838
848839   // early out if completely transparent
849   code %= gfx->total_elements;
850   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
840   code %= gfx->elements();
841   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
851842      return;
852843
853844   // render
r17669r17670
862853    provided as a mask
863854-------------------------------------------------*/
864855
865void drawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
856void drawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
866857      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
867858      UINT32 scalex, UINT32 scaley, UINT32 transmask)
868859{
r17669r17670
875866      return drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
876867
877868   // use pen usage to optimize
878   code %= gfx->total_elements;
879   if (gfx->pen_usage != NULL && !gfx->dirty[code])
869   code %= gfx->elements();
870   if (gfx->has_pen_usage())
880871   {
881872      // fully transparent; do nothing
882      UINT32 usage = gfx->pen_usage[code];
873      UINT32 usage = gfx->pen_usage(code);
883874      if ((usage & ~transmask) == 0)
884875         return;
885876
r17669r17670
889880   }
890881
891882   // render
892   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
883   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
893884   DECLARE_NO_PRIORITY;
894885   DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
895886}
896887
897void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
888void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
898889      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
899890      UINT32 scalex, UINT32 scaley, UINT32 transmask)
900891{
r17669r17670
907898      return drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
908899
909900   // use pen usage to optimize
910   code %= gfx->total_elements;
911   if (gfx->pen_usage != NULL && !gfx->dirty[code])
901   code %= gfx->elements();
902   if (gfx->has_pen_usage())
912903   {
913904      // fully transparent; do nothing
914      UINT32 usage = gfx->pen_usage[code];
905      UINT32 usage = gfx->pen_usage(code);
915906      if ((usage & ~transmask) == 0)
916907         return;
917908
r17669r17670
921912   }
922913
923914   // render
924   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
915   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
925916   DECLARE_NO_PRIORITY;
926917   DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
927918}
r17669r17670
933924    are transparent, opaque, or shadowing
934925-------------------------------------------------*/
935926
936void drawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
927void drawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
937928      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
938929      UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable)
939930{
r17669r17670
944935      return drawgfx_transtable(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, pentable, shadowtable);
945936
946937   // render
947   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
948   code %= gfx->total_elements;
938   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
939   code %= gfx->elements();
949940   DECLARE_NO_PRIORITY;
950941   DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY);
951942}
952943
953void drawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
944void drawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
954945      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
955946      UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable)
956947{
r17669r17670
961952      return drawgfx_transtable(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, pentable, shadowtable);
962953
963954   // render
964   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
965   code %= gfx->total_elements;
955   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
956   code %= gfx->elements();
966957   DECLARE_NO_PRIORITY;
967958   DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY);
968959}
r17669r17670
974965    the remaining pixels with a fixed alpha value
975966-------------------------------------------------*/
976967
977void drawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
968void drawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
978969      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
979970      UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha)
980971{
r17669r17670
987978      return drawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, transpen);
988979
989980   // early out if completely transparent
990   code %= gfx->total_elements;
991   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
981   code %= gfx->elements();
982   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
992983      return;
993984
994985   // render
995   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
986   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
996987   DECLARE_NO_PRIORITY;
997988   DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY);
998989}
r17669r17670
10091000    bitmap
10101001-------------------------------------------------*/
10111002
1012void pdrawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
1003void pdrawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
10131004      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
10141005      bitmap_ind8 &priority, UINT32 pmask)
10151006{
r17669r17670
10171008   pmask |= 1 << 31;
10181009
10191010   // render
1020   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1021   code %= gfx->total_elements;
1011   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
1012   code %= gfx->elements();
10221013   DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
10231014}
10241015
1025void pdrawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1016void pdrawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
10261017      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
10271018      bitmap_ind8 &priority, UINT32 pmask)
10281019{
r17669r17670
10301021   pmask |= 1 << 31;
10311022
10321023   // render
1033   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1034   code %= gfx->total_elements;
1024   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
1025   code %= gfx->elements();
10351026   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
10361027}
10371028
r17669r17670
10421033    priority bitmap
10431034-------------------------------------------------*/
10441035
1045void pdrawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
1036void pdrawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
10461037      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
10471038      bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen)
10481039{
r17669r17670
10511042      return pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
10521043
10531044   // use pen usage to optimize
1054   code %= gfx->total_elements;
1055   if (gfx->pen_usage != NULL && !gfx->dirty[code])
1045   code %= gfx->elements();
1046   if (gfx->has_pen_usage())
10561047   {
10571048      // fully transparent; do nothing
1058      UINT32 usage = gfx->pen_usage[code];
1049      UINT32 usage = gfx->pen_usage(code);
10591050      if ((usage & ~(1 << transpen)) == 0)
10601051         return;
10611052
r17669r17670
10681059   pmask |= 1 << 31;
10691060
10701061   // render
1071   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1062   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
10721063   DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
10731064}
10741065
1075void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1066void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
10761067      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
10771068      bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen)
10781069{
r17669r17670
10811072      return pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
10821073
10831074   // use pen usage to optimize
1084   code %= gfx->total_elements;
1085   if (gfx->pen_usage != NULL && !gfx->dirty[code])
1075   code %= gfx->elements();
1076   if (gfx->has_pen_usage())
10861077   {
10871078      // fully transparent; do nothing
1088      UINT32 usage = gfx->pen_usage[code];
1079      UINT32 usage = gfx->pen_usage(code);
10891080      if ((usage & ~(1 << transpen)) == 0)
10901081         return;
10911082
r17669r17670
10981089   pmask |= 1 << 31;
10991090
11001091   // render
1101   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1092   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
11021093   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
11031094}
11041095
r17669r17670
11091100    lookups, checking against the priority bitmap
11101101-------------------------------------------------*/
11111102
1112void pdrawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
1103void pdrawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
11131104      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
11141105      bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen)
11151106{
11161107   // early out if completely transparent
1117   code %= gfx->total_elements;
1118   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
1108   code %= gfx->elements();
1109   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
11191110      return;
11201111
11211112   // high bit of the mask is implicitly on
r17669r17670
11251116   DRAWGFX_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8);
11261117}
11271118
1128void pdrawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1119void pdrawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
11291120      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
11301121      bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen)
11311122{
11321123   // early out if completely transparent
1133   code %= gfx->total_elements;
1134   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
1124   code %= gfx->elements();
1125   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
11351126      return;
11361127
11371128   // high bit of the mask is implicitly on
r17669r17670
11481139    a mask, checking against the priority bitmap
11491140-------------------------------------------------*/
11501141
1151void pdrawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
1142void pdrawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
11521143      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
11531144      bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask)
11541145{
r17669r17670
11571148      return pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
11581149
11591150   // use pen usage to optimize
1160   code %= gfx->total_elements;
1161   if (gfx->pen_usage != NULL && !gfx->dirty[code])
1151   code %= gfx->elements();
1152   if (gfx->has_pen_usage())
11621153   {
11631154      // fully transparent; do nothing
1164      UINT32 usage = gfx->pen_usage[code];
1155      UINT32 usage = gfx->pen_usage(code);
11651156      if ((usage & ~transmask) == 0)
11661157         return;
11671158
r17669r17670
11741165   pmask |= 1 << 31;
11751166
11761167   // render
1177   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1168   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
11781169   DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
11791170}
11801171
1181void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1172void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
11821173      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
11831174      bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask)
11841175{
r17669r17670
11871178      return pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
11881179
11891180   // use pen usage to optimize
1190   code %= gfx->total_elements;
1191   if (gfx->pen_usage != NULL && !gfx->dirty[code])
1181   code %= gfx->elements();
1182   if (gfx->has_pen_usage())
11921183   {
11931184      // fully transparent; do nothing
1194      UINT32 usage = gfx->pen_usage[code];
1185      UINT32 usage = gfx->pen_usage(code);
11951186      if ((usage & ~transmask) == 0)
11961187         return;
11971188
r17669r17670
12041195   pmask |= 1 << 31;
12051196
12061197   // render
1207   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1198   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
12081199   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
12091200}
12101201
r17669r17670
12161207    against the priority bitmap
12171208-------------------------------------------------*/
12181209
1219void pdrawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
1210void pdrawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
12201211      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
12211212      bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable)
12221213{
r17669r17670
12261217   pmask |= 1 << 31;
12271218
12281219   // render
1229   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1230   code %= gfx->total_elements;
1220   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
1221   code %= gfx->elements();
12311222   DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8);
12321223}
12331224
1234void pdrawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1225void pdrawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
12351226      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
12361227      bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable)
12371228{
r17669r17670
12411232   pmask |= 1 << 31;
12421233
12431234   // render
1244   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1245   code %= gfx->total_elements;
1235   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
1236   code %= gfx->elements();
12461237   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8);
12471238}
12481239
r17669r17670
12541245    checking against the priority bitmap
12551246-------------------------------------------------*/
12561247
1257void pdrawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1248void pdrawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
12581249      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
12591250      bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha)
12601251{
r17669r17670
12631254      return pdrawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen);
12641255
12651256   // early out if completely transparent
1266   code %= gfx->total_elements;
1267   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
1257   code %= gfx->elements();
1258   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
12681259      return;
12691260
12701261   // high bit of the mask is implicitly on
12711262   pmask |= 1 << 31;
12721263
12731264   // render
1274   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1265   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
12751266   DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8);
12761267}
12771268
r17669r17670
12871278    the priority bitmap
12881279-------------------------------------------------*/
12891280
1290void pdrawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
1281void pdrawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
12911282      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
12921283      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask)
12931284{
r17669r17670
12991290   pmask |= 1 << 31;
13001291
13011292   // render
1302   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1303   code %= gfx->total_elements;
1293   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
1294   code %= gfx->elements();
13041295   DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
13051296}
13061297
1307void pdrawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1298void pdrawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
13081299      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
13091300      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask)
13101301{
r17669r17670
13161307   pmask |= 1 << 31;
13171308
13181309   // render
1319   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1320   code %= gfx->total_elements;
1310   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
1311   code %= gfx->elements();
13211312   DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
13221313}
13231314
r17669r17670
13281319    checking against the priority bitmap
13291320-------------------------------------------------*/
13301321
1331void pdrawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
1322void pdrawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
13321323      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
13331324      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
13341325      UINT32 transpen)
r17669r17670
13421333      return pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
13431334
13441335   // use pen usage to optimize
1345   code %= gfx->total_elements;
1346   if (gfx->pen_usage != NULL && !gfx->dirty[code])
1336   code %= gfx->elements();
1337   if (gfx->has_pen_usage())
13471338   {
13481339      // fully transparent; do nothing
1349      UINT32 usage = gfx->pen_usage[code];
1340      UINT32 usage = gfx->pen_usage(code);
13501341      if ((usage & ~(1 << transpen)) == 0)
13511342         return;
13521343
r17669r17670
13591350   pmask |= 1 << 31;
13601351
13611352   // render
1362   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1353   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
13631354   DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
13641355}
13651356
1366void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1357void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
13671358      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
13681359      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
13691360      UINT32 transpen)
r17669r17670
13771368      return pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
13781369
13791370   // use pen usage to optimize
1380   code %= gfx->total_elements;
1381   if (gfx->pen_usage != NULL && !gfx->dirty[code])
1371   code %= gfx->elements();
1372   if (gfx->has_pen_usage())
13821373   {
13831374      // fully transparent; do nothing
1384      UINT32 usage = gfx->pen_usage[code];
1375      UINT32 usage = gfx->pen_usage(code);
13851376      if ((usage & ~(1 << transpen)) == 0)
13861377         return;
13871378
r17669r17670
13941385   pmask |= 1 << 31;
13951386
13961387   // render
1397   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1388   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
13981389   DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
13991390}
14001391
r17669r17670
14061397    bitmap
14071398-------------------------------------------------*/
14081399
1409void pdrawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
1400void pdrawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
14101401      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
14111402      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
14121403      UINT32 transpen)
r17669r17670
14161407      return pdrawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen);
14171408
14181409   // early out if completely transparent
1419   code %= gfx->total_elements;
1420   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
1410   code %= gfx->elements();
1411   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
14211412      return;
14221413
14231414   // high bit of the mask is implicitly on
r17669r17670
14271418   DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8);
14281419}
14291420
1430void pdrawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1421void pdrawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
14311422      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
14321423      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
14331424      UINT32 transpen)
r17669r17670
14371428      return pdrawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen);
14381429
14391430   // early out if completely transparent
1440   code %= gfx->total_elements;
1441   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
1431   code %= gfx->elements();
1432   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
14421433      return;
14431434
14441435   // high bit of the mask is implicitly on
r17669r17670
14561447    priority bitmap
14571448-------------------------------------------------*/
14581449
1459void pdrawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
1450void pdrawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
14601451      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
14611452      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
14621453      UINT32 transmask)
r17669r17670
14701461      return pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
14711462
14721463   // use pen usage to optimize
1473   code %= gfx->total_elements;
1474   if (gfx->pen_usage != NULL && !gfx->dirty[code])
1464   code %= gfx->elements();
1465   if (gfx->has_pen_usage())
14751466   {
14761467      // fully transparent; do nothing
1477      UINT32 usage = gfx->pen_usage[code];
1468      UINT32 usage = gfx->pen_usage(code);
14781469      if ((usage & ~transmask) == 0)
14791470         return;
14801471
r17669r17670
14871478   pmask |= 1 << 31;
14881479
14891480   // render
1490   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1481   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
14911482   DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
14921483}
14931484
1494void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1485void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
14951486      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
14961487      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
14971488      UINT32 transmask)
r17669r17670
15051496      return pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
15061497
15071498   // use pen usage to optimize
1508   code %= gfx->total_elements;
1509   if (gfx->pen_usage != NULL && !gfx->dirty[code])
1499   code %= gfx->elements();
1500   if (gfx->has_pen_usage())
15101501   {
15111502      // fully transparent; do nothing
1512      UINT32 usage = gfx->pen_usage[code];
1503      UINT32 usage = gfx->pen_usage(code);
15131504      if ((usage & ~transmask) == 0)
15141505         return;
15151506
r17669r17670
15221513   pmask |= 1 << 31;
15231514
15241515   // render
1525   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1516   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
15261517   DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
15271518}
15281519
r17669r17670
15341525    checking against the priority bitmap
15351526-------------------------------------------------*/
15361527
1537void pdrawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx,
1528void pdrawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx,
15381529      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
15391530      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
15401531      const UINT8 *pentable, const pen_t *shadowtable)
r17669r17670
15491540   pmask |= 1 << 31;
15501541
15511542   // render
1552   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1553   code %= gfx->total_elements;
1543   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
1544   code %= gfx->elements();
15541545   DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8);
15551546}
15561547
1557void pdrawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1548void pdrawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
15581549      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
15591550      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
15601551      const UINT8 *pentable, const pen_t *shadowtable)
r17669r17670
15691560   pmask |= 1 << 31;
15701561
15711562   // render
1572   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1573   code %= gfx->total_elements;
1563   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
1564   code %= gfx->elements();
15741565   DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8);
15751566}
15761567
r17669r17670
15831574    bitmap
15841575-------------------------------------------------*/
15851576
1586void pdrawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx,
1577void pdrawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
15871578      UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
15881579      UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
15891580      UINT32 transpen, UINT8 alpha)
r17669r17670
15971588      return pdrawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask, transpen);
15981589
15991590   // early out if completely transparent
1600   code %= gfx->total_elements;
1601   if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
1591   code %= gfx->elements();
1592   if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << transpen)) == 0)
16021593      return;
16031594
16041595   // high bit of the mask is implicitly on
16051596   pmask |= 1 << 31;
16061597
16071598   // render
1608   const pen_t *paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
1599   const pen_t *paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
16091600   DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8);
16101601}
16111602
trunk/src/emu/drawgfx.h
r17669r17670
3131#define EXTENDED_XOFFS         { 0 }
3232#define EXTENDED_YOFFS         { 0 }
3333
34#define GFX_ELEMENT_DONT_FREE   1   /* gfxdata was not malloc()ed, so don't free it on exit */
35
3634#define GFX_RAW             0x12345678
37/* When planeoffset[0] is set to GFX_RAW, the gfx data is left as-is, with no conversion.
38   No buffer is allocated for the decoded data, and gfxdata is set to point to the source
39   data.
40   xoffset[0] is an optional displacement (*8) from the beginning of the source data, while
41   yoffset[0] is the line modulo (*8) and charincrement the char modulo (*8). They are *8
42   for consistency with the usual behaviour, but the bottom 3 bits are not used.
35// When planeoffset[0] is set to GFX_RAW, the gfx data is left as-is, with no conversion.
36// No buffer is allocated for the decoded data, and gfxdata is set to point to the source
37// data.
38// xoffset[0] is an optional displacement (*8) from the beginning of the source data, while
39// yoffset[0] is the line modulo (*8) and charincrement the char modulo (*8). They are *8
40// for consistency with the usual behaviour, but the bottom 3 bits are not used.
4341
44   This special mode can be used to save memory in games that require several different
45   handlings of the same ROM data (e.g. metro.c can use both 4bpp and 8bpp tiles, and both
46   8x8 and 16x16; cps.c has 8x8, 16x16 and 32x32 tiles all fetched from the same ROMs).
47*/
42// This special mode can be used to save memory in games that require several different
43// handlings of the same ROM data (e.g. metro.c can use both 4bpp and 8bpp tiles, and both
44// 8x8 and 16x16; cps.c has 8x8, 16x16 and 32x32 tiles all fetched from the same ROMs).
4845
4946enum
5047{
r17669r17670
5956    MACROS
6057***************************************************************************/
6158
62/* these macros describe gfx_layouts in terms of fractions of a region */
63/* they can be used for total, planeoffset, xoffset, yoffset */
59// these macros describe gfx_layouts in terms of fractions of a region
60// they can be used for total, planeoffset, xoffset, yoffset
6461#define RGN_FRAC(num,den)      (0x80000000 | (((num) & 0x0f) << 27) | (((den) & 0x0f) << 23))
6562#define IS_FRAC(offset)         ((offset) & 0x80000000)
6663#define FRAC_NUM(offset)      (((offset) >> 27) & 0x0f)
6764#define FRAC_DEN(offset)      (((offset) >> 23) & 0x0f)
6865#define FRAC_OFFSET(offset)      ((offset) & 0x007fffff)
6966
70/* these macros are useful in gfx_layouts */
67// these macros are useful in gfx_layouts
7168#define STEP2(START,STEP)      (START),(START)+(STEP)
7269#define STEP4(START,STEP)      STEP2(START,STEP),STEP2((START)+2*(STEP),STEP)
7370#define STEP8(START,STEP)      STEP4(START,STEP),STEP4((START)+4*(STEP),STEP)
r17669r17670
8178#define STEP2048(START,STEP)   STEP1024(START,STEP),STEP1024((START)+1024*(STEP),STEP)
8279
8380
84/* these macros are used for declaring gfx_decode_entry_entry info arrays. */
81// these macros are used for declaring gfx_decode_entry_entry info arrays.
8582#define GFXDECODE_NAME( name ) gfxdecodeinfo_##name
8683#define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry GFXDECODE_NAME(name)[]
8784#define GFXDECODE_START( name ) const gfx_decode_entry GFXDECODE_NAME(name)[] = {
r17669r17670
8986#define GFXDECODE_SCALE(region,offset,layout,start,colors,xscale,yscale) { region, offset, &layout, start, colors, xscale, yscale },
9087#define GFXDECODE_END { 0 } };
9188
92/* these macros are used for declaring gfx_layout structures. */
89// these macros are used for declaring gfx_layout structures.
9390#define GFXLAYOUT_RAW( name, width, height, linemod, charmod ) \
9491const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { linemod }, charmod };
9592
r17669r17670
9996    TYPE DEFINITIONS
10097***************************************************************************/
10198
102typedef struct _gfx_layout gfx_layout;
103struct _gfx_layout
99struct gfx_layout
104100{
105   UINT16         width;            /* pixel width of each element */
106   UINT16         height;            /* pixel height of each element */
107   UINT32         total;            /* total number of elements, or RGN_FRAC() */
108   UINT16         planes;            /* number of bitplanes */
109   UINT32         planeoffset[MAX_GFX_PLANES]; /* bit offset of each bitplane */
110   UINT32         xoffset[MAX_GFX_SIZE]; /* bit offset of each horizontal pixel */
111   UINT32         yoffset[MAX_GFX_SIZE]; /* bit offset of each vertical pixel */
112   UINT32         charincrement;      /* distance between two consecutive elements (in bits) */
113   const UINT32 *   extxoffs;         /* extended X offset array for really big layouts */
114   const UINT32 *   extyoffs;         /* extended Y offset array for really big layouts */
101   UINT32 xoffs(int x) const { return (extxoffs != NULL) ? extxoffs[x] : xoffset[x]; }
102   UINT32 yoffs(int y) const { return (extyoffs != NULL) ? extyoffs[y] : yoffset[y]; }
103
104   UINT16         width;            // pixel width of each element
105   UINT16         height;            // pixel height of each element
106   UINT32         total;            // total number of elements, or RGN_FRAC()
107   UINT16         planes;            // number of bitplanes
108   UINT32         planeoffset[MAX_GFX_PLANES]; // bit offset of each bitplane
109   UINT32         xoffset[MAX_GFX_SIZE]; // bit offset of each horizontal pixel
110   UINT32         yoffset[MAX_GFX_SIZE]; // bit offset of each vertical pixel
111   UINT32         charincrement;      // distance between two consecutive elements (in bits)
112   const UINT32 *   extxoffs;         // extended X offset array for really big layouts
113   const UINT32 *   extyoffs;         // extended Y offset array for really big layouts
115114};
116115
117116
118117class gfx_element
119118{
120119public:
121   gfx_element(running_machine &machine)
122      : m_machine(machine) { }
120   // construction/destruction
121   gfx_element(running_machine &machine);
122   gfx_element(running_machine &machine, const gfx_layout &gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base);
123   gfx_element(running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity);
123124
125   // getters
124126   running_machine &machine() const { return m_machine; }
127   UINT16 width() const { return m_width; }
128   UINT16 height() const { return m_height; }
129   UINT32 elements() const { return m_total_elements; }
130   UINT32 colorbase() const { return m_color_base; }
131   UINT16 depth() const { return m_color_depth; }
132   UINT16 granularity() const { return m_color_granularity; }
133   UINT32 colors() const { return m_total_colors; }
134   UINT32 rowbytes() const { return m_line_modulo; }
135   bool has_pen_usage() const { return (m_pen_usage.count() > 0); }
136   
137   // a bit gross that people muck with this stuff...
138   const UINT8 *srcdata() const { return m_srcdata; }
139   UINT32 dirtyseq() const { return m_dirtyseq; }
140   UINT32 *pen_usage() { return &m_pen_usage[0]; }
125141
126   UINT16         width;            /* current pixel width of each element (changeble with source clipping) */
127   UINT16         height;            /* current pixel height of each element (changeble with source clipping) */
128   UINT16         startx;            /* current source clip X offset */
129   UINT16         starty;            /* current source clip Y offset */
142   // setters
143   void set_layout(const gfx_layout &gl, const UINT8 *srcdata);
144   void set_raw_layout(const UINT8 *srcdata, UINT32 width, UINT32 height, UINT32 total, UINT32 linemod, UINT32 charmod);
145   void set_source(const UINT8 *source) { m_srcdata = source; if (m_layout_is_raw) m_gfxdata = const_cast<UINT8 *>(source); memset(m_dirty, 1, elements()); }
146   void set_colors(UINT32 colors) { m_total_colors = colors; }
147   void set_colorbase(UINT16 colorbase) { m_color_base = colorbase; }
148   void set_granularity(UINT16 granularity) { m_color_granularity = granularity; }
149   void set_source_clip(UINT32 xoffs, UINT32 width, UINT32 yoffs, UINT32 height);
130150
131   UINT16         origwidth;         /* starting pixel width of each element */
132   UINT16         origheight;         /* staring pixel height of each element */
133   UINT8         flags;            /* one of the GFX_ELEMENT_* flags above */
134   UINT32         total_elements;      /* total number of decoded elements */
151   // operations
152   void mark_dirty(UINT32 code) { if (code < elements()) { m_dirty[code] = 1; m_dirtyseq++; } }
153   void mark_all_dirty() { memset(&m_dirty[0], 1, elements()); }
154   void decode(UINT32 code);
135155
136   UINT32         color_base;         /* base color for rendering */
137   UINT16         color_depth;      /* number of colors each pixel can represent */
138   UINT16         color_granularity;   /* number of colors for each color code */
139   UINT32         total_colors;      /* number of color codes */
156   const UINT8 *get_data(UINT32 code)
157   {
158      assert(code < elements());
159      if (m_dirty[code]) decode(code);
160      return m_gfxdata + code * m_char_modulo + m_starty * m_line_modulo + m_startx;
161   }
162   
163   UINT32 pen_usage(UINT32 code)
164   {
165      assert(code < m_pen_usage.count());
166      if (m_dirty[code]) decode(code);
167      return m_pen_usage[code];
168   }
169   
170private:
171   // internal state
172   UINT16         m_width;            // current pixel width of each element (changeble with source clipping)
173   UINT16         m_height;            // current pixel height of each element (changeble with source clipping)
174   UINT16         m_startx;            // current source clip X offset
175   UINT16         m_starty;            // current source clip Y offset
140176
141   UINT32 *      pen_usage;         /* bitmask of pens that are used (pens 0-31 only) */
177   UINT16         m_origwidth;         // starting pixel width of each element
178   UINT16         m_origheight;         // staring pixel height of each element
179   UINT32         m_total_elements;      // total number of decoded elements
142180
143   UINT8 *         gfxdata;         /* pixel data, 8bpp */
144   UINT32         line_modulo;      /* bytes between each row of data */
145   UINT32         char_modulo;      /* bytes between each element */
146   const UINT8 *   srcdata;         /* pointer to the source data for decoding */
147   UINT8 *         dirty;            /* dirty array for detecting tiles that need decoding */
148   UINT32         dirtyseq;         /* sequence number; incremented each time a tile is dirtied */
181   UINT32         m_color_base;         // base color for rendering
182   UINT16         m_color_depth;         // number of colors each pixel can represent
183   UINT16         m_color_granularity;   // number of colors for each color code
184   UINT32         m_total_colors;         // number of color codes
149185
150   gfx_layout      layout;            /* copy of the original layout */
186   UINT32         m_line_modulo;         // bytes between each row of data
187   UINT32         m_char_modulo;         // bytes between each element
188   const UINT8 *   m_srcdata;            // pointer to the source data for decoding
189   UINT32         m_dirtyseq;            // sequence number; incremented each time a tile is dirtied
151190
152private:
153   running_machine &m_machine;         /* pointer to the owning machine */
191   UINT8 *         m_gfxdata;            // pointer to decoded pixel data, 8bpp
192   dynamic_buffer   m_gfxdata_allocated;   // allocated decoded pixel data, 8bpp
193   dynamic_buffer   m_dirty;            // dirty array for detecting chars that need decoding
194   dynamic_array<UINT32> m_pen_usage;      // bitmask of pens that are used (pens 0-31 only)
195
196   bool         m_layout_is_raw;      // raw layout?
197   UINT8         m_layout_planes;      // bit planes in the layout
198   UINT32         m_layout_charincrement;   // per-character increment in source data
199   dynamic_array<UINT32> m_layout_planeoffset;// plane offsets
200   dynamic_array<UINT32> m_layout_xoffset;   // X offsets
201   dynamic_array<UINT32> m_layout_yoffset;   // Y offsets
202
203   running_machine &m_machine;            // pointer to the owning machine
154204};
155205
156206
157207struct gfx_decode_entry
158208{
159   const char *   memory_region;      /* memory region where the data resides */
160   UINT32         start;            /* offset of beginning of data to decode */
161   const gfx_layout *gfxlayout;      /* pointer to gfx_layout describing the layout; NULL marks the end of the array */
162   UINT16         color_codes_start;   /* offset in the color lookup table where color codes start */
163   UINT16         total_color_codes;   /* total number of color codes */
164   UINT8         xscale;            /* optional horizontal scaling factor; 0 means 1x */
165   UINT8         yscale;            /* optional vertical scaling factor; 0 means 1x */
209   const char *   memory_region;      // memory region where the data resides
210   UINT32         start;            // offset of beginning of data to decode
211   const gfx_layout *gfxlayout;      // pointer to gfx_layout describing the layout; NULL marks the end of the array
212   UINT16         color_codes_start;   // offset in the color lookup table where color codes start
213   UINT16         total_color_codes;   // total number of color codes
214   UINT8         xscale;            // optional horizontal scaling factor; 0 means 1x
215   UINT8         yscale;            // optional vertical scaling factor; 0 means 1x
166216};
167217
168218
r17669r17670
172222***************************************************************************/
173223
174224
175/* ----- graphics elements ----- */
225// ----- graphics elements -----
176226
177/* allocate memory for the graphics elements referenced by a machine */
227// allocate memory for the graphics elements referenced by a machine
178228void gfx_init(running_machine &machine);
179229
180/* allocate a gfx_element structure based on a given layout */
181gfx_element *gfx_element_alloc(running_machine &machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base);
182230
183/* update a single code in a gfx_element */
184void gfx_element_decode(const gfx_element *gfx, UINT32 code);
185231
186/* free a gfx_element */
187void gfx_element_free(gfx_element *gfx);
232// ----- core graphics drawing -----
188233
189/* create a temporary one-off gfx_element */
190void gfx_element_build_temporary(gfx_element *gfx, running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags);
234// specific drawgfx implementations for each transparency type
235void drawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty);
236void drawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty);
237void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
238void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
239void drawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
240void drawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
241void drawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask);
242void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask);
243void drawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable);
244void drawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable);
245void drawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen, UINT8 alpha);
191246
192247
193248
194/* ----- core graphics drawing ----- */
249// ----- zoomed graphics drawing -----
195250
196/* specific drawgfx implementations for each transparency type */
197void drawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty);
198void drawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty);
199void drawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
200void drawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
201void drawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
202void drawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
203void drawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask);
204void drawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask);
205void drawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable);
206void drawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable);
207void drawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen, UINT8 alpha);
251// specific drawgfxzoom implementations for each transparency type
252void drawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley);
253void drawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley);
254void drawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
255void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
256void drawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
257void drawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
258void drawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask);
259void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask);
260void drawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable);
261void drawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable);
262void drawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha);
208263
209264
210265
211/* ----- zoomed graphics drawing ----- */
266// ----- priority masked graphics drawing -----
212267
213/* specific drawgfxzoom implementations for each transparency type */
214void drawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley);
215void drawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley);
216void drawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
217void drawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
218void drawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
219void drawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
220void drawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask);
221void drawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask);
222void drawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable);
223void drawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable);
224void drawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha);
268// specific pdrawgfx implementations for each transparency type
269void pdrawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask);
270void pdrawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask);
271void pdrawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
272void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
273void pdrawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
274void pdrawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
275void pdrawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
276void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
277void pdrawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
278void pdrawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
279void pdrawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha);
225280
226281
227282
228/* ----- priority masked graphics drawing ----- */
283// ----- priority masked zoomed graphics drawing -----
229284
230/* specific pdrawgfx implementations for each transparency type */
231void pdrawgfx_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask);
232void pdrawgfx_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask);
233void pdrawgfx_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
234void pdrawgfx_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
235void pdrawgfx_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
236void pdrawgfx_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
237void pdrawgfx_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
238void pdrawgfx_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
239void pdrawgfx_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
240void pdrawgfx_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
241void pdrawgfx_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha);
285// specific pdrawgfxzoom implementations for each transparency type
286void pdrawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask);
287void pdrawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask);
288void pdrawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
289void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
290void pdrawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
291void pdrawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
292void pdrawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
293void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
294void pdrawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
295void pdrawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
296void pdrawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha);
242297
243298
244299
245/* ----- priority masked zoomed graphics drawing ----- */
300// ----- scanline copying -----
246301
247/* specific pdrawgfxzoom implementations for each transparency type */
248void pdrawgfxzoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask);
249void pdrawgfxzoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask);
250void pdrawgfxzoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
251void pdrawgfxzoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
252void pdrawgfxzoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
253void pdrawgfxzoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
254void pdrawgfxzoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
255void pdrawgfxzoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
256void pdrawgfxzoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
257void pdrawgfxzoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
258void pdrawgfxzoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha);
259
260
261
262/* ----- scanline copying ----- */
263
264/* copy pixels from an 8bpp buffer to a single scanline of a bitmap */
302// copy pixels from an 8bpp buffer to a single scanline of a bitmap
265303void draw_scanline8(bitmap_ind16 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT8 *srcptr, const pen_t *paldata);
266304void draw_scanline8(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT8 *srcptr, const pen_t *paldata);
267305
268/* copy pixels from a 16bpp buffer to a single scanline of a bitmap */
306// copy pixels from a 16bpp buffer to a single scanline of a bitmap
269307void draw_scanline16(bitmap_ind16 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT16 *srcptr, const pen_t *paldata);
270308void draw_scanline16(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT16 *srcptr, const pen_t *paldata);
271309
272/* copy pixels from a 32bpp buffer to a single scanline of a bitmap */
310// copy pixels from a 32bpp buffer to a single scanline of a bitmap
273311void draw_scanline32(bitmap_ind16 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, const pen_t *paldata);
274312void draw_scanline32(bitmap_rgb32 &bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, const pen_t *paldata);
275313
276314
277315
278/* ----- scanline extraction ----- */
316// ----- scanline extraction -----
279317
280/* copy pixels from a single scanline of a bitmap to an 8bpp buffer */
318// copy pixels from a single scanline of a bitmap to an 8bpp buffer
281319void extract_scanline8(bitmap_ind16 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT8 *destptr);
282320void extract_scanline8(bitmap_rgb32 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT8 *destptr);
283321
284/* copy pixels from a single scanline of a bitmap to a 16bpp buffer */
322// copy pixels from a single scanline of a bitmap to a 16bpp buffer
285323void extract_scanline16(bitmap_ind16 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT16 *destptr);
286324void extract_scanline16(bitmap_rgb32 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT16 *destptr);
287325
288/* copy pixels from a single scanline of a bitmap to a 32bpp buffer */
326// copy pixels from a single scanline of a bitmap to a 32bpp buffer
289327void extract_scanline32(bitmap_ind16 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT32 *destptr);
290328void extract_scanline32(bitmap_rgb32 &bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT32 *destptr);
291329
292330
293331
294/* ----- bitmap copying ----- */
332// ----- bitmap copying -----
295333
296/* copy from one bitmap to another, copying all unclipped pixels */
334// copy from one bitmap to another, copying all unclipped pixels
297335void copybitmap(bitmap_ind16 &dest, bitmap_ind16 &src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle &cliprect);
298336void copybitmap(bitmap_rgb32 &dest, bitmap_rgb32 &src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle &cliprect);
299337
300/* copy from one bitmap to another, copying all unclipped pixels except those that match transpen */
338// copy from one bitmap to another, copying all unclipped pixels except those that match transpen
301339void copybitmap_trans(bitmap_ind16 &dest, bitmap_ind16 &src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle &cliprect, UINT32 transpen);
302340void copybitmap_trans(bitmap_rgb32 &dest, bitmap_rgb32 &src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle &cliprect, UINT32 transpen);
303341
r17669r17670
313351  scrolls as a whole in at least one direction.
314352*/
315353
316/* copy from one bitmap to another, copying all unclipped pixels, and applying scrolling to one or more rows/columns */
354// copy from one bitmap to another, copying all unclipped pixels, and applying scrolling to one or more rows/columns
317355void copyscrollbitmap(bitmap_ind16 &dest, bitmap_ind16 &src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle &cliprect);
318356void copyscrollbitmap(bitmap_rgb32 &dest, bitmap_rgb32 &src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle &cliprect);
319357
320/* copy from one bitmap to another, copying all unclipped pixels except those that match transpen, and applying scrolling to one or more rows/columns */
358// copy from one bitmap to another, copying all unclipped pixels except those that match transpen, and applying scrolling to one or more rows/columns
321359void copyscrollbitmap_trans(bitmap_ind16 &dest, bitmap_ind16 &src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle &cliprect, UINT32 transpen);
322360void copyscrollbitmap_trans(bitmap_rgb32 &dest, bitmap_rgb32 &src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle &cliprect, UINT32 transpen);
323361
r17669r17670
350388    copy. This is obtained by setting the wraparound parameter to true.
351389*/
352390
353/* copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels */
391// copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels
354392void copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, bitmap_ind16 &src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound);
355393void copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, bitmap_rgb32 &src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound);
356394
357/* copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels whose values do not match transpen */
395// copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels whose values do not match transpen
358396void copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, bitmap_ind16 &src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound, UINT32 transparent_color);
359397void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, bitmap_rgb32 &src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound, UINT32 transparent_color);
360398
r17669r17670
364402    INLINE FUNCTIONS
365403***************************************************************************/
366404
367/*-------------------------------------------------
368    gfx_element_set_source - set a pointer to
369    the source of a gfx_element
370-------------------------------------------------*/
405//-------------------------------------------------
406//  alpha_blend_r16 - alpha blend two 16-bit
407//  5-5-5 RGB pixels
408//-------------------------------------------------
371409
372INLINE void gfx_element_set_source(gfx_element *gfx, const UINT8 *source)
410inline UINT32 alpha_blend_r16(UINT32 d, UINT32 s, UINT8 level)
373411{
374   gfx->srcdata = source;
375   memset(gfx->dirty, 1, gfx->total_elements);
376}
377
378
379/*-------------------------------------------------
380    gfx_element_get_data - return a pointer to
381    the base of the given code within a
382    gfx_element, decoding it if it is dirty
383-------------------------------------------------*/
384
385INLINE const UINT8 *gfx_element_get_data(const gfx_element *gfx, UINT32 code)
386{
387   assert(code < gfx->total_elements);
388   if (gfx->dirty[code])
389      gfx_element_decode(gfx, code);
390   return gfx->gfxdata + code * gfx->char_modulo + gfx->starty * gfx->line_modulo + gfx->startx;
391}
392
393
394/*-------------------------------------------------
395    gfx_element_mark_dirty - mark a code of a
396    gfx_element dirty
397-------------------------------------------------*/
398
399INLINE void gfx_element_mark_dirty(gfx_element *gfx, UINT32 code)
400{
401   if (code < gfx->total_elements)
402   {
403      gfx->dirty[code] = 1;
404      gfx->dirtyseq++;
405   }
406}
407
408
409/*-------------------------------------------------
410    gfx_element_set_source_clip - set a source
411    clipping area to apply to subsequent renders
412-------------------------------------------------*/
413
414INLINE void gfx_element_set_source_clip(gfx_element *gfx, UINT32 xoffs, UINT32 width, UINT32 yoffs, UINT32 height)
415{
416   assert(xoffs < gfx->origwidth);
417   assert(yoffs < gfx->origheight);
418   assert(xoffs + width <= gfx->origwidth);
419   assert(yoffs + height <= gfx->origheight);
420
421   gfx->width = width;
422   gfx->height = height;
423   gfx->startx = xoffs;
424   gfx->starty = yoffs;
425}
426
427
428/*-------------------------------------------------
429    alpha_blend_r16 - alpha blend two 16-bit
430    5-5-5 RGB pixels
431-------------------------------------------------*/
432
433INLINE UINT32 alpha_blend_r16(UINT32 d, UINT32 s, UINT8 level)
434{
435412   int alphad = 256 - level;
436413   return ((((s & 0x001f) * level + (d & 0x001f) * alphad) >> 8)) |
437414         ((((s & 0x03e0) * level + (d & 0x03e0) * alphad) >> 8) & 0x03e0) |
r17669r17670
439416}
440417
441418
442/*-------------------------------------------------
443    alpha_blend_r32 - alpha blend two 32-bit
444    8-8-8 RGB pixels
445-------------------------------------------------*/
419//-------------------------------------------------
420//  alpha_blend_r16 - alpha blend two 32-bit
421//  8-8-8 RGB pixels
422//-------------------------------------------------
446423
447INLINE UINT32 alpha_blend_r32(UINT32 d, UINT32 s, UINT8 level)
424inline UINT32 alpha_blend_r32(UINT32 d, UINT32 s, UINT8 level)
448425{
449426   int alphad = 256 - level;
450427   return ((((s & 0x0000ff) * level + (d & 0x0000ff) * alphad) >> 8)) |
r17669r17670
453430}
454431
455432
456#endif   /* __DRAWGFX_H__ */
433#endif   // __DRAWGFX_H__
trunk/src/emu/drawgfxm.h
r17669r17670
338338
339339        bitmap_t &dest - the bitmap to render to
340340        const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest')
341        const gfx_element *gfx - pointer to the gfx_element to render
341        gfx_element *gfx - pointer to the gfx_element to render
342342        UINT32 code - index of the entry within gfx_element
343343        UINT32 color - index of the color within gfx_element
344344        int flipx - non-zero means render right-to-left instead of left-to-right
r17669r17670
363363      assert(gfx != NULL);                                             \
364364      assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid());                  \
365365      assert(dest.cliprect().contains(cliprect));                              \
366      assert(code < gfx->total_elements);                                    \
366      assert(code < gfx->elements());                                    \
367367                                                                  \
368368      /* ignore empty/invalid cliprects */                                 \
369369      if (cliprect.empty())                                             \
370370         break;                                                      \
371371                                                                  \
372372      /* compute final pixel in X and exit if we are entirely clipped */            \
373      destendx = destx + gfx->width - 1;                                    \
373      destendx = destx + gfx->width() - 1;                                    \
374374      if (destx > cliprect.max_x || destendx < cliprect.min_x)                  \
375375         break;                                                      \
376376                                                                  \
r17669r17670
387387         destendx = cliprect.max_x;                                       \
388388                                                                  \
389389      /* compute final pixel in Y and exit if we are entirely clipped */            \
390      destendy = desty + gfx->height - 1;                                    \
390      destendy = desty + gfx->height() - 1;                                    \
391391      if (desty > cliprect.max_y || destendy < cliprect.min_y)                  \
392392         break;                                                      \
393393                                                                  \
r17669r17670
405405                                                                  \
406406      /* apply X flipping */                                             \
407407      if (flipx)                                                      \
408         srcx = gfx->width - 1 - srcx;                                    \
408         srcx = gfx->width() - 1 - srcx;                                    \
409409                                                                  \
410410      /* apply Y flipping */                                             \
411      dy = gfx->line_modulo;                                             \
411      dy = gfx->rowbytes();                                             \
412412      if (flipy)                                                      \
413413      {                                                            \
414         srcy = gfx->height - 1 - srcy;                                    \
414         srcy = gfx->height() - 1 - srcy;                                    \
415415         dy = -dy;                                                   \
416416      }                                                            \
417417                                                                  \
418418      /* fetch the source data */                                          \
419      srcdata = gfx_element_get_data(gfx, code);                              \
419      srcdata = gfx->get_data(code);                              \
420420                                                                  \
421421      /* compute how many blocks of 4 pixels we have */                     \
422422      UINT32 numblocks = (destendx + 1 - destx) / 4;                        \
423423      UINT32 leftovers = (destendx + 1 - destx) - 4 * numblocks;               \
424424                                                               \
425425      /* adjust srcdata to point to the first source pixel of the row */         \
426      srcdata += srcy * gfx->line_modulo + srcx;                           \
426      srcdata += srcy * gfx->rowbytes() + srcx;                           \
427427                                                               \
428428      /* non-flipped 8bpp case */                                       \
429429      if (!flipx)                                                   \
r17669r17670
509509
510510        bitmap_t &dest - the bitmap to render to
511511        const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest')
512        const gfx_element *gfx - pointer to the gfx_element to render
512        gfx_element *gfx - pointer to the gfx_element to render
513513        UINT32 code - index of the entry within gfx_element
514514        UINT32 color - index of the color within gfx_element
515515        int flipx - non-zero means render right-to-left instead of left-to-right
r17669r17670
543543         break;                                                      \
544544                                                                  \
545545      /* compute scaled size */                                          \
546      dstwidth = (scalex * gfx->width + 0x8000) >> 16;                        \
547      dstheight = (scaley * gfx->height + 0x8000) >> 16;                        \
546      dstwidth = (scalex * gfx->width() + 0x8000) >> 16;                        \
547      dstheight = (scaley * gfx->height() + 0x8000) >> 16;                        \
548548      if (dstwidth < 1 || dstheight < 1)                                    \
549549         break;                                                      \
550550                                                                  \
551551      /* compute 16.16 source steps in dx and dy */                           \
552      dx = (gfx->width << 16) / dstwidth;                                    \
553      dy = (gfx->height << 16) / dstheight;                                 \
552      dx = (gfx->width() << 16) / dstwidth;                                    \
553      dy = (gfx->height() << 16) / dstheight;                                 \
554554                                                                  \
555555      /* compute final pixel in X and exit if we are entirely clipped */            \
556556      destendx = destx + dstwidth - 1;                                    \
r17669r17670
604604      }                                                            \
605605                                                                  \
606606      /* fetch the source data */                                          \
607      srcdata = gfx_element_get_data(gfx, code);                              \
607      srcdata = gfx->get_data(code);                              \
608608                                                                  \
609609      /* compute how many blocks of 4 pixels we have */                     \
610610      UINT32 numblocks = (destendx + 1 - destx) / 4;                        \
r17669r17670
615615      {                                                         \
616616         PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \
617617         PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx);            \
618         const UINT8 *srcptr = srcdata + (srcy >> 16) * gfx->line_modulo;      \
618         const UINT8 *srcptr = srcdata + (srcy >> 16) * gfx->rowbytes();      \
619619         INT32 cursrcx = srcx;                                       \
620620         srcy += dy;                                                \
621621                                                               \
trunk/src/mess/machine/cgenie.c
r17669r17670
576576   state->m_fontram[offset] = data;
577577
578578   /* convert eight pixels */
579   dp = &space->machine().gfx[0]->gfxdata[(256 * 8 + offset) * space->machine().gfx[0]->width];
579   dp = const_cast<UINT8 *>(space->machine().gfx[0]->get_data(256 + offset/8) + (offset % 8) * space->machine().gfx[0]->width());
580580   dp[0] = (data & 0x80) ? 1 : 0;
581581   dp[1] = (data & 0x40) ? 1 : 0;
582582   dp[2] = (data & 0x20) ? 1 : 0;
trunk/src/mess/video/911_vdt.c
r17669r17670
505505void vdt911_refresh(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y)
506506{
507507   vdt_t *vdt = get_safe_token(device);
508   const gfx_element *gfx = device->machine().gfx[vdt->model];
508   gfx_element *gfx = device->machine().gfx[vdt->model];
509509   int height = (vdt->screen_size == char_960) ? 12 : /*25*/24;
510510   int use_8bit_charcodes = USES_8BIT_CHARCODES(vdt);
511511   int address = 0;
trunk/src/mess/video/cbmb.c
r17669r17670
4848//      if( i < 176 || i > 223 )
4949      {
5050         int y;
51         for( y = 0; y < machine.gfx[0]->height; y++ ) {
52            machine.gfx[0]->gfxdata[(i * machine.gfx[0]->height + y) * machine.gfx[0]->width + 8] = 0;
53            machine.gfx[1]->gfxdata[(i * machine.gfx[1]->height + y) * machine.gfx[1]->width + 8] = 0;
51         for( y = 0; y < machine.gfx[0]->height(); y++ ) {
52            *const_cast<UINT8 *>(machine.gfx[0]->get_data(i) + y * machine.gfx[0]->rowbytes() + 8) = 0;
53            *const_cast<UINT8 *>(machine.gfx[1]->get_data(i) + y * machine.gfx[1]->rowbytes() + 8) = 0;
5454         }
5555      }
5656   }
r17669r17670
7171
7272   for( i = 0; i < x_count; i++ ) {
7373      if ( i == cursor_x ) {
74         bitmap.plot_box( device->machine().gfx[state->m_font]->width * i, y, device->machine().gfx[state->m_font]->width, 1, palette[1] );
74         bitmap.plot_box( device->machine().gfx[state->m_font]->width() * i, y, device->machine().gfx[state->m_font]->width(), 1, palette[1] );
7575      } else {
76         drawgfx_opaque( bitmap, cliprect, device->machine().gfx[state->m_font], videoram[(ma+i )& 0x7ff], 0, 0, 0, device->machine().gfx[state->m_font]->width * i, y-ra );
76         drawgfx_opaque( bitmap, cliprect, device->machine().gfx[state->m_font], videoram[(ma+i )& 0x7ff], 0, 0, 0, device->machine().gfx[state->m_font]->width() * i, y-ra );
7777      }
7878   }
7979}
r17669r17670
8787
8888   for( i = 0; i < x_count; i++ ) {
8989      if ( i == cursor_x ) {
90         bitmap.plot_box( device->machine().gfx[state->m_font]->width * i, y, device->machine().gfx[state->m_font]->width, 1, palette[1] );
90         bitmap.plot_box( device->machine().gfx[state->m_font]->width() * i, y, device->machine().gfx[state->m_font]->width(), 1, palette[1] );
9191      } else {
92         drawgfx_opaque( bitmap, cliprect, device->machine().gfx[state->m_font], videoram[(ma+i) & 0x7ff], 0, 0, 0, device->machine().gfx[state->m_font]->width * i, y-ra );
92         drawgfx_opaque( bitmap, cliprect, device->machine().gfx[state->m_font], videoram[(ma+i) & 0x7ff], 0, 0, 0, device->machine().gfx[state->m_font]->width() * i, y-ra );
9393      }
9494   }
9595}
trunk/src/mess/video/iq151_video64.c
r17669r17670
6363   m_videoram = (UINT8*)memregion("videoram")->base();
6464   m_chargen = (UINT8*)memregion("chargen")->base();
6565
66   machine().gfx[0] = gfx_element_alloc(machine(), &iq151_video64_charlayout, m_chargen, 1, 0);
66   machine().gfx[0] = auto_alloc(machine(), gfx_element(machine(), iq151_video64_charlayout, m_chargen, 1, 0));
6767}
6868
6969//-------------------------------------------------
trunk/src/mess/video/mz700.c
r17669r17670
7979VIDEO_START( mz800 )
8080{
8181   mz_state *mz = machine.driver_data<mz_state>();
82   gfx_element_set_source(machine.gfx[0], mz->m_cgram);
82   machine.gfx[0]->set_source(mz->m_cgram);
8383}
8484
8585SCREEN_UPDATE_IND16( mz800 )
r17669r17670
131131{
132132   m_cgram[offset] = data;
133133
134   gfx_element_mark_dirty(machine().gfx[0], offset/8);
134   machine().gfx[0]->mark_dirty(offset/8);
135135}
trunk/src/mess/video/x68k.c
r17669r17670
11441144         break;
11451145
11461146   /* create the char set (gfx will then be updated dynamically from RAM) */
1147   machine.gfx[gfx_index] = gfx_element_alloc(machine, &x68k_pcg_8, machine.root_device().memregion("user1")->base(), 32, 0);
1147   machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, x68k_pcg_8, machine.root_device().memregion("user1")->base(), 32, 0));
11481148
11491149   gfx_index++;
11501150
1151   machine.gfx[gfx_index] = gfx_element_alloc(machine, &x68k_pcg_16, state->memregion("user1")->base(), 32, 0);
1152   machine.gfx[gfx_index]->total_colors = 32;
1151   machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, x68k_pcg_16, state->memregion("user1")->base(), 32, 0));
1152   machine.gfx[gfx_index]->set_colors(32);
11531153
11541154   /* Tilemaps */
11551155   state->m_bg0_8 = tilemap_create(machine, x68k_get_bg0_tile,TILEMAP_SCAN_ROWS,8,8,64,64);
r17669r17670
12111211   {
12121212      if(state->m_video.tile16_dirty[x] != 0)
12131213      {
1214         gfx_element_mark_dirty(screen.machine().gfx[1], x);
1214         screen.machine().gfx[1]->mark_dirty(x);
12151215         state->m_video.tile16_dirty[x] = 0;
12161216      }
12171217      if(state->m_video.tile8_dirty[x] != 0)
12181218      {
1219         gfx_element_mark_dirty(screen.machine().gfx[0], x);
1219         screen.machine().gfx[0]->mark_dirty(x);
12201220         state->m_video.tile8_dirty[x] = 0;
12211221      }
12221222   }
trunk/src/mess/video/apple1.c
r17669r17670
187187   terminal_t *term;
188188   int char_width, char_height;
189189
190   char_width = machine.gfx[gfx]->width;
191   char_height = machine.gfx[gfx]->height;
190   char_width = machine.gfx[gfx]->width();
191   char_height = machine.gfx[gfx]->height();
192192
193193   term = (terminal_t *) auto_alloc_array(machine, char, sizeof(terminal_t) - sizeof(term->mem)
194194      + (num_cols * num_rows * sizeof(termchar_t)));
trunk/src/mess/video/iq151_video32.c
r17669r17670
6363   m_videoram = (UINT8*)memregion("videoram")->base();
6464   m_chargen = (UINT8*)memregion("chargen")->base();
6565
66   machine().gfx[0] = gfx_element_alloc(machine(), &iq151_video32_charlayout, m_chargen, 1, 0);
66   machine().gfx[0] = auto_alloc(machine(), gfx_element(machine(), iq151_video32_charlayout, m_chargen, 1, 0));
6767}
6868
6969//-------------------------------------------------
trunk/src/mess/video/vdc8563.c
r17669r17670
416416         if (vdc8563->dirty[i])
417417         {
418418            drawgfx_opaque(bitmap,rect,machine.gfx[0], vdc8563->ram[i], FRAMECOLOR | (MONOCOLOR << 4), 0, 0,
419                  machine.gfx[0]->width * x + 8, height * y + height);
419                  machine.gfx[0]->width() * x + 8, height * y + height);
420420
421421            if ((vdc8563->cursor_on) && (i == (CRTC6845_CURSOR_POS & vdc8563->mask)))
422422            {
r17669r17670
425425                  k = CRTC6845_CURSOR_BOTTOM - CRTC6845_CURSOR_TOP + 1;
426426
427427               if (k > 0)
428                  bitmap.plot_box(machine.gfx[0]->width * x + 8, height * y + height + CRTC6845_CURSOR_TOP, machine.gfx[0]->width, k, FRAMECOLOR);
428                  bitmap.plot_box(machine.gfx[0]->width() * x + 8, height * y + height + CRTC6845_CURSOR_TOP, machine.gfx[0]->width(), k, FRAMECOLOR);
429429            }
430430
431431            vdc8563->dirty[i] = 0;
r17669r17670
485485                  k = CRTC6845_CURSOR_BOTTOM - CRTC6845_CURSOR_TOP + 1;
486486
487487               if (k > 0)
488                  bitmap.plot_box(machine.gfx[0]->width * x + 8, height * y + height + CRTC6845_CURSOR_TOP, machine.gfx[0]->width,
488                  bitmap.plot_box(machine.gfx[0]->width() * x + 8, height * y + height + CRTC6845_CURSOR_TOP, machine.gfx[0]->width(),
489489                        k, 0x10 | (vdc8563->ram[j] & 0x0f));
490490            }
491491
r17669r17670
524524            if (vdc8563->dirty[k])
525525            {
526526               drawgfx_opaque(bitmap, rect, machine.gfx[1], vdc8563->ram[k], FRAMECOLOR | (MONOCOLOR << 4), 0, 0,
527                     machine.gfx[0]->width * x + 8, height * y + height + j);
527                     machine.gfx[0]->width() * x + 8, height * y + height + j);
528528               vdc8563->dirty[k] = 0;
529529            }
530530         }
r17669r17670
556556      {
557557         if (full_refresh || vdc8563->fontdirty[i])
558558         {
559            gfx_element_mark_dirty(device->machine().gfx[0],i);
559            device->machine().gfx[0]->mark_dirty(i);
560560            vdc8563->fontdirty[i] = 0;
561561         }
562562      }
r17669r17670
572572      int h = CRTC6845_CHAR_LINES;
573573      int height = CRTC6845_CHAR_HEIGHT;
574574
575      bitmap.plot_box(0, 0, device->machine().gfx[0]->width * (w + 2), height, FRAMECOLOR);
575      bitmap.plot_box(0, 0, device->machine().gfx[0]->width() * (w + 2), height, FRAMECOLOR);
576576
577      bitmap.plot_box(0, height, device->machine().gfx[0]->width, height * h, FRAMECOLOR);
577      bitmap.plot_box(0, height, device->machine().gfx[0]->width(), height * h, FRAMECOLOR);
578578
579      bitmap.plot_box(device->machine().gfx[0]->width * (w + 1), height, device->machine().gfx[0]->width, height * h, FRAMECOLOR);
579      bitmap.plot_box(device->machine().gfx[0]->width() * (w + 1), height, device->machine().gfx[0]->width(), height * h, FRAMECOLOR);
580580
581      bitmap.plot_box(0, height * (h + 1), device->machine().gfx[0]->width * (w + 2), height, FRAMECOLOR);
581      bitmap.plot_box(0, height * (h + 1), device->machine().gfx[0]->width() * (w + 2), height, FRAMECOLOR);
582582   }
583583
584584   vdc8563->changed = 0;
trunk/src/mess/drivers/pc88va.c
r17669r17670
540540         if(knj_offset >= 0x50000/2 && knj_offset <= 0x53fff/2) // TODO: there's an area that can be write protected
541541         {
542542            COMBINE_DATA(&knj_ram[knj_offset]);
543            gfx_element_mark_dirty(machine().gfx[0], (knj_offset * 2) / 8);
544            gfx_element_mark_dirty(machine().gfx[1], (knj_offset * 2) / 32);
543            machine().gfx[0]->mark_dirty((knj_offset * 2) / 8);
544            machine().gfx[1]->mark_dirty((knj_offset * 2) / 32);
545545         }
546546      }
547547      break;
trunk/src/mess/drivers/x1.c
r17669r17670
11711171
11721172         pcg_offset &= 0x7ff;
11731173
1174         gfx_element_mark_dirty(machine().gfx[1], pcg_offset >> 3);
1174         machine().gfx[1]->mark_dirty(pcg_offset >> 3);
11751175      }
11761176      else // Compatible Mode
11771177      {
r17669r17670
11881188
11891189         pcg_offset &= 0x7ff;
11901190
1191         gfx_element_mark_dirty(machine().gfx[1], pcg_offset >> 3);
1191         machine().gfx[1]->mark_dirty(pcg_offset >> 3);
11921192      }
11931193   }
11941194}
r17669r17670
24762476   for(i=0;i<0x1800;i++)
24772477   {
24782478      PCG_RAM[i] = 0;
2479      gfx_element_mark_dirty(machine.gfx[1], i >> 3);
2479      machine.gfx[1]->mark_dirty(i >> 3);
24802480   }
24812481
24822482   state->m_is_turbo = 0;
trunk/src/mess/drivers/smc777.c
r17669r17670
312312
313313   pcg[vram_index] = data;
314314
315    gfx_element_mark_dirty(machine().gfx[0], vram_index >> 3);
315    machine().gfx[0]->mark_dirty(vram_index >> 3);
316316}
317317
318318READ8_MEMBER(smc777_state::smc777_fbuf_r)
trunk/src/mess/drivers/mz2500.c
r17669r17670
901901            UINT8 *pcg_ram = memregion("pcg")->base();
902902            pcg_ram[offset] = data;
903903            if((offset & 0x1800) == 0x0000)
904               gfx_element_mark_dirty(machine().gfx[3], (offset) >> 3);
904               machine().gfx[3]->mark_dirty((offset) >> 3);
905905            else
906               gfx_element_mark_dirty(machine().gfx[4], (offset & 0x7ff) >> 3);
906               machine().gfx[4]->mark_dirty((offset & 0x7ff) >> 3);
907907         }
908908         break;
909909      }
trunk/src/mess/drivers/vboy.c
r17669r17670
982982   if(mem_mask & 0xff00)
983983      pcg_ram[(offset<<1)+0] = (data & 0xff00) >> 8;
984984
985   gfx_element_mark_dirty(machine().gfx[0], offset >> 4);
985   machine().gfx[0]->mark_dirty(offset >> 4);
986986   for(i=0;i<0x800;i++)
987      gfx_element_mark_dirty(machine().gfx[0], i);
987      machine().gfx[0]->mark_dirty(i);
988988
989989}
990990
trunk/src/mess/drivers/fp6000.c
r17669r17670
147147{
148148
149149   m_char_rom[offset] = data;
150   gfx_element_mark_dirty(machine().gfx[0], offset >> 4);
150   machine().gfx[0]->mark_dirty(offset >> 4);
151151}
152152
153153WRITE8_MEMBER(fp6000_state::fp6000_6845_address_w)
trunk/src/mess/drivers/pv1000.c
r17669r17670
117117   UINT8 *gfxram = memregion( "gfxram" )->base();
118118
119119   gfxram[ offset ] = data;
120   gfx_element_mark_dirty(machine().gfx[1], offset/32);
120   machine().gfx[1]->mark_dirty(offset/32);
121121}
122122
123123
trunk/src/mess/drivers/a5105.c
r17669r17670
144144{
145145   m_char_rom[m_pcg_addr | m_pcg_internal_addr] = data;
146146
147   gfx_element_mark_dirty(machine().gfx[0], m_pcg_addr >> 3);
147   machine().gfx[0]->mark_dirty(m_pcg_addr >> 3);
148148
149149   m_pcg_internal_addr++;
150150   m_pcg_internal_addr&=7;
trunk/src/mess/drivers/paso1600.c
r17669r17670
170170WRITE8_MEMBER( paso1600_state::paso1600_pcg_w )
171171{
172172   m_p_pcg[offset] = data;
173   gfx_element_mark_dirty(machine().gfx[0], offset >> 3);
173   machine().gfx[0]->mark_dirty(offset >> 3);
174174}
175175
176176WRITE8_MEMBER( paso1600_state::paso1600_6845_address_w )
trunk/src/mess/drivers/jr200.c
r17669r17670
187187   UINT8 *pcg = memregion("pcg")->base();
188188
189189   pcg[offset+0x000] = data;
190   gfx_element_mark_dirty(machine().gfx[1], (offset+0x000) >> 3);
190   machine().gfx[1]->mark_dirty((offset+0x000) >> 3);
191191}
192192
193193WRITE8_MEMBER(jr200_state::jr200_pcg_2_w)
r17669r17670
195195   UINT8 *pcg = memregion("pcg")->base();
196196
197197   pcg[offset+0x400] = data;
198   gfx_element_mark_dirty(machine().gfx[1], (offset+0x400) >> 3);
198   machine().gfx[1]->mark_dirty((offset+0x400) >> 3);
199199}
200200
201201READ8_MEMBER(jr200_state::jr200_bios_char_r)
r17669r17670
212212
213213   /* TODO: writing is presumably controlled by an I/O bit */
214214//  gfx[offset] = data;
215//  gfx_element_mark_dirty(machine().gfx[0], offset >> 3);
215//  machine().gfx[0]->mark_dirty(offset >> 3);
216216}
217217
218218/*
r17669r17670
496496      gfx_ram[i] = gfx_rom[i];
497497
498498   for(i=0;i<0x800;i+=8)
499      gfx_element_mark_dirty(machine.gfx[0], i >> 3);
499      machine.gfx[0]->mark_dirty(i >> 3);
500500}
501501
502502
trunk/src/mess/drivers/supracan.c
r17669r17670
504504      int sprite_xflip = (supracan_vram[i+1] & 0x0800) >> 11;
505505      int sprite_yflip = (supracan_vram[i+1] & 0x0400) >> 10;
506506      //int xscale = (supracan_vram[i+2] & 0xf000) >> 12;
507      const gfx_element *gfx = machine.gfx[region];
507      gfx_element *gfx = machine.gfx[region];
508508
509509
510510
r17669r17670
10961096   write_swapped_byte(offset*2, (data & 0x00ff));
10971097
10981098   // mark tiles of each depth as dirty
1099   gfx_element_mark_dirty(machine().gfx[0], (offset*2)/(64));
1100   gfx_element_mark_dirty(machine().gfx[1], (offset*2)/(32));
1101   gfx_element_mark_dirty(machine().gfx[2], (offset*2)/(16));
1102   gfx_element_mark_dirty(machine().gfx[3], (offset*2)/(512));
1103   gfx_element_mark_dirty(machine().gfx[4], (offset*2)/(8));
1099   machine().gfx[0]->mark_dirty((offset*2)/(64));
1100   machine().gfx[1]->mark_dirty((offset*2)/(32));
1101   machine().gfx[2]->mark_dirty((offset*2)/(16));
1102   machine().gfx[3]->mark_dirty((offset*2)/(512));
1103   machine().gfx[4]->mark_dirty((offset*2)/(8));
11041104
11051105}
11061106
trunk/src/mess/drivers/b16.c
r17669r17670
105105{
106106   m_char_rom[offset] = data;
107107
108   gfx_element_mark_dirty(machine().gfx[0], offset >> 4);
108   machine().gfx[0]->mark_dirty(offset >> 4);
109109}
110110
111111static ADDRESS_MAP_START( b16_map, AS_PROGRAM, 16, b16_state)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team