Get the timing write for when to restore the rects.

This commit is contained in:
Bill Currie 2010-09-27 19:42:28 +09:00
parent 9cc66c3de1
commit dcc4187a8c
5 changed files with 48 additions and 20 deletions

View file

@ -492,17 +492,20 @@ drawWire
drawSelf drawSelf
=================== ===================
*/ */
-drawRect:(NSRect)rects -drawRect:(NSRect)rect
{ {
float drawtime = 0; float drawtime = 0;
if (timedrawing) if (timedrawing)
drawtime = Sys_DoubleTime (); drawtime = Sys_DoubleTime ();
if (drawmode == dr_texture || drawmode == dr_flat) if (drawmode == dr_texture || drawmode == dr_flat) {
[quakeed_i cameraNoRestore: _bounds];
[self drawSolid]; [self drawSolid];
else } else {
[self drawWire: rects]; [quakeed_i cameraNoRestore: rect];
[self drawWire: rect];
}
if (timedrawing) { if (timedrawing) {
drawtime = Sys_DoubleTime () - drawtime; drawtime = Sys_DoubleTime () - drawtime;

View file

@ -23,6 +23,7 @@ void qprintf (char *fmt, ...); // prints text to cmd_out_i
NSBitmapImageRep *cache[3]; NSBitmapImageRep *cache[3];
NSRect cache_rect[3]; NSRect cache_rect[3];
BOOL no_restore[3];
// UI objects // UI objects
id brushcount_i; id brushcount_i;
@ -55,6 +56,10 @@ void qprintf (char *fmt, ...); // prints text to cmd_out_i
-updateAll:sender; -updateAll:sender;
-(void)cameraNoRestore: (NSRect) rect;
-(void)xyNoRestore: (NSRect) rect;
-(void)zNoRestore: (NSRect) rect;
-newinstance; // force next flushwindow to clear all -newinstance; // force next flushwindow to clear all
// instance drawing // instance drawing
-redrawInstance; // erase and redraw all instance now -redrawInstance; // erase and redraw all instance now

View file

@ -229,6 +229,20 @@ int c_updateall;
return self; 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 -newinstance
{ {
@ -269,10 +283,11 @@ instance draw the brush after each flush
[cv lockFocus]; [cv lockFocus];
for (i = 3; i >= 0; i--) { for (i = 3; i >= 0; i--) {
if (cache[i]) { if (cache[i]) {
if (clearinstance) { if (!no_restore[i]) {
rect = cache_rect[i]; rect = cache_rect[i];
[cache[i] drawAtPoint: rect.origin]; [cache[i] drawAtPoint: rect.origin];
} }
no_restore[i] = NO;
[cache[i] release]; [cache[i] release];
cache[i] = 0; cache[i] = 0;
} }

View file

@ -669,7 +669,7 @@ Rect is in global world (unscaled) coordinates
drawWire drawWire
================== ==================
*/ */
-drawWire:(NSRect) rects -drawWire:(NSRect) rect
{ {
NSRect visRect; NSRect visRect;
int i, j, c, c2; int i, j, c, c2;
@ -684,18 +684,18 @@ drawWire
// everything // everything
{ {
visRect =[self visibleRect]; visRect =[self visibleRect];
rects = visRect; rect = visRect;
xy_draw_rect = rects; xy_draw_rect = rect;
} }
NSRectClip (rects); NSRectClip (rect);
// erase window // erase window
NSEraseRect (rects); NSEraseRect (rect);
// draw grid // draw grid
[self drawGrid:rects]; [self drawGrid:rect];
// draw all entities, world first so entities take priority // draw all entities, world first so entities take priority
linestart (0, 0, 0); linestart (0, 0, 0);
@ -815,24 +815,27 @@ drawSelf
*/ */
NSRect xy_draw_rect; NSRect xy_draw_rect;
-drawRect: (NSRect) rects -drawRect: (NSRect) rect
{ {
float drawtime = 0; float drawtime = 0;
if (timedrawing) if (timedrawing)
drawtime = Sys_DoubleTime (); drawtime = Sys_DoubleTime ();
xy_draw_rect = rects; xy_draw_rect = rect;
newrect.origin.x = newrect.origin.y = 99999; newrect.origin.x = newrect.origin.y = 99999;
newrect.size.width = newrect.size.height = -2 * 99999; newrect.size.width = newrect.size.height = -2 * 99999;
// setup for text // setup for text
[[NSFont systemFontOfSize: 10] set]; [[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]; [self drawSolid];
else } else {
[self drawWire:rects]; [quakeed_i xyNoRestore: rect];
[self drawWire:rect];
}
if (timedrawing) { if (timedrawing) {
// NSPing (); // NSPing ();

View file

@ -429,7 +429,7 @@ drawSelf
=============================================================================== ===============================================================================
*/ */
-drawRect: (NSRect) rects -drawRect: (NSRect) rect
{ {
//NSRect visRect; //NSRect visRect;
//Sys_Printf("ZView:drawRect\n"); //Sys_Printf("ZView:drawRect\n");
@ -438,13 +438,15 @@ drawSelf
// allways draw the entire bar // allways draw the entire bar
//visRect =[self visibleRect]; //visRect =[self visibleRect];
rects = [self visibleRect]; rect = [self visibleRect];
[quakeed_i zNoRestore: rect];
// erase window // erase window
NSEraseRect (rects); NSEraseRect (rect);
// draw grid // draw grid
[self drawGrid:rects]; [self drawGrid:rect];
// draw zplane // draw zplane
// [self drawZplane]; FIXME zplane doesn't do anything yet // [self drawZplane]; FIXME zplane doesn't do anything yet