[gitg] Fix side-by-side alignment in the case of a single image
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Fix side-by-side alignment in the case of a single image
- Date: Mon, 29 Aug 2016 03:44:01 +0000 (UTC)
commit c0c44a95639175675f46943ccd9b0a6b9933927b
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Mon Aug 29 05:43:06 2016 +0200
Fix side-by-side alignment in the case of a single image
libgitg/gitg-diff-image-side-by-side.vala | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/libgitg/gitg-diff-image-side-by-side.vala b/libgitg/gitg-diff-image-side-by-side.vala
index 4e15240..254b25e 100644
--- a/libgitg/gitg-diff-image-side-by-side.vala
+++ b/libgitg/gitg-diff-image-side-by-side.vala
@@ -237,10 +237,16 @@ class Gitg.DiffImageSideBySide : Gtk.DrawingArea
ctx.render_background(cr, alloc.x, alloc.y, alloc.width, alloc.height);
double max_height = double.max(sizing.old_size.image_height, sizing.new_size.image_height);
+ double spread_factor = 0.5;
+
+ if (old_surface != null && new_surface != null)
+ {
+ spread_factor = 2.0 / 3.0;
+ }
if (old_surface != null)
{
- var x = (sizing.old_size.width - sizing.old_size.image_width) * 2 / 3;
+ var x = (sizing.old_size.width - sizing.old_size.image_width) * spread_factor;
var y = (max_height - sizing.old_size.image_height) / 2;
cr.set_source_surface(old_surface, x, y);
@@ -258,7 +264,7 @@ class Gitg.DiffImageSideBySide : Gtk.DrawingArea
if (new_surface != null)
{
- var x = (sizing.new_size.width - sizing.new_size.image_width) * 1 / 3;
+ var x = (sizing.new_size.width - sizing.new_size.image_width) * (1.0 - spread_factor);
var y = (max_height - sizing.new_size.image_height) / 2;
if (cache.old_pixbuf != null)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]