-/* xscreensaver, Copyright (c) 2006-2012 Jamie Zawinski <jwz@jwz.org>
-*
-* Permission to use, copy, modify, distribute, and sell this software and its
-* documentation for any purpose is hereby granted without fee, provided that
-* the above copyright notice appear in all copies and that both that
-* copyright notice and this permission notice appear in supporting
-* documentation. No representations are made about the suitability of this
-* software for any purpose. It is provided "as is" without express or
-* implied warranty.
-*/
+/* xscreensaver, Copyright (c) 2006-2013 Jamie Zawinski <jwz@jwz.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. No representations are made about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
/* This is a subclass of Apple's ScreenSaverView that knows how to run
xscreensaver programs without X11 via the dark magic of the "jwxyz"
{
# ifdef USE_IPHONE
UIGraphicsPushContext (backbuffer);
-#endif
+# endif
[self render_x11];
# ifdef USE_IPHONE
UIGraphicsPopContext();
-#endif
+# endif
}
# else
double s = 1;
# endif
+ // Store a realistic size in backbuffer_size, though the buffer is minimal.
NSRect f = [self bounds];
backbuffer_size.width = (int) (s * f.size.width);
backbuffer_size.height = (int) (s * f.size.height);
CGColorSpaceRelease (cs);
}
}
-# endif // USE_IPHONE
+# endif // USE_BACKBUFFER
- (void)dealloc {
NSAssert (pixfmt, @"unable to create NSOpenGLPixelFormat");
+ // #### Analyze says: "Potential leak of an object stored into pixfmt"
ctx = [[NSOpenGLContext alloc]
initWithFormat:pixfmt
shareContext:nil];
[ctx setValues:&r forParameter:NSOpenGLCPSwapInterval];
// check_gl_error ("NSOpenGLCPSwapInterval"); // SEGV sometimes. Too early?
- // #### "Build and Analyze" says that ctx leaks, because it doesn't
- // seem to realize that makeCurrentContext retains it (right?)
- // Not sure what to do to make this warning go away.
+ // #### Analyze says: "Potential leak of an object stored into "ctx"
+ // But makeCurrentContext retains it (right?)
[ctx makeCurrentContext];
check_gl_error ("makeCurrentContext");
eagl_layer.opaque = TRUE;
eagl_layer.drawableProperties =
[NSDictionary dictionaryWithObjectsAndKeys:
- kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat,
- [NSNumber numberWithBool:!dbuf_p], kEAGLDrawablePropertyRetainedBacking,
- nil];
+ kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat,
+ [NSNumber numberWithBool:!dbuf_p], kEAGLDrawablePropertyRetainedBacking,
+ nil];
// Without this, the GL frame buffer is half the screen resolution!
eagl_layer.contentsScale = [UIScreen mainScreen].scale;
if (!ogl_ctx)
return 0;
[view setOglContext:ogl_ctx];
+ // #### Analyze says "Potential leak of an object stored into ogl_ctx"
check_gl_error ("OES_init");
+ jwzgles_reset ();
+
# endif // USE_IPHONE
// Caller expects a pointer to an opaque struct... which it dereferences.