src/mame/video/atarirle.c
| r13800 | r13801 | |
| 132 | 132 | static void sort_and_render(running_machine &machine, atarirle_data *mo); |
| 133 | 133 | static void compute_checksum(atarirle_data *mo); |
| 134 | 134 | static 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); |
| 136 | 136 | static void draw_rle_zoom(bitmap_t *bitmap, const atarirle_info *gfx, |
| 137 | 137 | UINT32 palette, int sx, int sy, int scalex, int scaley, |
| 138 | | const rectangle *clip); |
| 138 | const rectangle &clip); |
| 139 | 139 | static void draw_rle_zoom_hflip(bitmap_t *bitmap, const atarirle_info *gfx, |
| 140 | 140 | UINT32 palette, int sx, int sy, int scalex, int scaley, |
| 141 | | const rectangle *clip); |
| 141 | const rectangle &clip); |
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | |
| r13800 | r13801 | |
| 832 | 832 | |
| 833 | 833 | /* render to one or both bitmaps */ |
| 834 | 834 | 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); |
| 836 | 836 | 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); |
| 838 | 838 | } |
| 839 | 839 | } |
| 840 | 840 | |
| r13800 | r13801 | |
| 947 | 947 | ---------------------------------------------------------------*/ |
| 948 | 948 | |
| 949 | 949 | void 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) |
| 951 | 951 | { |
| 952 | 952 | UINT32 palettebase = mo->palettebase + color; |
| 953 | 953 | const atarirle_info *info = &mo->info[code]; |
| r13800 | r13801 | |
| 958 | 958 | if (hflip) |
| 959 | 959 | scaled_xoffs = ((xscale * info->width) >> 12) - scaled_xoffs; |
| 960 | 960 | |
| 961 | | //if (clip->min_y == Machine->primary_screen->visible_area().min_y) |
| 961 | //if (clip.min_y == Machine->primary_screen->visible_area().min_y) |
| 962 | 962 | //logerror(" Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n", |
| 963 | 963 | // code, color, hflip, |
| 964 | 964 | // x, -scaled_xoffs, (xscale * info->width) >> 12, |
| r13800 | r13801 | |
| 989 | 989 | |
| 990 | 990 | void draw_rle_zoom(bitmap_t *bitmap, const atarirle_info *gfx, |
| 991 | 991 | UINT32 palette, int sx, int sy, int scalex, int scaley, |
| 992 | | const rectangle *clip) |
| 992 | const rectangle &clip) |
| 993 | 993 | { |
| 994 | 994 | const UINT16 *row_start = gfx->data; |
| 995 | 995 | const UINT16 *table = gfx->table; |
| r13800 | r13801 | |
| 1014 | 1014 | sourcey = dy / 2; |
| 1015 | 1015 | |
| 1016 | 1016 | /* 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) |
| 1020 | 1020 | return; |
| 1021 | 1021 | |
| 1022 | 1022 | /* 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) |
| 1026 | 1026 | return; |
| 1027 | 1027 | |
| 1028 | 1028 | /* top edge clip */ |
| 1029 | | if (sy < clip->min_y) |
| 1029 | if (sy < clip.min_y) |
| 1030 | 1030 | { |
| 1031 | | sourcey += (clip->min_y - sy) * dy; |
| 1032 | | sy = clip->min_y; |
| 1031 | sourcey += (clip.min_y - sy) * dy; |
| 1032 | sy = clip.min_y; |
| 1033 | 1033 | } |
| 1034 | | else if (sy > clip->max_y) |
| 1034 | else if (sy > clip.max_y) |
| 1035 | 1035 | return; |
| 1036 | 1036 | |
| 1037 | 1037 | /* 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) |
| 1041 | 1041 | return; |
| 1042 | 1042 | |
| 1043 | 1043 | /* loop top to bottom */ |
| r13800 | r13801 | |
| 1179 | 1179 | |
| 1180 | 1180 | void draw_rle_zoom_hflip(bitmap_t *bitmap, const atarirle_info *gfx, |
| 1181 | 1181 | UINT32 palette, int sx, int sy, int scalex, int scaley, |
| 1182 | | const rectangle *clip) |
| 1182 | const rectangle &clip) |
| 1183 | 1183 | { |
| 1184 | 1184 | const UINT16 *row_start = gfx->data; |
| 1185 | 1185 | const UINT16 *table = gfx->table; |
| r13800 | r13801 | |
| 1203 | 1203 | sourcey = dy / 2; |
| 1204 | 1204 | |
| 1205 | 1205 | /* 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) |
| 1209 | 1209 | return; |
| 1210 | 1210 | |
| 1211 | 1211 | /* 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) |
| 1215 | 1215 | return; |
| 1216 | 1216 | |
| 1217 | 1217 | /* top edge clip */ |
| 1218 | | if (sy < clip->min_y) |
| 1218 | if (sy < clip.min_y) |
| 1219 | 1219 | { |
| 1220 | | sourcey += (clip->min_y - sy) * dy; |
| 1221 | | sy = clip->min_y; |
| 1220 | sourcey += (clip.min_y - sy) * dy; |
| 1221 | sy = clip.min_y; |
| 1222 | 1222 | } |
| 1223 | | else if (sy > clip->max_y) |
| 1223 | else if (sy > clip.max_y) |
| 1224 | 1224 | return; |
| 1225 | 1225 | |
| 1226 | 1226 | /* 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) |
| 1230 | 1230 | return; |
| 1231 | 1231 | |
| 1232 | 1232 | /* loop top to bottom */ |
src/mame/video/segas32.c
| r13800 | r13801 | |
| 843 | 843 | for (j = 0; j < 5; j++) |
| 844 | 844 | if (i & (1 << sorted[j])) |
| 845 | 845 | { |
| 846 | | const rectangle *cur = &clips[sorted[j]]; |
| 846 | const rectangle &cur = clips[sorted[j]]; |
| 847 | 847 | |
| 848 | 848 | /* 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]) |
| 850 | 850 | { |
| 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; |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | /* otherwise, just append to the list */ |
| 856 | 856 | else |
| 857 | 857 | { |
| 858 | | *extent++ = cur->min_x; |
| 859 | | *extent++ = cur->max_x; |
| 858 | *extent++ = cur.min_x; |
| 859 | *extent++ = cur.max_x; |
| 860 | 860 | } |
| 861 | 861 | } |
| 862 | 862 | |
| r13800 | r13801 | |
| 1613 | 1613 | |
| 1614 | 1614 | #define sprite_draw_pixel_16(trans) \ |
| 1615 | 1615 | /* 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) && \ |
| 1618 | 1618 | pix != trans) \ |
| 1619 | 1619 | { \ |
| 1620 | 1620 | if (!indirect) \ |
| r13800 | r13801 | |
| 1642 | 1642 | |
| 1643 | 1643 | #define sprite_draw_pixel_256(trans) \ |
| 1644 | 1644 | /* 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) && \ |
| 1647 | 1647 | pix != trans) \ |
| 1648 | 1648 | { \ |
| 1649 | 1649 | if (!indirect) \ |
| r13800 | r13801 | |
| 1669 | 1669 | } \ |
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | | static int draw_one_sprite(running_machine &machine, UINT16 *data, int xoffs, int yoffs, const rectangle *clipin, const rectangle *clipout) |
| 1672 | static int draw_one_sprite(running_machine &machine, UINT16 *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout) |
| 1673 | 1673 | { |
| 1674 | 1674 | segas32_state *state = machine.driver_data<segas32_state>(); |
| 1675 | 1675 | static const int transparency_masks[4][4] = |
| r13800 | r13801 | |
| 1788 | 1788 | ytarget = ypos + ydelta * dsth; |
| 1789 | 1789 | |
| 1790 | 1790 | /* adjust target x for clipping */ |
| 1791 | | if (xdelta > 0 && xtarget > clipin->max_x) |
| 1791 | if (xdelta > 0 && xtarget > clipin.max_x) |
| 1792 | 1792 | { |
| 1793 | | xtarget = clipin->max_x + 1; |
| 1793 | xtarget = clipin.max_x + 1; |
| 1794 | 1794 | if (xpos >= xtarget) |
| 1795 | 1795 | goto bail; |
| 1796 | 1796 | } |
| 1797 | | if (xdelta < 0 && xtarget < clipin->min_x) |
| 1797 | if (xdelta < 0 && xtarget < clipin.min_x) |
| 1798 | 1798 | { |
| 1799 | | xtarget = clipin->min_x - 1; |
| 1799 | xtarget = clipin.min_x - 1; |
| 1800 | 1800 | if (xpos <= xtarget) |
| 1801 | 1801 | goto bail; |
| 1802 | 1802 | } |
| r13800 | r13801 | |
| 1805 | 1805 | for (y = ypos; y != ytarget; y += ydelta) |
| 1806 | 1806 | { |
| 1807 | 1807 | /* 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) |
| 1809 | 1809 | { |
| 1810 | | int do_clipout = (y >= clipout->min_y && y <= clipout->max_y); |
| 1810 | int do_clipout = (y >= clipout.min_y && y <= clipout.max_y); |
| 1811 | 1811 | UINT16 *dest = &bitmap->pix16(y); |
| 1812 | 1812 | int xacc = 0; |
| 1813 | 1813 | |
| r13800 | r13801 | |
| 1903 | 1903 | { |
| 1904 | 1904 | /* command 0 = draw sprite */ |
| 1905 | 1905 | 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); |
| 1907 | 1907 | break; |
| 1908 | 1908 | |
| 1909 | 1909 | /* command 1 = set clipping */ |
src/emu/debugint/debugint.c
| r13800 | r13801 | |
| 58 | 58 | MACROS |
| 59 | 59 | ***************************************************************************/ |
| 60 | 60 | |
| 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()) |
| 63 | 63 | #define NX(_dv, _x) ((float) (_x)/(float) (dv)->rt_width) |
| 64 | 64 | #define NY(_dv, _y) ((float) (_y)/(float) (dv)->rt_height) |
| 65 | 65 | |
| r13800 | r13801 | |
| 221 | 221 | INLINE FUNCTIONS |
| 222 | 222 | ***************************************************************************/ |
| 223 | 223 | |
| 224 | | INLINE int rect_get_width(rectangle *r) |
| 225 | | { |
| 226 | | return r->max_x - r->min_x + 1; |
| 227 | | } |
| 228 | | |
| 229 | | INLINE int rect_get_height(rectangle *r) |
| 230 | | { |
| 231 | | return r->max_y - r->min_y + 1; |
| 232 | | } |
| 233 | | |
| 234 | | INLINE void rect_set_width(rectangle *r, int width) |
| 235 | | { |
| 236 | | r->max_x = r->min_x + width - 1; |
| 237 | | } |
| 238 | | |
| 239 | | INLINE void rect_set_height(rectangle *r, int height) |
| 240 | | { |
| 241 | | r->max_y = r->min_y + height - 1; |
| 242 | | } |
| 243 | | |
| 244 | | INLINE 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 | | |
| 255 | 224 | INLINE int dview_is_state(DView *dv, int state) |
| 256 | 225 | { |
| 257 | 226 | return ((dv->state & state) ? TRUE : FALSE); |
| r13800 | r13801 | |
| 321 | 290 | auto_free(dv->machine(), dv); |
| 322 | 291 | } |
| 323 | 292 | |
| 324 | | static void dview_get_rect(DView *dv, int type, rectangle *rect) |
| 293 | static void dview_get_rect(DView *dv, int type, rectangle &rect) |
| 325 | 294 | { |
| 326 | | *rect = dv->bounds; |
| 295 | rect = dv->bounds; |
| 327 | 296 | switch (type) |
| 328 | 297 | { |
| 329 | 298 | case RECT_DVIEW: |
| 330 | 299 | break; |
| 331 | 300 | 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); |
| 336 | 305 | break; |
| 337 | 306 | 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; |
| 342 | 311 | break; |
| 343 | 312 | 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; |
| 348 | 317 | break; |
| 349 | 318 | 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; |
| 354 | 323 | break; |
| 355 | 324 | 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; |
| 360 | 329 | break; |
| 361 | 330 | default: |
| 362 | 331 | assert_always(FALSE, "unknown rectangle type"); |
| r13800 | r13801 | |
| 373 | 342 | { |
| 374 | 343 | rectangle r; |
| 375 | 344 | |
| 376 | | dview_get_rect(dv, rtype, &r); |
| 345 | dview_get_rect(dv, rtype, r); |
| 377 | 346 | ui_draw_outlined_box(dv->container, NX(dv, x + r.min_x), NY(dv, y + r.min_y), |
| 378 | 347 | NX(dv, x + r.min_x + w), NY(dv, y + r.min_y + h), bg); |
| 379 | 348 | } |
| r13800 | r13801 | |
| 382 | 351 | { |
| 383 | 352 | rectangle r; |
| 384 | 353 | |
| 385 | | dview_get_rect(dv, rtype, &r); |
| 354 | dview_get_rect(dv, rtype, r); |
| 386 | 355 | dv->container->add_rect(NX(dv, x + r.min_x), NY(dv, y + r.min_y), |
| 387 | 356 | NX(dv, x + r.min_x + w), NY(dv, y + r.min_y + h), col, |
| 388 | 357 | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| r13800 | r13801 | |
| 392 | 361 | { |
| 393 | 362 | rectangle r; |
| 394 | 363 | |
| 395 | | dview_get_rect(dv, rtype, &r); |
| 364 | dview_get_rect(dv, rtype, r); |
| 396 | 365 | dv->container->add_char( |
| 397 | 366 | NX(dv, x + r.min_x), |
| 398 | 367 | NY(dv, y + r.min_y), |
| 399 | 368 | NY(dv, h), |
| 400 | 369 | 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(), |
| 402 | 371 | col, |
| 403 | 372 | *debug_font, |
| 404 | 373 | ch); |
| r13800 | r13801 | |
| 408 | 377 | { |
| 409 | 378 | rectangle r; |
| 410 | 379 | |
| 411 | | dview_get_rect(dv, type, &r); |
| 380 | dview_get_rect(dv, type, r); |
| 412 | 381 | if (x >= r.min_x && x <= r.max_x && y >= r.min_y && y <= r.max_y) |
| 413 | 382 | return TRUE; |
| 414 | 383 | return FALSE; |
| r13800 | r13801 | |
| 423 | 392 | rectangle r; |
| 424 | 393 | adjustment *sb = &dv->hsb; |
| 425 | 394 | |
| 426 | | dview_get_rect(dv, RECT_DVIEW_HSB, &r); |
| 395 | dview_get_rect(dv, RECT_DVIEW_HSB, r); |
| 427 | 396 | |
| 428 | 397 | 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)); |
| 430 | 399 | |
| 431 | 400 | ts = (r.max_x - r.min_x + 1) - 2 * VSB_WIDTH; |
| 432 | 401 | |
| r13800 | r13801 | |
| 447 | 416 | rectangle r; |
| 448 | 417 | adjustment *sb = &dv->vsb; |
| 449 | 418 | |
| 450 | | dview_get_rect(dv, RECT_DVIEW_VSB, &r); |
| 419 | dview_get_rect(dv, RECT_DVIEW_VSB, r); |
| 451 | 420 | |
| 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)); |
| 454 | 423 | |
| 455 | 424 | ts = (r.max_y - r.min_y + 1) - 2 * HSB_HEIGHT; |
| 456 | 425 | |
| r13800 | r13801 | |
| 466 | 435 | { |
| 467 | 436 | rectangle r; |
| 468 | 437 | |
| 469 | | dview_get_rect(dv, RECT_DVIEW_SIZE, &r); |
| 438 | dview_get_rect(dv, RECT_DVIEW_SIZE, r); |
| 470 | 439 | |
| 471 | 440 | 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)); |
| 473 | 442 | } |
| 474 | 443 | |
| 475 | 444 | static void dview_set_title(DView *dv, astring title) |
| r13800 | r13801 | |
| 487 | 456 | rgb_t col = MAKE_ARGB(0xff,0x00,0x00,0xff); |
| 488 | 457 | rectangle r; |
| 489 | 458 | |
| 490 | | dview_get_rect(dv, RECT_DVIEW_TITLE, &r); |
| 459 | dview_get_rect(dv, RECT_DVIEW_TITLE, r); |
| 491 | 460 | |
| 492 | 461 | if (dv == focus_view) |
| 493 | 462 | col = MAKE_ARGB(0xff,0x00,0x7f,0x00); |
| 494 | 463 | |
| 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); |
| 496 | 465 | |
| 497 | 466 | if (!dv->title) |
| 498 | 467 | return; |
| r13800 | r13801 | |
| 562 | 531 | rectangle r; |
| 563 | 532 | int xt; |
| 564 | 533 | |
| 565 | | dview_get_rect(dv, RECT_DVIEW_HSB, &r); |
| 534 | dview_get_rect(dv, RECT_DVIEW_HSB, r); |
| 566 | 535 | x -= r.min_x; |
| 567 | 536 | |
| 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; |
| 569 | 538 | if (x < VSB_WIDTH) |
| 570 | 539 | sb->value -= sb->step_increment; |
| 571 | | else if (x > rect_get_width(&r) - VSB_WIDTH) |
| 540 | else if (x > r.width() - VSB_WIDTH) |
| 572 | 541 | sb->value += sb->step_increment; |
| 573 | 542 | else if (xt < sb->value) |
| 574 | 543 | sb->value -= sb->page_increment; |
| r13800 | r13801 | |
| 601 | 570 | rectangle r; |
| 602 | 571 | int yt; |
| 603 | 572 | |
| 604 | | dview_get_rect(dv, RECT_DVIEW_VSB, &r); |
| 573 | dview_get_rect(dv, RECT_DVIEW_VSB, r); |
| 605 | 574 | 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; |
| 607 | 576 | |
| 608 | 577 | if (y < HSB_HEIGHT) |
| 609 | 578 | sb->value -= sb->step_increment; |
| 610 | | else if (y > rect_get_height(&r) - HSB_HEIGHT) |
| 579 | else if (y > r.height() - HSB_HEIGHT) |
| 611 | 580 | sb->value += sb->step_increment; |
| 612 | 581 | else if (yt < sb->value) |
| 613 | 582 | sb->value -= sb->page_increment; |
| r13800 | r13801 | |
| 712 | 681 | |
| 713 | 682 | dview_draw_title(dv); |
| 714 | 683 | |
| 715 | | dview_get_rect(dv, RECT_DVIEW_CLIENT, &r); |
| 684 | dview_get_rect(dv, RECT_DVIEW_CLIENT, r); |
| 716 | 685 | |
| 717 | 686 | 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); |
| 720 | 689 | |
| 721 | 690 | /* background first */ |
| 722 | 691 | viewdata = dv->view->viewdata(); |
| r13800 | r13801 | |
| 785 | 754 | dv->container->get_user_settings(rcus); |
| 786 | 755 | rcus.m_xoffset = (float) dv->ofs_x / (float) dv->rt_width; |
| 787 | 756 | 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; |
| 790 | 759 | dv->container->set_user_settings(rcus); |
| 791 | 760 | //printf("%d %d %d %d\n", wpos.min_x, wpos.max_x, wpos.min_y, wpos.max_y); |
| 792 | 761 | |
| r13800 | r13801 | |
| 795 | 764 | |
| 796 | 765 | dv->hsb.visible = 0; |
| 797 | 766 | dv->vsb.visible = 0; |
| 798 | | dview_get_rect(dv, RECT_DVIEW_CLIENT, &r); |
| 767 | dview_get_rect(dv, RECT_DVIEW_CLIENT, r); |
| 799 | 768 | |
| 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); |
| 803 | 772 | |
| 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); |
| 807 | 776 | |
| 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; |
| 810 | 779 | |
| 811 | 780 | vsize.y = size.y - pos.y; |
| 812 | 781 | vsize.x = size.x - pos.x; |
| r13800 | r13801 | |
| 831 | 800 | dv->view->set_visible_size(vsize); |
| 832 | 801 | |
| 833 | 802 | 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; |
| 835 | 804 | |
| 836 | 805 | if(pos.x + span > size.x) |
| 837 | 806 | pos.x = size.x - span; |
| r13800 | r13801 | |
| 848 | 817 | } |
| 849 | 818 | |
| 850 | 819 | 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; |
| 852 | 821 | |
| 853 | 822 | if(pos.y + span > size.y) |
| 854 | 823 | pos.y = size.y - span; |