[retro-gtk] retro-gl-display: Custom aspect ratio for pixbuf
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] retro-gl-display: Custom aspect ratio for pixbuf
- Date: Wed, 14 Aug 2019 11:42:01 +0000 (UTC)
commit 3be1bab4f25630d36ef0c7ffddba19c2ddd80443
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Tue Aug 13 23:40:25 2019 +0500
retro-gl-display: Custom aspect ratio for pixbuf
Read 'aspect-ratio' options for the GdkPixbuf passed in
retro_gl_display_set_pixbuf() and use it instead of the core-provided
aspect ratio if it's present.
retro-gtk/retro-gl-display.c | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/retro-gtk/retro-gl-display.c b/retro-gtk/retro-gl-display.c
index d511f61..d8f563d 100644
--- a/retro-gtk/retro-gl-display.c
+++ b/retro-gtk/retro-gl-display.c
@@ -4,6 +4,7 @@
#include <epoxy/gl.h>
#include "retro-glsl-filter.h"
+#include "retro-pixbuf.h"
#include "retro-pixdata.h"
struct _RetroGLDisplay
@@ -492,11 +493,16 @@ retro_gl_display_get_pixbuf (RetroGLDisplay *self)
* @pixbuf: a #GdkPixbuf
*
* Sets @pixbuf as the currently displayed video frame.
+ *
+ * retro_pixbuf_set_aspect_ratio() can be used to specify the aspect ratio for
+ * the pixbuf. Otherwise the core's aspect ratio will be used.
*/
void
retro_gl_display_set_pixbuf (RetroGLDisplay *self,
GdkPixbuf *pixbuf)
{
+ gfloat aspect_ratio;
+
g_return_if_fail (RETRO_IS_GL_DISPLAY (self));
if (self->pixbuf == pixbuf)
@@ -507,6 +513,10 @@ retro_gl_display_set_pixbuf (RetroGLDisplay *self,
if (pixbuf != NULL)
self->pixbuf = g_object_ref (pixbuf);
+ aspect_ratio = retro_pixbuf_get_aspect_ratio (pixbuf);
+ if (aspect_ratio != 0.f)
+ self->aspect_ratio = aspect_ratio;
+
gtk_widget_queue_draw (GTK_WIDGET (self));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]