Debug NSView Exposure
authorRobin Gareus <robin@gareus.org>
Tue, 21 Mar 2017 14:53:17 +0000 (15:53 +0100)
committerRobin Gareus <robin@gareus.org>
Tue, 21 Mar 2017 14:53:29 +0000 (15:53 +0100)
libs/gtkmm2ext/nsglview.mm

index 9115fc72875a1535753f4a8db27f14350df4ffb7..d2eace78da28b11ed90eb6f9bb6e18f8d7da226c 100644 (file)
@@ -64,6 +64,7 @@ __attribute__ ((visibility ("hidden")))
 - (void) dealloc;
 - (void) setCairoCanvas:(Gtkmm2ext::CairoCanvas*)c;
 - (void) reshape;
+- (void) setNeedsDisplayInRect:(NSRect)rect;
 - (void) drawRect:(NSRect)rect;
 - (BOOL) canBecomeKeyWindow:(id)sender;
 - (BOOL) acceptsFirstResponder:(id)sender;
@@ -176,6 +177,15 @@ __attribute__ ((visibility ("hidden")))
        _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
 {
        [[self openGLContext] makeCurrentContext];
@@ -217,6 +227,11 @@ __attribute__ ((visibility ("hidden")))
        }
        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);
 
        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;
        [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