+/**
+ * Grow the current drawble.
+ *
+ * We need to infer the drawable size from GL calls because the drawable sizes
+ * are specified by OS specific calls which we do not trace.
+ */
+void
+updateDrawable(int width, int height) {
+ if (!drawable) {
+ return;
+ }
+
+ if (drawable->visible &&
+ width <= drawable->width &&
+ height <= drawable->height) {
+ return;
+ }
+
+ // Ignore zero area viewports
+ if (width == 0 || height == 0) {
+ return;
+ }
+
+ // Check for bound framebuffer last, as this may have a performance impact.
+ GLint draw_framebuffer = 0;
+ glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_framebuffer);
+ if (draw_framebuffer != 0) {
+ return;
+ }
+
+ drawable->resize(width, height);
+ drawable->show();