Changeset View
Changeset View
Standalone View
Standalone View
stand/common/gfx_fb.c
| Show First 20 Lines • Show All 1,394 Lines • ▼ Show 20 Lines | gfx_fb_copy_area(teken_gfx_t *state, const teken_rect_t *s, | ||||
| * be the source of a copy was previously drawn through the shadow, so | * be the source of a copy was previously drawn through the shadow, so | ||||
| * reading from it here is always valid. Mark the destination dirty so | * reading from it here is always valid. Mark the destination dirty so | ||||
| * gfx_fb_flush() will push it to the real framebuffer. | * gfx_fb_flush() will push it to the real framebuffer. | ||||
| */ | */ | ||||
| step = 1; | step = 1; | ||||
| pitch = state->tg_fb.fb_width; | pitch = state->tg_fb.fb_width; | ||||
| bytes = width * sizeof (*state->tg_shadow_fb); | bytes = width * sizeof (*state->tg_shadow_fb); | ||||
| uint32_t dst_x = dx + state->tg_origin.tp_col; | uint32_t ssx = sx + state->tg_origin.tp_col; | ||||
| uint32_t dst_y = dy + state->tg_origin.tp_row; | uint32_t ssy = sy + state->tg_origin.tp_row; | ||||
| uint32_t dsx = dx + state->tg_origin.tp_col; | |||||
| uint32_t dsy = dy + state->tg_origin.tp_row; | |||||
| uint32_t dst_x = dsx; | |||||
| uint32_t dst_y = dsy; | |||||
| uint32_t dst_h = height; | uint32_t dst_h = height; | ||||
| /* | /* | ||||
| * To handle overlapping areas, set up reverse copy here. | * To handle overlapping areas, set up reverse copy here. | ||||
| * The origin offset cancels out in the comparison so the | |||||
| * terminal-relative form is equivalent. | |||||
| */ | */ | ||||
| if (dy * pitch + dx > sy * pitch + sx) { | if (dy * pitch + dx > sy * pitch + sx) { | ||||
| sy += height; | ssy += height; | ||||
| dy += height; | dsy += height; | ||||
| step = -step; | step = -step; | ||||
| } | } | ||||
| while (height-- > 0) { | while (height-- > 0) { | ||||
| uint32_t *source = &state->tg_shadow_fb[sy * pitch + sx]; | uint32_t *source = &state->tg_shadow_fb[ssy * pitch + ssx]; | ||||
| uint32_t *destination = &state->tg_shadow_fb[dy * pitch + dx]; | uint32_t *destination = &state->tg_shadow_fb[dsy * pitch + dsx]; | ||||
| bcopy(source, destination, bytes); | bcopy(source, destination, bytes); | ||||
| sy += step; | ssy += step; | ||||
| dy += step; | dsy += step; | ||||
| } | } | ||||
| gfx_shadow_mark_dirty(dst_x, dst_y, width, dst_h); | gfx_shadow_mark_dirty(dst_x, dst_y, width, dst_h); | ||||
| } | } | ||||
| static void | static void | ||||
| gfx_fb_copy_line(teken_gfx_t *state, int ncol, teken_pos_t *s, teken_pos_t *d) | gfx_fb_copy_line(teken_gfx_t *state, int ncol, teken_pos_t *s, teken_pos_t *d) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | #endif | ||||
| /* | /* | ||||
| * If we do have shadow fb, render into it only. The caller is | * If we do have shadow fb, render into it only. The caller is | ||||
| * responsible for flushing the dirty region to the real framebuffer | * responsible for flushing the dirty region to the real framebuffer | ||||
| * via gfx_fb_flush() once a logical output operation is complete. | * via gfx_fb_flush() once a logical output operation is complete. | ||||
| */ | */ | ||||
| if (gfx_state.tg_shadow_fb != NULL) { | if (gfx_state.tg_shadow_fb != NULL) { | ||||
| uint32_t pitch = gfx_state.tg_fb.fb_width; | uint32_t pitch = gfx_state.tg_fb.fb_width; | ||||
| uint32_t sy = y - gfx_state.tg_origin.tp_row; | |||||
| uint32_t sx = x - gfx_state.tg_origin.tp_col; | |||||
| p = data; | p = data; | ||||
| for (uint32_t row = 0; row < height; row++) { | for (uint32_t row = 0; row < height; row++) { | ||||
| buf = (void *)(gfx_state.tg_shadow_fb + | buf = (void *)(gfx_state.tg_shadow_fb + | ||||
| (sy + row) * pitch + sx); | (y + row) * pitch + x); | ||||
| bitmap_cpy(buf, &p[row * width], width); | bitmap_cpy(buf, &p[row * width], width); | ||||
| } | } | ||||
| gfx_shadow_mark_dirty(x, y, width, height); | gfx_shadow_mark_dirty(x, y, width, height); | ||||
| return; | return; | ||||
| } | } | ||||
| /* | /* | ||||
| * Common data to display is glyph, use preallocated | * Common data to display is glyph, use preallocated | ||||
| ▲ Show 20 Lines • Show All 1,701 Lines • Show Last 20 Lines | |||||