[gnome-photos] gegl-gtk-view-helper: Use cairo API to calculate stride
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] gegl-gtk-view-helper: Use cairo API to calculate stride
- Date: Fri, 18 Jul 2014 15:52:29 +0000 (UTC)
commit 1653e9c27c62b2ce81b993cafd7d0a2bcef8655b
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Jul 18 15:35:34 2014 +0200
gegl-gtk-view-helper: Use cairo API to calculate stride
Fixes: https://bugzilla.gnome.org/733355
src/gegl-gtk-view-helper.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/gegl-gtk-view-helper.c b/src/gegl-gtk-view-helper.c
index aadd6fb..e493e48 100644
--- a/src/gegl-gtk-view-helper.c
+++ b/src/gegl-gtk-view-helper.c
@@ -240,13 +240,15 @@ view_helper_draw(ViewHelper *self, cairo_t *cr, GdkRectangle *rect)
cairo_surface_t *surface = NULL;
guchar *buf = NULL;
GeglRectangle roi;
+ gint stride;
roi.x = self->x + rect->x;
roi.y = self->y + rect->y;
roi.width = rect->width;
roi.height = rect->height;
- buf = g_malloc((roi.width) * (roi.height) * 4);
+ stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, roi.width);
+ buf = g_malloc(stride * roi.height);
gegl_node_blit(self->node,
self->scale,
@@ -259,7 +261,7 @@ view_helper_draw(ViewHelper *self, cairo_t *cr, GdkRectangle *rect)
surface = cairo_image_surface_create_for_data(buf,
CAIRO_FORMAT_ARGB32,
roi.width, roi.height,
- roi.width * 4);
+ stride);
cairo_set_source_surface(cr, surface, rect->x, rect->y);
cairo_paint(cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]