Previous 15994 Revisions Next

r13801 Saturday 31st December, 2011 at 22:51:14 UTC by Aaron Giles
MESS equivalent of MAME r14884
[src/emu/debugint]debugint.c
[src/emu/sound]cdp1869.c cdp1869.h
[src/emu/video]tms9927.c tms9927.h
[src/lib/util]bitmap.h
[src/mame/video]atarirle.c deco_mlc.c galaxian.c grchamp.c segas32.c

src/mame/video/deco_mlc.c
r13800r13801
6262#endif
6363
6464static void mlc_drawgfxzoom(
65      bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx,
65      bitmap_t *dest_bmp,const rectangle &clip,const 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)
r13800r13801
7979    */
8080
8181   /* KW 991012 -- Added code to force clip to bitmap boundary */
82   if(clip)
83   {
84      myclip = *clip;
85      myclip &= dest_bmp->cliprect();
86      clip=&myclip;
87   }
82   myclip = clip;
83   myclip &= dest_bmp->cliprect();
8884
8985   {
9086      if( gfx )
r13800r13801
131127               y_index = 0;
132128            }
133129
134            if( clip )
135            {
136               if( sx < clip->min_x)
137               { /* clip left */
138                  int pixels = clip->min_x-sx;
139                  sx += pixels;
140                  x_index_base += pixels*dx;
141               }
142               if( sy < clip->min_y )
143               { /* clip top */
144                  int pixels = clip->min_y-sy;
145                  sy += pixels;
146                  y_index += pixels*dy;
147               }
148               /* NS 980211 - fixed incorrect clipping */
149               if( ex > clip->max_x+1 )
150               { /* clip right */
151                  int pixels = ex-clip->max_x-1;
152                  ex -= pixels;
153               }
154               if( ey > clip->max_y+1 )
155               { /* clip bottom */
156                  int pixels = ey-clip->max_y-1;
157                  ey -= pixels;
158               }
130            if( sx < myclip.min_x)
131            { /* clip left */
132               int pixels = myclip.min_x-sx;
133               sx += pixels;
134               x_index_base += pixels*dx;
159135            }
136            if( sy < myclip.min_y )
137            { /* clip top */
138               int pixels = myclip.min_y-sy;
139               sy += pixels;
140               y_index += pixels*dy;
141            }
142            /* NS 980211 - fixed incorrect clipping */
143            if( ex > myclip.max_x+1 )
144            { /* clip right */
145               int pixels = ex-myclip.max_x-1;
146               ex -= pixels;
147            }
148            if( ey > myclip.max_y+1 )
149            { /* clip bottom */
150               int pixels = ey-myclip.max_y-1;
151               ey -= pixels;
152            }
160153
161154            if( ex>sx )
162155            { /* skip if inner loop doesn't draw anything */
r13800r13801
474467//                  rasterDirty=1;
475468
476469            mlc_drawgfxzoom(
477                        /*rasterMode ? temp_bitmap : */bitmap,&user_clip,machine.gfx[0],
470                        /*rasterMode ? temp_bitmap : */bitmap,user_clip,machine.gfx[0],
478471                        tile,tile2,
479472                        color + colorOffset,fx,fy,xbase,ybase,
480473                        0,
src/mame/video/grchamp.c
r13800r13801
121121{
122122   int bgcolor = machine.pens[0];
123123   int sprite_transp = machine.pens[0x24];
124   const rectangle *visarea = machine.primary_screen->visible_area();
124   const rectangle &visarea = machine.primary_screen->visible_area();
125125   int y0 = 240 - state->m_cpu0_out[3];
126126   int x0 = 256 - state->m_cpu0_out[2];
127127   int x,y,sx,sy;
r13800r13801
132132   {
133133      /* draw the current player sprite into a work bitmap */
134134      drawgfx_opaque( state->m_work_bitmap,
135         0,
135         state->m_work_bitmap->cliprect(),
136136         machine.gfx[4],
137137         state->m_cpu0_out[4]&0xf,
138138         1, /* color */
src/mame/video/galaxian.c
r13800r13801
10751075
10761076
10771077#ifdef UNUSED_FUNCTION
1078static int flip_and_clip(rectangle *draw, int xstart, int xend, const rectangle &cliprect)
1078static int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect)
10791079{
10801080   galaxian_state *state = machine.driver_data<galaxian_state>();
1081   *draw = cliprect;
1081   draw = cliprect;
10821082   if (!state->m_flipscreen_x)
10831083   {
1084      draw->min_x = xstart * GALAXIAN_XSCALE;
1085      draw->max_x = xend * GALAXIAN_XSCALE + (GALAXIAN_XSCALE - 1);
1084      draw.min_x = xstart * GALAXIAN_XSCALE;
1085      draw.max_x = xend * GALAXIAN_XSCALE + (GALAXIAN_XSCALE - 1);
10861086   }
10871087   else
10881088   {
1089      draw->min_x = (xend ^ 255) * GALAXIAN_XSCALE;
1090      draw->max_x = (xstart ^ 255) * GALAXIAN_XSCALE + (GALAXIAN_XSCALE - 1);
1089      draw.min_x = (xend ^ 255) * GALAXIAN_XSCALE;
1090      draw.max_x = (xstart ^ 255) * GALAXIAN_XSCALE + (GALAXIAN_XSCALE - 1);
10911091   }
1092   sect_rect(draw, cliprect);
1093   return (draw->min_x <= draw->max_x);
1092   draw &= cliprect;
1093   return (draw.min_x <= draw.max_x);
10941094}
10951095
10961096void amidar_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle &cliprect)
src/mame/video/atarirle.c
r13800r13801
132132static void sort_and_render(running_machine &machine, atarirle_data *mo);
133133static void compute_checksum(atarirle_data *mo);
134134static void draw_rle(atarirle_data *mo, bitmap_t *bitmap, int code, int color, int hflip, int vflip,
135      int x, int y, int xscale, int yscale, const rectangle *clip);
135      int x, int y, int xscale, int yscale, const rectangle &clip);
136136static void draw_rle_zoom(bitmap_t *bitmap, const atarirle_info *gfx,
137137      UINT32 palette, int sx, int sy, int scalex, int scaley,
138      const rectangle *clip);
138      const rectangle &clip);
139139static void draw_rle_zoom_hflip(bitmap_t *bitmap, const atarirle_info *gfx,
140140      UINT32 palette, int sx, int sy, int scalex, int scaley,
141      const rectangle *clip);
141      const rectangle &clip);
142142
143143
144144
r13800r13801
832832
833833            /* render to one or both bitmaps */
834834            if (which == 0)
835               draw_rle(mo, bitmap1, code, color, hflip, 0, x, y, scale, scale, &mo->cliprect);
835               draw_rle(mo, bitmap1, code, color, hflip, 0, x, y, scale, scale, mo->cliprect);
836836            if (bitmap2 && which != 0)
837               draw_rle(mo, bitmap2, code, color, hflip, 0, x, y, scale, scale, &mo->cliprect);
837               draw_rle(mo, bitmap2, code, color, hflip, 0, x, y, scale, scale, mo->cliprect);
838838         }
839839      }
840840
r13800r13801
947947---------------------------------------------------------------*/
948948
949949void draw_rle(atarirle_data *mo, bitmap_t *bitmap, int code, int color, int hflip, int vflip,
950   int x, int y, int xscale, int yscale, const rectangle *clip)
950   int x, int y, int xscale, int yscale, const rectangle &clip)
951951{
952952   UINT32 palettebase = mo->palettebase + color;
953953   const atarirle_info *info = &mo->info[code];
r13800r13801
958958   if (hflip)
959959      scaled_xoffs = ((xscale * info->width) >> 12) - scaled_xoffs;
960960
961//if (clip->min_y == Machine->primary_screen->visible_area().min_y)
961//if (clip.min_y == Machine->primary_screen->visible_area().min_y)
962962//logerror("   Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n",
963963//  code, color, hflip,
964964//  x, -scaled_xoffs, (xscale * info->width) >> 12,
r13800r13801
989989
990990void draw_rle_zoom(bitmap_t *bitmap, const atarirle_info *gfx,
991991      UINT32 palette, int sx, int sy, int scalex, int scaley,
992      const rectangle *clip)
992      const rectangle &clip)
993993{
994994   const UINT16 *row_start = gfx->data;
995995   const UINT16 *table = gfx->table;
r13800r13801
10141014   sourcey = dy / 2;
10151015
10161016   /* left edge clip */
1017   if (sx < clip->min_x)
1018      pixels_to_skip = clip->min_x - sx, xclipped = 1;
1019   if (sx > clip->max_x)
1017   if (sx < clip.min_x)
1018      pixels_to_skip = clip.min_x - sx, xclipped = 1;
1019   if (sx > clip.max_x)
10201020      return;
10211021
10221022   /* right edge clip */
1023   if (ex > clip->max_x)
1024      ex = clip->max_x, xclipped = 1;
1025   else if (ex < clip->min_x)
1023   if (ex > clip.max_x)
1024      ex = clip.max_x, xclipped = 1;
1025   else if (ex < clip.min_x)
10261026      return;
10271027
10281028   /* top edge clip */
1029   if (sy < clip->min_y)
1029   if (sy < clip.min_y)
10301030   {
1031      sourcey += (clip->min_y - sy) * dy;
1032      sy = clip->min_y;
1031      sourcey += (clip.min_y - sy) * dy;
1032      sy = clip.min_y;
10331033   }
1034   else if (sy > clip->max_y)
1034   else if (sy > clip.max_y)
10351035      return;
10361036
10371037   /* bottom edge clip */
1038   if (ey > clip->max_y)
1039      ey = clip->max_y;
1040   else if (ey < clip->min_y)
1038   if (ey > clip.max_y)
1039      ey = clip.max_y;
1040   else if (ey < clip.min_y)
10411041      return;
10421042
10431043   /* loop top to bottom */
r13800r13801
11791179
11801180void draw_rle_zoom_hflip(bitmap_t *bitmap, const atarirle_info *gfx,
11811181      UINT32 palette, int sx, int sy, int scalex, int scaley,
1182      const rectangle *clip)
1182      const rectangle &clip)
11831183{
11841184   const UINT16 *row_start = gfx->data;
11851185   const UINT16 *table = gfx->table;
r13800r13801
12031203   sourcey = dy / 2;
12041204
12051205   /* left edge clip */
1206   if (sx < clip->min_x)
1207      sx = clip->min_x, xclipped = 1;
1208   if (sx > clip->max_x)
1206   if (sx < clip.min_x)
1207      sx = clip.min_x, xclipped = 1;
1208   if (sx > clip.max_x)
12091209      return;
12101210
12111211   /* right edge clip */
1212   if (ex > clip->max_x)
1213      pixels_to_skip = ex - clip->max_x, xclipped = 1;
1214   else if (ex < clip->min_x)
1212   if (ex > clip.max_x)
1213      pixels_to_skip = ex - clip.max_x, xclipped = 1;
1214   else if (ex < clip.min_x)
12151215      return;
12161216
12171217   /* top edge clip */
1218   if (sy < clip->min_y)
1218   if (sy < clip.min_y)
12191219   {
1220      sourcey += (clip->min_y - sy) * dy;
1221      sy = clip->min_y;
1220      sourcey += (clip.min_y - sy) * dy;
1221      sy = clip.min_y;
12221222   }
1223   else if (sy > clip->max_y)
1223   else if (sy > clip.max_y)
12241224      return;
12251225
12261226   /* bottom edge clip */
1227   if (ey > clip->max_y)
1228      ey = clip->max_y;
1229   else if (ey < clip->min_y)
1227   if (ey > clip.max_y)
1228      ey = clip.max_y;
1229   else if (ey < clip.min_y)
12301230      return;
12311231
12321232   /* loop top to bottom */
src/mame/video/segas32.c
r13800r13801
843843         for (j = 0; j < 5; j++)
844844            if (i & (1 << sorted[j]))
845845            {
846               const rectangle *cur = &clips[sorted[j]];
846               const rectangle &cur = clips[sorted[j]];
847847
848848               /* see if this intersects our last extent */
849               if (extent != &list->extent[i][1] && cur->min_x <= extent[-1])
849               if (extent != &list->extent[i][1] && cur.min_x <= extent[-1])
850850               {
851                  if (cur->max_x > extent[-1])
852                     extent[-1] = cur->max_x;
851                  if (cur.max_x > extent[-1])
852                     extent[-1] = cur.max_x;
853853               }
854854
855855               /* otherwise, just append to the list */
856856               else
857857               {
858                  *extent++ = cur->min_x;
859                  *extent++ = cur->max_x;
858                  *extent++ = cur.min_x;
859                  *extent++ = cur.max_x;
860860               }
861861            }
862862
r13800r13801
16131613
16141614#define sprite_draw_pixel_16(trans)                                 \
16151615   /* only draw if onscreen, not 0 or 15 */                        \
1616   if (x >= clipin->min_x && x <= clipin->max_x &&                   \
1617      (!do_clipout || x < clipout->min_x || x > clipout->max_x) &&      \
1616   if (x >= clipin.min_x && x <= clipin.max_x &&                      \
1617      (!do_clipout || x < clipout.min_x || x > clipout.max_x) &&         \
16181618      pix != trans)                                          \
16191619   {                                                      \
16201620      if (!indirect)                                          \
r13800r13801
16421642
16431643#define sprite_draw_pixel_256(trans)                              \
16441644   /* only draw if onscreen, not 0 or 15 */                        \
1645   if (x >= clipin->min_x && x <= clipin->max_x &&                   \
1646      (!do_clipout || x < clipout->min_x || x > clipout->max_x) &&      \
1645   if (x >= clipin.min_x && x <= clipin.max_x &&                      \
1646      (!do_clipout || x < clipout.min_x || x > clipout.max_x) &&         \
16471647      pix != trans)                                          \
16481648   {                                                      \
16491649      if (!indirect)                                          \
r13800r13801
16691669      }                                                   \
16701670   }
16711671
1672static int draw_one_sprite(running_machine &machine, UINT16 *data, int xoffs, int yoffs, const rectangle *clipin, const rectangle *clipout)
1672static int draw_one_sprite(running_machine &machine, UINT16 *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout)
16731673{
16741674   segas32_state *state = machine.driver_data<segas32_state>();
16751675   static const int transparency_masks[4][4] =
r13800r13801
17881788   ytarget = ypos + ydelta * dsth;
17891789
17901790   /* adjust target x for clipping */
1791   if (xdelta > 0 && xtarget > clipin->max_x)
1791   if (xdelta > 0 && xtarget > clipin.max_x)
17921792   {
1793      xtarget = clipin->max_x + 1;
1793      xtarget = clipin.max_x + 1;
17941794      if (xpos >= xtarget)
17951795         goto bail;
17961796   }
1797   if (xdelta < 0 && xtarget < clipin->min_x)
1797   if (xdelta < 0 && xtarget < clipin.min_x)
17981798   {
1799      xtarget = clipin->min_x - 1;
1799      xtarget = clipin.min_x - 1;
18001800      if (xpos <= xtarget)
18011801         goto bail;
18021802   }
r13800r13801
18051805   for (y = ypos; y != ytarget; y += ydelta)
18061806   {
18071807      /* skip drawing if not within the inclusive cliprect */
1808      if (y >= clipin->min_y && y <= clipin->max_y)
1808      if (y >= clipin.min_y && y <= clipin.max_y)
18091809      {
1810         int do_clipout = (y >= clipout->min_y && y <= clipout->max_y);
1810         int do_clipout = (y >= clipout.min_y && y <= clipout.max_y);
18111811         UINT16 *dest = &bitmap->pix16(y);
18121812         int xacc = 0;
18131813
r13800r13801
19031903      {
19041904         /* command 0 = draw sprite */
19051905         case 0:
1906            spritenum += 1 + draw_one_sprite(machine, sprite, xoffs, yoffs, &clipin, &clipout);
1906            spritenum += 1 + draw_one_sprite(machine, sprite, xoffs, yoffs, clipin, clipout);
19071907            break;
19081908
19091909         /* command 1 = set clipping */
src/emu/video/tms9927.c
r13800r13801
188188}
189189
190190
191int tms9927_cursor_bounds(device_t *device, rectangle *bounds)
191int tms9927_cursor_bounds(device_t *device, rectangle &bounds)
192192{
193193   tms9927_state *tms = get_safe_token(device);
194194   int cursorx = CURSOR_CHAR_ADDRESS(tms);
195195   int cursory = CURSOR_ROW_ADDRESS(tms);
196196
197   bounds->min_x = cursorx * tms->hpixels_per_column;
198   bounds->max_x = bounds->min_x + tms->hpixels_per_column - 1;
199   bounds->min_y = cursory * SCANS_PER_DATA_ROW(tms);
200   bounds->max_y = bounds->min_y + SCANS_PER_DATA_ROW(tms) - 1;
197   bounds.min_x = cursorx * tms->hpixels_per_column;
198   bounds.max_x = bounds.min_x + tms->hpixels_per_column - 1;
199   bounds.min_y = cursory * SCANS_PER_DATA_ROW(tms);
200   bounds.max_y = bounds.min_y + SCANS_PER_DATA_ROW(tms) - 1;
201201
202202   return (cursorx < HCOUNT(tms) && cursory <= LAST_DISP_DATA_ROW(tms));
203203}
src/emu/video/tms9927.h
r13800r13801
4949/* other queries */
5050int tms9927_screen_reset(device_t *device);
5151int tms9927_upscroll_offset(device_t *device);
52int tms9927_cursor_bounds(device_t *device, rectangle *bounds);
52int tms9927_cursor_bounds(device_t *device, rectangle &bounds);
5353
5454
5555
src/emu/sound/cdp1869.c
r13800r13801
539539//  draw_line - draw character line
540540//-------------------------------------------------
541541
542void cdp1869_device::draw_line(bitmap_t *bitmap, const rectangle *rect, int x, int y, UINT8 data, int color)
542void cdp1869_device::draw_line(bitmap_t *bitmap, const rectangle &rect, int x, int y, UINT8 data, int color)
543543{
544544   int i;
545545
r13800r13801
583583//  draw_char - draw character
584584//-------------------------------------------------
585585
586void cdp1869_device::draw_char(bitmap_t *bitmap, const rectangle *rect, int x, int y, UINT16 pma)
586void cdp1869_device::draw_char(bitmap_t *bitmap, const rectangle &rect, int x, int y, UINT16 pma)
587587{
588588   UINT8 pmd = read_page_ram_byte(pma);
589589
r13800r13801
597597
598598      int color = get_pen(ccb0, ccb1, pcb);
599599
600      draw_line(bitmap, rect, rect->min_x + x, rect->min_y + y, data, color);
600      draw_line(bitmap, rect, rect.min_x + x, rect.min_y + y, data, color);
601601
602602      y++;
603603
r13800r13801
965965            int x = sx * width;
966966            int y = sy * height;
967967
968            draw_char(bitmap, &screen_rect, x, y, addr);
968            draw_char(bitmap, screen_rect, x, y, addr);
969969
970970            addr++;
971971
src/emu/sound/cdp1869.h
r13800r13801
260260   inline int get_pen(int ccb0, int ccb1, int pcb);
261261
262262   void initialize_palette();
263   void draw_line(bitmap_t *bitmap, const rectangle *rect, int x, int y, UINT8 data, int color);
264   void draw_char(bitmap_t *bitmap, const rectangle *rect, int x, int y, UINT16 pma);
263   void draw_line(bitmap_t *bitmap, const rectangle &rect, int x, int y, UINT8 data, int color);
264   void draw_char(bitmap_t *bitmap, const rectangle &rect, int x, int y, UINT16 pma);
265265
266266private:
267267   devcb_resolved_read_line      m_in_pal_ntsc_func;
src/emu/debugint/debugint.c
r13800r13801
5858    MACROS
5959***************************************************************************/
6060
61//#define NX(_dv, _x) ((float) (_x)/(float)rect_get_width(&(_dv)->bounds))
62//#define NY(_dv, _y) ((float) (_y)/(float)rect_get_height(&(_dv)->bounds))
61//#define NX(_dv, _x) ((float) (_x)/(float)(_dv)->bounds.width())
62//#define NY(_dv, _y) ((float) (_y)/(float)(_dv)->bounds.height())
6363#define NX(_dv, _x) ((float) (_x)/(float) (dv)->rt_width)
6464#define NY(_dv, _y) ((float) (_y)/(float) (dv)->rt_height)
6565
r13800r13801
221221    INLINE FUNCTIONS
222222***************************************************************************/
223223
224INLINE int rect_get_width(rectangle *r)
225{
226   return r->max_x - r->min_x + 1;
227}
228
229INLINE int rect_get_height(rectangle *r)
230{
231   return r->max_y - r->min_y + 1;
232}
233
234INLINE void rect_set_width(rectangle *r, int width)
235{
236   r->max_x = r->min_x + width - 1;
237}
238
239INLINE void rect_set_height(rectangle *r, int height)
240{
241   r->max_y = r->min_y + height - 1;
242}
243
244INLINE void rect_move(rectangle *r, int x, int y)
245{
246   int dx = x - r->min_x;
247   int dy = y - r->min_y;
248
249   r->min_x += dx;
250   r->max_x += dx;
251   r->min_y += dy;
252   r->max_y += dy;
253}
254
255224INLINE int dview_is_state(DView *dv, int state)
256225{
257226   return ((dv->state & state) ? TRUE : FALSE);
r13800r13801
321290   auto_free(dv->machine(), dv);
322291}
323292
324static void dview_get_rect(DView *dv, int type, rectangle *rect)
293static void dview_get_rect(DView *dv, int type, rectangle &rect)
325294{
326   *rect = dv->bounds;
295   rect = dv->bounds;
327296   switch (type)
328297   {
329298   case RECT_DVIEW:
330299      break;
331300   case RECT_DVIEW_CLIENT:
332      rect->min_x += BORDER_XTHICKNESS;
333      rect->max_x -= (BORDER_XTHICKNESS + dv->vsb.visible * VSB_WIDTH);
334      rect->min_y += 2 * BORDER_YTHICKNESS + TITLE_HEIGHT;
335      rect->max_y -= (BORDER_YTHICKNESS + dv->hsb.visible * HSB_HEIGHT);
301      rect.min_x += BORDER_XTHICKNESS;
302      rect.max_x -= (BORDER_XTHICKNESS + dv->vsb.visible * VSB_WIDTH);
303      rect.min_y += 2 * BORDER_YTHICKNESS + TITLE_HEIGHT;
304      rect.max_y -= (BORDER_YTHICKNESS + dv->hsb.visible * HSB_HEIGHT);
336305      break;
337306   case RECT_DVIEW_HSB:
338      rect->min_x += 0;
339      rect->max_x -= /* dv->vsb.visible * */ VSB_WIDTH;
340      rect->min_y = dv->bounds.max_y - HSB_HEIGHT;
341      rect->max_y -= 0;
307      rect.min_x += 0;
308      rect.max_x -= /* dv->vsb.visible * */ VSB_WIDTH;
309      rect.min_y = dv->bounds.max_y - HSB_HEIGHT;
310      rect.max_y -= 0;
342311      break;
343312   case RECT_DVIEW_VSB:
344      rect->min_x = dv->bounds.max_x - VSB_WIDTH;
345      rect->max_x -= 0;
346      rect->min_y += TITLE_HEIGHT;
347      rect->max_y -= /* dv->hsb.visible * */ HSB_HEIGHT;
313      rect.min_x = dv->bounds.max_x - VSB_WIDTH;
314      rect.max_x -= 0;
315      rect.min_y += TITLE_HEIGHT;
316      rect.max_y -= /* dv->hsb.visible * */ HSB_HEIGHT;
348317      break;
349318   case RECT_DVIEW_SIZE:
350      rect->min_x = dv->bounds.max_x - VSB_WIDTH;
351      rect->max_x -= 0;
352      rect->min_y = dv->bounds.max_y - HSB_HEIGHT;
353      rect->max_y -= 0;
319      rect.min_x = dv->bounds.max_x - VSB_WIDTH;
320      rect.max_x -= 0;
321      rect.min_y = dv->bounds.max_y - HSB_HEIGHT;
322      rect.max_y -= 0;
354323      break;
355324   case RECT_DVIEW_TITLE:
356      rect->min_x += 0;
357      rect->max_x -= 0;
358      rect->min_y += 0;
359      rect->max_y = rect->min_y + TITLE_HEIGHT - 1;
325      rect.min_x += 0;
326      rect.max_x -= 0;
327      rect.min_y += 0;
328      rect.max_y = rect.min_y + TITLE_HEIGHT - 1;
360329      break;
361330   default:
362331      assert_always(FALSE, "unknown rectangle type");
r13800r13801
373342{
374343   rectangle r;
375344
376   dview_get_rect(dv, rtype, &r);
345   dview_get_rect(dv, rtype, r);
377346   ui_draw_outlined_box(dv->container, NX(dv, x + r.min_x), NY(dv, y + r.min_y),
378347         NX(dv, x + r.min_x + w), NY(dv, y + r.min_y + h), bg);
379348}
r13800r13801
382351{
383352   rectangle r;
384353
385   dview_get_rect(dv, rtype, &r);
354   dview_get_rect(dv, rtype, r);
386355   dv->container->add_rect(NX(dv, x + r.min_x), NY(dv, y + r.min_y),
387356         NX(dv, x + r.min_x + w), NY(dv, y + r.min_y + h), col,
388357         PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
r13800r13801
392361{
393362   rectangle r;
394363
395   dview_get_rect(dv, rtype, &r);
364   dview_get_rect(dv, rtype, r);
396365   dv->container->add_char(
397366         NX(dv, x + r.min_x),
398367         NY(dv, y + r.min_y),
399368         NY(dv, h),
400369         debug_font_aspect,
401         //(float) rect_get_height(&dv->bounds) / (float) rect_get_width(&dv->bounds), //render_get_ui_aspect(),
370         //(float) dv->bounds.height() / (float) dv->bounds->width(), //render_get_ui_aspect(),
402371         col,
403372         *debug_font,
404373         ch);
r13800r13801
408377{
409378   rectangle r;
410379
411   dview_get_rect(dv, type, &r);
380   dview_get_rect(dv, type, r);
412381   if (x >= r.min_x && x <= r.max_x && y >= r.min_y && y <= r.max_y)
413382      return TRUE;
414383   return FALSE;
r13800r13801
423392   rectangle r;
424393   adjustment *sb = &dv->hsb;
425394
426   dview_get_rect(dv, RECT_DVIEW_HSB, &r);
395   dview_get_rect(dv, RECT_DVIEW_HSB, r);
427396
428397   dview_draw_outlined_box(dv, RECT_DVIEW_HSB, 0, 0, VSB_WIDTH,HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
429   dview_draw_outlined_box(dv, RECT_DVIEW_HSB, rect_get_width(&r) - VSB_WIDTH, 0, VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
398   dview_draw_outlined_box(dv, RECT_DVIEW_HSB, r.width() - VSB_WIDTH, 0, VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
430399
431400   ts = (r.max_x - r.min_x + 1) - 2 * VSB_WIDTH;
432401
r13800r13801
447416   rectangle r;
448417   adjustment *sb = &dv->vsb;
449418
450   dview_get_rect(dv, RECT_DVIEW_VSB, &r);
419   dview_get_rect(dv, RECT_DVIEW_VSB, r);
451420
452   dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, rect_get_height(&r) - HSB_HEIGHT, VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
453   dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, 0,               VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
421   dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, r.height() - HSB_HEIGHT, VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
422   dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, 0,                       VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
454423
455424   ts = (r.max_y - r.min_y + 1) - 2 * HSB_HEIGHT;
456425
r13800r13801
466435{
467436   rectangle r;
468437
469   dview_get_rect(dv, RECT_DVIEW_SIZE, &r);
438   dview_get_rect(dv, RECT_DVIEW_SIZE, r);
470439
471440   dview_draw_outlined_box(dv, RECT_DVIEW_SIZE, 0, 0,
472         rect_get_width(&r),rect_get_height(&r), MAKE_ARGB(0xff, 0xff, 0xff, 0x00));
441         r.width(),r.height(), MAKE_ARGB(0xff, 0xff, 0xff, 0x00));
473442}
474443
475444static void dview_set_title(DView *dv, astring title)
r13800r13801
487456   rgb_t col = MAKE_ARGB(0xff,0x00,0x00,0xff);
488457   rectangle r;
489458
490   dview_get_rect(dv, RECT_DVIEW_TITLE, &r);
459   dview_get_rect(dv, RECT_DVIEW_TITLE, r);
491460
492461   if (dv == focus_view)
493462      col = MAKE_ARGB(0xff,0x00,0x7f,0x00);
494463
495   dview_draw_outlined_box(dv, RECT_DVIEW_TITLE, 0, 0, rect_get_width(&dv->bounds), TITLE_HEIGHT, col);
464   dview_draw_outlined_box(dv, RECT_DVIEW_TITLE, 0, 0, dv->bounds.width(), TITLE_HEIGHT, col);
496465
497466   if (!dv->title)
498467      return;
r13800r13801
562531         rectangle r;
563532         int xt;
564533
565         dview_get_rect(dv, RECT_DVIEW_HSB, &r);
534         dview_get_rect(dv, RECT_DVIEW_HSB, r);
566535         x -= r.min_x;
567536
568         xt = (x - VSB_WIDTH) * (sb->upper - sb->lower) / (rect_get_width(&r) - 2 * dv->vsb.visible * VSB_WIDTH) + sb->lower;
537         xt = (x - VSB_WIDTH) * (sb->upper - sb->lower) / (r.width() - 2 * dv->vsb.visible * VSB_WIDTH) + sb->lower;
569538         if (x < VSB_WIDTH)
570539            sb->value -= sb->step_increment;
571         else if (x > rect_get_width(&r) - VSB_WIDTH)
540         else if (x > r.width() - VSB_WIDTH)
572541            sb->value += sb->step_increment;
573542         else if (xt < sb->value)
574543            sb->value -= sb->page_increment;
r13800r13801
601570         rectangle r;
602571         int yt;
603572
604         dview_get_rect(dv, RECT_DVIEW_VSB, &r);
573         dview_get_rect(dv, RECT_DVIEW_VSB, r);
605574         y -= r.min_y;
606         yt = (y - HSB_HEIGHT) * (sb->upper - sb->lower) / (rect_get_height(&r) - 2 * HSB_HEIGHT) + sb->lower;
575         yt = (y - HSB_HEIGHT) * (sb->upper - sb->lower) / (r.height() - 2 * HSB_HEIGHT) + sb->lower;
607576
608577         if (y < HSB_HEIGHT)
609578            sb->value -= sb->step_increment;
610         else if (y > rect_get_height(&r) - HSB_HEIGHT)
579         else if (y > r.height() - HSB_HEIGHT)
611580            sb->value += sb->step_increment;
612581         else if (yt < sb->value)
613582            sb->value -= sb->page_increment;
r13800r13801
712681
713682   dview_draw_title(dv);
714683
715   dview_get_rect(dv, RECT_DVIEW_CLIENT, &r);
684   dview_get_rect(dv, RECT_DVIEW_CLIENT, r);
716685
717686   dview_draw_outlined_box(dv, RECT_DVIEW_CLIENT, 0, 0,
718         rect_get_width(&r) /*- (dv->vs ? VSB_WIDTH : 0)*/,
719         rect_get_height(&r) /*- (dv->hsb.visible ? HSB_HEIGHT : 0)*/, bg_base);
687         r.width() /*- (dv->vs ? VSB_WIDTH : 0)*/,
688         r.height() /*- (dv->hsb.visible ? HSB_HEIGHT : 0)*/, bg_base);
720689
721690   /* background first */
722691   viewdata = dv->view->viewdata();
r13800r13801
785754   dv->container->get_user_settings(rcus);
786755   rcus.m_xoffset = (float) dv->ofs_x / (float) dv->rt_width;
787756   rcus.m_yoffset = (float) dv->ofs_y / (float) dv->rt_height;
788   rcus.m_xscale = 1.0; //(float) rect_get_width(&dv->bounds) / (float) dv->rt_width;
789   rcus.m_yscale = 1.0; //(float) rect_get_height(&dv->bounds) / (float) dv->rt_height;
757   rcus.m_xscale = 1.0; //(float) dv->bounds.width() / (float) dv->rt_width;
758   rcus.m_yscale = 1.0; //(float) dv->bounds.height() / (float) dv->rt_height;
790759   dv->container->set_user_settings(rcus);
791760   //printf("%d %d %d %d\n", wpos.min_x, wpos.max_x, wpos.min_y, wpos.max_y);
792761
r13800r13801
795764
796765   dv->hsb.visible = 0;
797766   dv->vsb.visible = 0;
798   dview_get_rect(dv, RECT_DVIEW_CLIENT, &r);
767   dview_get_rect(dv, RECT_DVIEW_CLIENT, r);
799768
800   dv->hsb.visible = (size.x * debug_font_width > rect_get_width(&r) ? 1 : 0);
801   dv->vsb.visible = (size.y * debug_font_height > rect_get_height(&r) ? 1 : 0);
802   dview_get_rect(dv, RECT_DVIEW_CLIENT, &r);
769   dv->hsb.visible = (size.x * debug_font_width > r.width() ? 1 : 0);
770   dv->vsb.visible = (size.y * debug_font_height > r.height() ? 1 : 0);
771   dview_get_rect(dv, RECT_DVIEW_CLIENT, r);
803772
804   dv->hsb.visible = (size.x * debug_font_width > rect_get_width(&r) ? 1 : 0);
805   dv->vsb.visible = (size.y * debug_font_height > rect_get_height(&r) ? 1 : 0);
806   dview_get_rect(dv, RECT_DVIEW_CLIENT, &r);
773   dv->hsb.visible = (size.x * debug_font_width > r.width() ? 1 : 0);
774   dv->vsb.visible = (size.y * debug_font_height > r.height() ? 1 : 0);
775   dview_get_rect(dv, RECT_DVIEW_CLIENT, r);
807776
808   col.y = (rect_get_height(&r) - 2 * BORDER_YTHICKNESS /*+ debug_font_height  - 1*/) / debug_font_height;
809   col.x = (rect_get_width(&r) - 2 * BORDER_XTHICKNESS /*+ debug_font_width - 1*/) / debug_font_width;
777   col.y = (r.height() - 2 * BORDER_YTHICKNESS /*+ debug_font_height  - 1*/) / debug_font_height;
778   col.x = (r.width() - 2 * BORDER_XTHICKNESS /*+ debug_font_width - 1*/) / debug_font_width;
810779
811780   vsize.y = size.y - pos.y;
812781   vsize.x = size.x - pos.x;
r13800r13801
831800   dv->view->set_visible_size(vsize);
832801
833802   if(dv->hsb.visible) {
834      int span = (rect_get_width(&r) - 2 * BORDER_XTHICKNESS) / debug_font_width;
803      int span = (r.width() - 2 * BORDER_XTHICKNESS) / debug_font_width;
835804
836805      if(pos.x + span > size.x)
837806         pos.x = size.x - span;
r13800r13801
848817   }
849818
850819   if(dv->vsb.visible) {
851      int span = (rect_get_height(&r) - 2 * BORDER_YTHICKNESS) / debug_font_height;
820      int span = (r.height() - 2 * BORDER_YTHICKNESS) / debug_font_height;
852821
853822      if(pos.y + span > size.y)
854823         pos.y = size.y - span;
src/lib/util/bitmap.h
r13800r13801
100100   bool contains(INT32 x, INT32 y) const { return (x >= min_x && x <= max_x && y >= min_y && y <= max_y); }
101101   INT32 width() const { return max_x + 1 - min_x; }
102102   INT32 height() const { return max_y + 1 - min_y; }
103   
104   // setters
103105   void set(INT32 minx, INT32 maxx, INT32 miny, INT32 maxy) { min_x = minx; max_x = maxx; min_y = miny; max_y = maxy; }
106   void set_width(INT32 width) { max_x = min_x + width - 1; }
107   void set_height(INT32 height) { max_y = min_y + height - 1; }
108   void set_origin(INT32 x, INT32 y) { max_x += x - min_x; max_y += y - min_y; min_x = x; min_y = y; }
104109
105110   // internal state
106111   INT32         min_x;         // minimum X, or left coordinate

Previous 15994 Revisions Next


© 1998-2018 The MESS Team