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
===================
*/
-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;

View File

@ -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

View File

@ -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;
}

View File

@ -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 ();

View File

@ -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