From 530ed456558ed75e7b011b46690718f3090d724e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 27 Sep 2010 19:42:28 +0900 Subject: [PATCH] Get the timing write for when to restore the rects. --- tools/Forge/Bundles/MapEdit/CameraView.m | 11 +++++++---- tools/Forge/Bundles/MapEdit/QuakeEd.h | 5 +++++ tools/Forge/Bundles/MapEdit/QuakeEd.m | 17 +++++++++++++++- tools/Forge/Bundles/MapEdit/XYView.m | 25 +++++++++++++----------- tools/Forge/Bundles/MapEdit/ZView.m | 10 ++++++---- 5 files changed, 48 insertions(+), 20 deletions(-) diff --git a/tools/Forge/Bundles/MapEdit/CameraView.m b/tools/Forge/Bundles/MapEdit/CameraView.m index 61ecf1d30..e39fb8bd8 100644 --- a/tools/Forge/Bundles/MapEdit/CameraView.m +++ b/tools/Forge/Bundles/MapEdit/CameraView.m @@ -492,17 +492,20 @@ drawWire drawSelf =================== */ --drawRect:(NSRect)rects +-drawRect:(NSRect)rect { float drawtime = 0; if (timedrawing) drawtime = Sys_DoubleTime (); - if (drawmode == dr_texture || drawmode == dr_flat) + if (drawmode == dr_texture || drawmode == dr_flat) { + [quakeed_i cameraNoRestore: _bounds]; [self drawSolid]; - else - [self drawWire: rects]; + } else { + [quakeed_i cameraNoRestore: rect]; + [self drawWire: rect]; + } if (timedrawing) { drawtime = Sys_DoubleTime () - drawtime; diff --git a/tools/Forge/Bundles/MapEdit/QuakeEd.h b/tools/Forge/Bundles/MapEdit/QuakeEd.h index 7c9001b64..ff0759aad 100644 --- a/tools/Forge/Bundles/MapEdit/QuakeEd.h +++ b/tools/Forge/Bundles/MapEdit/QuakeEd.h @@ -23,6 +23,7 @@ void qprintf (char *fmt, ...); // prints text to cmd_out_i NSBitmapImageRep *cache[3]; NSRect cache_rect[3]; + BOOL no_restore[3]; // UI objects id brushcount_i; @@ -55,6 +56,10 @@ void qprintf (char *fmt, ...); // prints text to cmd_out_i -updateAll:sender; +-(void)cameraNoRestore: (NSRect) rect; +-(void)xyNoRestore: (NSRect) rect; +-(void)zNoRestore: (NSRect) rect; + -newinstance; // force next flushwindow to clear all // instance drawing -redrawInstance; // erase and redraw all instance now diff --git a/tools/Forge/Bundles/MapEdit/QuakeEd.m b/tools/Forge/Bundles/MapEdit/QuakeEd.m index 1bc0d9c0d..0805fbb3f 100644 --- a/tools/Forge/Bundles/MapEdit/QuakeEd.m +++ b/tools/Forge/Bundles/MapEdit/QuakeEd.m @@ -229,6 +229,20 @@ int c_updateall; return self; } +-(void)cameraNoRestore: (NSRect) rect +{ + no_restore[0] = YES; +} + +-(void)xyNoRestore: (NSRect) rect +{ + no_restore[1] = YES; +} + +-(void)zNoRestore: (NSRect) rect +{ + no_restore[2] = YES; +} -newinstance { @@ -269,10 +283,11 @@ instance draw the brush after each flush [cv lockFocus]; for (i = 3; i >= 0; i--) { if (cache[i]) { - if (clearinstance) { + if (!no_restore[i]) { rect = cache_rect[i]; [cache[i] drawAtPoint: rect.origin]; } + no_restore[i] = NO; [cache[i] release]; cache[i] = 0; } diff --git a/tools/Forge/Bundles/MapEdit/XYView.m b/tools/Forge/Bundles/MapEdit/XYView.m index 48b8adffc..d01e9fcd7 100644 --- a/tools/Forge/Bundles/MapEdit/XYView.m +++ b/tools/Forge/Bundles/MapEdit/XYView.m @@ -669,7 +669,7 @@ Rect is in global world (unscaled) coordinates drawWire ================== */ --drawWire:(NSRect) rects +-drawWire:(NSRect) rect { NSRect visRect; int i, j, c, c2; @@ -684,18 +684,18 @@ drawWire // everything { visRect =[self visibleRect]; - rects = visRect; - xy_draw_rect = rects; + rect = visRect; + xy_draw_rect = rect; } - NSRectClip (rects); + NSRectClip (rect); // erase window - NSEraseRect (rects); + NSEraseRect (rect); // draw grid - [self drawGrid:rects]; + [self drawGrid:rect]; // draw all entities, world first so entities take priority linestart (0, 0, 0); @@ -815,24 +815,27 @@ drawSelf */ NSRect xy_draw_rect; --drawRect: (NSRect) rects +-drawRect: (NSRect) rect { float drawtime = 0; if (timedrawing) drawtime = Sys_DoubleTime (); - xy_draw_rect = rects; + xy_draw_rect = rect; newrect.origin.x = newrect.origin.y = 99999; newrect.size.width = newrect.size.height = -2 * 99999; // setup for text [[NSFont systemFontOfSize: 10] set]; - if (drawmode == dr_texture || drawmode == dr_flat) + if (drawmode == dr_texture || drawmode == dr_flat) { + [quakeed_i xyNoRestore: [self visibleRect]]; [self drawSolid]; - else - [self drawWire:rects]; + } else { + [quakeed_i xyNoRestore: rect]; + [self drawWire:rect]; + } if (timedrawing) { // NSPing (); diff --git a/tools/Forge/Bundles/MapEdit/ZView.m b/tools/Forge/Bundles/MapEdit/ZView.m index 1daa10ae7..c65f4f35b 100644 --- a/tools/Forge/Bundles/MapEdit/ZView.m +++ b/tools/Forge/Bundles/MapEdit/ZView.m @@ -429,7 +429,7 @@ drawSelf =============================================================================== */ --drawRect: (NSRect) rects +-drawRect: (NSRect) rect { //NSRect visRect; //Sys_Printf("ZView:drawRect\n"); @@ -438,13 +438,15 @@ drawSelf // allways draw the entire bar //visRect =[self visibleRect]; - rects = [self visibleRect]; + rect = [self visibleRect]; + + [quakeed_i zNoRestore: rect]; // erase window - NSEraseRect (rects); + NSEraseRect (rect); // draw grid - [self drawGrid:rects]; + [self drawGrid:rect]; // draw zplane // [self drawZplane]; FIXME zplane doesn't do anything yet