You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
3.9 KiB

U0 _Z7dc_blotmmmm() {
// dc_blot(unsigned long, unsigned long, unsigned long, unsigned long)
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: dc_blot(0x%08x, %d, %d, 0x%08x)\n", p0, p1, p2, p3);
GrBlot(p0, p1, p2, p3);
POP_SYSV_REGS
}
U0 @dc_copy(CDC *dest, I64 x, I64 y, CDC *src) {
// If position is off-screen, return
if (x > dest->width - 1 || y > dest->height - 1)
return;
// If device context dimensions match, MemCpy and return
if (dest->width_internal == src->width_internal &&
dest->height == src->height) {
MemCpy(dest->body, src->body, dest->width_internal * dest->height);
return;
}
CDC *dc1 = DCAlias(dest);
CDC *dc2 = DCAlias(src);
I64 src_line = 0;
I64 src_row = 0;
I64 clip_y = 0;
// Handle horizontal clipping left
while (x < 0) {
dc2->x0++;
x++;
}
// Handle vertical clipping top
while (y < 0) {
dc2->body += src->width_internal;
dc2->y0++;
y++;
}
// default, clip line to copy as width-left off screen
src_line = src->width - dc2->x0;
if (-dc2->x0 + x + src->width >= dest->width) {
src_line -= ((-dc2->x0 + x + src->width) - dest->width);
}
dc2->body += dc2->x0;
clip_y = y;
while (src_row < (src->height - dc2->y0) && clip_y < dest->height) {
MemCpy(dc1->body + (y * dest->width) + x, dc2->body, src_line);
dc2->body += src->width_internal;
dc1->body += dest->width_internal;
clip_y++;
src_row++;
}
Free(dc2);
Free(dc1);
}
U0 _Z7dc_copymmmm() {
// dc_copy(unsigned long, unsigned long, unsigned long, unsigned long)
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: dc_copy(0x%08x, %d, %d, 0x%08x)\n", p0, p1, p2, p3);
@dc_copy(p0, p1, p2, p3);
POP_SYSV_REGS
}
U0 _Z7dc_fillmm() {
// dc_fill(unsigned long, unsigned long)
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: dc_fill(0x%08x, %d\n", p0, p1);
DCFill(p0, p1);
POP_SYSV_REGS
}
CDC *@dc_gr_dc_alias(I64 *width, I64 *height) {
// CDC *dc = DCAlias(gr.dc);
CDC *dc = gr.dc;
if (dc) {
*width = dc->width;
*height = dc->height;
}
return dc;
}
U0 _Z14dc_gr_dc_aliasPlS_() {
// dc_gr_dc_alias(long*, long*)
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: dc_gr_dc_alias(0x%08x, 0x%08x)\n", p0, p1);
@dc_gr_dc_alias(p0, p1);
POP_SYSV_REGS
}
CDC *@dc_integer_scale(CDC *dc, I64 scale_factor, I64 *dc_width,
I64 *dc_height) {
if (scale_factor < 2)
return dc;
CDC *dc2 = DCNew(dc->width * scale_factor, dc->height * scale_factor);
I64 x;
I64 y;
for (y = 0; y < dc->height; y++)
for (x = 0; x < dc->width; x++) {
dc2->color = GrPeek(dc, x, y);
GrRect(dc2, x * scale_factor, y * scale_factor, scale_factor,
scale_factor);
}
DCDel(dc);
*dc_width = dc2->width;
*dc_height = dc2->height;
return dc2;
}
U0 _Z16dc_integer_scalemlPlS_() {
// dc_integer_scale(unsigned long, long, long*, long*)
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: dc_integer_scale(0x%08x, %d, 0x%08x, 0x%08x)\n", p0, p1,
p2, p3);
@dc_integer_scale(p0, p1, p2, p3);
POP_SYSV_REGS
}
CDC *@dc_load_from_file(U8 *filename, I64 *width, I64 *height) {
CDC *dc = GRRead(filename);
if (dc) {
*width = dc->width;
*height = dc->height;
}
return dc;
}
U0 _Z17dc_load_from_filePKcPlS1_() {
// dc_load_from_file(char const*, long*, long*)
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: dc_load_from_file(%s, 0x%08x, 0x%08x)\n", p0, p1, p2);
@dc_load_from_file(p0, p1, p2);
POP_SYSV_REGS
}
U0 _Z6dc_newmm() {
// dc_new(unsigned long, unsigned long)
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: dc_new(%d, %d)\n", p0, p1);
DCNew(p0, p1);
POP_SYSV_REGS
}
U0 _Z16dc_replace_colormmm() {
// dc_replace_color(unsigned long, unsigned long, unsigned long)
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: dc_replace_color(0x%08x, %d, %d)\n", p0, p1, p2);
DCColorChg(p0, p1, p2);
POP_SYSV_REGS
}