Copyright 1999, Be Incorporated. All Rights Reserved.
This file may be used under the terms of the Be Sample Code License.
Other authors:
Rudolf Cornelissen 4/2003-11/2004
*/
#define MODULE_BIT 0x20000000
#include "acc_std.h"
status_t SET_CURSOR_SHAPE(uint16 width, uint16 height, uint16 hot_x, uint16 hot_y, uint8 *andMask, uint8 *xorMask)
{
LOG(4,("SET_CURSOR_SHAPE: width %d, height %d, hot_x %d, hot_y %d\n",
width, height, hot_x, hot_y));
if ((width != 16) || (height != 16))
{
return B_ERROR;
}
else if ((hot_x >= width) || (hot_y >= height))
{
return B_ERROR;
}
else
{
nm_crtc_cursor_define(andMask,xorMask);
si->cursor.width = width;
si->cursor.height = height;
si->cursor.hot_x = hot_x;
si->cursor.hot_y = hot_y;
}
return B_OK;
}
void MOVE_CURSOR(uint16 x, uint16 y)
{
uint16 hds = si->dm.h_display_start;
uint16 vds = si->dm.v_display_start;
uint16 h_adjust;
uint16 h_display = si->dm.timing.h_display;
uint16 v_display = si->dm.timing.v_display;
if (x >= si->dm.virtual_width) x = si->dm.virtual_width - 1;
if (y >= si->dm.virtual_height) y = si->dm.virtual_height - 1;
si->cursor.x = x;
si->cursor.y = y;
* Neomagic cards can always do pixelprecise panning */
h_adjust = 0x00;
if (nm_general_output_read() & 0x02)
{
if (h_display > si->ps.panel_width) h_display = si->ps.panel_width;
if (v_display > si->ps.panel_height) v_display = si->ps.panel_height;
}
if (x >= (h_display + hds))
{
hds = ((x - h_display) + 1 + h_adjust) & ~h_adjust;
if ((hds + h_display) > si->dm.virtual_width)
hds -= (h_adjust + 1);
}
else if (x < hds)
hds = x & ~h_adjust;
if (y >= (v_display + vds))
vds = y - v_display + 1;
else if (y < vds)
vds = y;
if ((hds!=si->dm.h_display_start) || (vds!=si->dm.v_display_start))
{
MOVE_DISPLAY(hds,vds);
nm_bes_move_overlay();
}
if (x > (hds + si->cursor.hot_x)) x -= hds + si->cursor.hot_x;
else x = 0;
if (y > (vds + si->cursor.hot_y)) y -= vds + si->cursor.hot_y;
else y = 0;
nm_crtc_cursor_position(x,y);
}
void SHOW_CURSOR(bool is_visible)
{
si->cursor.is_visible = is_visible;
if (is_visible)
nm_crtc_cursor_show();
else
nm_crtc_cursor_hide();
}