2
* raster-canvas.c - Raster-based video chip emulation helper.
5
* Andreas Boose <viceteam@t-online.de>
6
* Ettore Perazzoli <ettore@comm2000.it>
8
* This file is part of VICE, the Versatile Commodore Emulator.
9
* See README for copyright notice.
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
34
#include "raster-canvas.h"
37
#include "videoarch.h"
40
inline static void refresh_canvas(raster_t *raster)
42
raster_canvas_area_t *update_area;
47
update_area = raster->update_area;
48
viewport = raster->canvas->viewport;
50
if (update_area->is_null)
55
xx = update_area->xs - viewport->first_x;
56
yy = update_area->ys - viewport->first_line;
57
w = update_area->xe - update_area->xs + 1;
58
h = update_area->ye - update_area->ys + 1;
60
if (video_render_get_fake_pal_state()) {
61
/* if pal emu is activated, more pixels have to be updated */
79
x += raster->canvas->geometry->extra_offscreen_border_left;
81
xx += viewport->x_offset;
82
yy += viewport->y_offset;
84
if ((int)(raster->canvas->draw_buffer->canvas_height) >= yy
85
&& (int)(raster->canvas->draw_buffer->canvas_width) >= xx)
86
video_canvas_refresh(raster->canvas, x, y, xx, yy,
87
MIN(w, (int)(raster->canvas->draw_buffer->canvas_width - xx)),
88
MIN(h, (int)(raster->canvas->draw_buffer->canvas_height - yy)));
90
update_area->is_null = 1;
93
void raster_canvas_handle_end_of_frame(raster_t *raster)
95
if (console_mode || vsid_mode)
98
if (raster->skip_frame)
101
if (!raster->canvas->viewport->update_canvas)
104
if (raster->dont_cache)
105
video_canvas_refresh_all(raster->canvas);
107
refresh_canvas(raster);
110
void raster_canvas_init(raster_t *raster)
112
raster->update_area = (raster_canvas_area_t *)lib_malloc(
113
sizeof(raster_canvas_area_t));
115
raster->update_area->is_null = 1;
118
void raster_canvas_shutdown(raster_t *raster)
120
lib_free(raster->update_area);