From 5559b89423b6ed41f179a5970775eb2ff8e93b49 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Thu, 10 Mar 2022 02:10:14 +0000 Subject: Fix vertical justification git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4299 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- other/pamx/window.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'other') diff --git a/other/pamx/window.c b/other/pamx/window.c index eef37449..61089ea5 100644 --- a/other/pamx/window.c +++ b/other/pamx/window.c @@ -348,7 +348,27 @@ placeImage(viewer * const viewerP, int const height, int * const rxP, /* input and output */ int * const ryP) { /* input and output */ +/*---------------------------------------------------------------------------- + Move the X window of *viewerP on the right place on the display to contain + an image whose dimensions are 'width' by 'height'. + + As input *rxP and *ryP are the current location of the window (offset from + the top left corner of the display of the top left corner of the window). + We update them with the new location. + + If the image is narrower than the display, center it. + + Otherwise, either left-justify it or right-justify it depending upon the + current position of the window: + If in the current position, the right edge of the image is within the + display, right-justify. + + Otherwise left-justify. + + + Do the analogous thing for vertical placement. +-----------------------------------------------------------------------------*/ int pixx, pixy; pixx = *rxP; @@ -366,7 +386,7 @@ placeImage(viewer * const viewerP, pixy = (viewerP->height - height) / 2; else { if ((pixy < 0) && (pixy + height < viewerP->height)) - pixy = viewerP->height - viewerP->height; + pixy = viewerP->height - height; if (pixy > 0) pixy = 0; } -- cgit 1.4.1