13
0

Debug NSView Exposure

This commit is contained in:
Robin Gareus 2017-03-21 15:53:17 +01:00
parent 5e9492b996
commit 500033b416

View File

@ -64,6 +64,7 @@ __attribute__ ((visibility ("hidden")))
- (void) dealloc; - (void) dealloc;
- (void) setCairoCanvas:(Gtkmm2ext::CairoCanvas*)c; - (void) setCairoCanvas:(Gtkmm2ext::CairoCanvas*)c;
- (void) reshape; - (void) reshape;
- (void) setNeedsDisplayInRect:(NSRect)rect;
- (void) drawRect:(NSRect)rect; - (void) drawRect:(NSRect)rect;
- (BOOL) canBecomeKeyWindow:(id)sender; - (BOOL) canBecomeKeyWindow:(id)sender;
- (BOOL) acceptsFirstResponder:(id)sender; - (BOOL) acceptsFirstResponder:(id)sender;
@ -176,6 +177,15 @@ __attribute__ ((visibility ("hidden")))
_height = height; _height = height;
} }
- (void) setNeedsDisplayInRect:(NSRect)rect
{
[super setNeedsDisplayInRect:rect];
#ifdef DEBUG_NSVIEW_EXPOSURE
printf ("needsDisplay: %5.1f %5.1f %5.1f %5.1f\n",
rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
#endif
}
- (void) drawRect:(NSRect)rect - (void) drawRect:(NSRect)rect
{ {
[[self openGLContext] makeCurrentContext]; [[self openGLContext] makeCurrentContext];
@ -217,6 +227,11 @@ __attribute__ ((visibility ("hidden")))
} }
ctx->fill (); ctx->fill ();
#ifdef DEBUG_NSVIEW_EXPOSURE
printf ("drawRect: %.1f %.1f %.1f %1.f\n",
cairo_rect.x, cairo_rect.y, cairo_rect.width, cairo_rect.height);
#endif
cairo_canvas->render (ctx, &cairo_rect); cairo_canvas->render (ctx, &cairo_rect);
surf->flush (); surf->flush ();
@ -302,6 +317,9 @@ Gtkmm2ext::nsglview_queue_draw (void* glv, int x, int y, int w, int h)
{ {
ArdourCanvasOpenGLView* gl_view = (ArdourCanvasOpenGLView*) glv; ArdourCanvasOpenGLView* gl_view = (ArdourCanvasOpenGLView*) glv;
[gl_view setNeedsDisplayInRect:NSMakeRect(x, y, w, h)]; [gl_view setNeedsDisplayInRect:NSMakeRect(x, y, w, h)];
#ifdef DEBUG_NSVIEW_EXPOSURE
printf ("Queue Draw %5d %5d %5d %5d\n", x, y, w, h);
#endif
} }
void void