mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-24 11:30:52 +00:00
force redraw
This commit is contained in:
parent
a11a61e48c
commit
4229c59e8b
@ -73,6 +73,7 @@ static uint32 rootless_proc_ptr = 0;
|
||||
static uint32 low_mem_map = 0;
|
||||
static bool dragging_region = false;
|
||||
static uint32 drag_region_ptr = 0;
|
||||
static size_t mask_n = 0;
|
||||
|
||||
static void MyPatchTrap(int trap, uint32 ptr) {
|
||||
M68kRegisters r;
|
||||
@ -368,16 +369,16 @@ void WalkLayerHierarchy(uint32 layerPtr, int level, std::vector<SDL_Rect> &mask_
|
||||
if (nextWindow) WalkLayerHierarchy(nextWindow, level, mask_rects);
|
||||
}
|
||||
|
||||
void update_display_mask(SDL_Window *window, int w, int h) {
|
||||
bool update_display_mask(SDL_Window *window, int w, int h) {
|
||||
if (rootless_proc_ptr == 0) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for process manager
|
||||
uint32 expandMem = ReadMacInt32(0x02B6);
|
||||
uint16 emProcessMgrExists = ReadMacInt16(expandMem + 0x0128);
|
||||
if (!emProcessMgrExists) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read lowmem mapping
|
||||
@ -474,6 +475,10 @@ void update_display_mask(SDL_Window *window, int w, int h) {
|
||||
|
||||
extern void update_window_mask_rects(SDL_Window * window, int h, const std::vector<SDL_Rect> &rects);
|
||||
update_window_mask_rects(window, display_mask.h, mask_rects);
|
||||
|
||||
bool f = mask_rects.size() > mask_n;
|
||||
mask_n = mask_rects.size();
|
||||
return f;
|
||||
}
|
||||
|
||||
void apply_display_mask(SDL_Surface * host_surface, SDL_Rect update_rect) {
|
||||
|
@ -66,9 +66,11 @@
|
||||
#include "vm_alloc.h"
|
||||
|
||||
#ifdef VIDEO_ROOTLESS
|
||||
extern void update_display_mask(SDL_Window * window, int w, int h);
|
||||
extern bool update_display_mask(SDL_Window * window, int w, int h);
|
||||
extern void apply_display_mask(SDL_Surface * host_surface, SDL_Rect update_rect);
|
||||
extern bool cursor_point_opaque(void);
|
||||
static bool force_redraw = false;
|
||||
static spinlock_t force_redraw_lock = SPIN_LOCK_UNLOCKED;
|
||||
#endif
|
||||
|
||||
#define DEBUG 0
|
||||
@ -1733,7 +1735,9 @@ void VideoInterrupt(void)
|
||||
do_toggle_fullscreen();
|
||||
|
||||
#ifdef VIDEO_ROOTLESS
|
||||
update_display_mask(sdl_window, host_surface->w, host_surface->h);
|
||||
spin_lock(&force_redraw_lock);
|
||||
force_redraw |= update_display_mask(sdl_window, host_surface->w, host_surface->h);
|
||||
spin_unlock(&force_redraw_lock);
|
||||
#endif
|
||||
present_sdl_video();
|
||||
|
||||
@ -2391,6 +2395,13 @@ static void update_display_static(driver_base *drv)
|
||||
// XXX use NQD bounding boxes to help detect dirty areas?
|
||||
static void update_display_static_bbox(driver_base *drv)
|
||||
{
|
||||
#ifdef VIDEO_ROOTLESS
|
||||
spin_lock(&force_redraw_lock);
|
||||
bool redraw = force_redraw;
|
||||
force_redraw = false;
|
||||
spin_unlock(&force_redraw_lock);
|
||||
#endif
|
||||
|
||||
const VIDEO_MODE &mode = drv->mode;
|
||||
|
||||
// Allocate bounding boxes for SDL_UpdateRects()
|
||||
@ -2422,7 +2433,11 @@ static void update_display_static_bbox(driver_base *drv)
|
||||
for (uint32 j = y; j < (y + h); j++) {
|
||||
const uint32 yb = j * bytes_per_row;
|
||||
const uint32 dst_yb = j * dst_bytes_per_row;
|
||||
#ifdef VIDEO_ROOTLESS
|
||||
if (redraw || memcmp(&the_buffer[yb + xb], &the_buffer_copy[yb + xb], xs) != 0) {
|
||||
#else
|
||||
if (memcmp(&the_buffer[yb + xb], &the_buffer_copy[yb + xb], xs) != 0) {
|
||||
#endif
|
||||
memcpy(&the_buffer_copy[yb + xb], &the_buffer[yb + xb], xs);
|
||||
Screen_blit((uint8 *)drv->s->pixels + dst_yb + xb, the_buffer + yb + xb, xs);
|
||||
dirty = true;
|
||||
|
Loading…
Reference in New Issue
Block a user