diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-03-10 02:10:14 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-03-10 02:10:14 +0000 |
commit | 5559b89423b6ed41f179a5970775eb2ff8e93b49 (patch) | |
tree | 509ff0630b6e33ac5148a4d3213b1df621badf08 /other | |
parent | ea5a20cc962244d3b913cf5e2af767eb1f2bb389 (diff) | |
download | netpbm-mirror-5559b89423b6ed41f179a5970775eb2ff8e93b49.tar.gz netpbm-mirror-5559b89423b6ed41f179a5970775eb2ff8e93b49.tar.xz netpbm-mirror-5559b89423b6ed41f179a5970775eb2ff8e93b49.zip |
Fix vertical justification
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4299 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'other')
-rw-r--r-- | other/pamx/window.c | 22 |
1 files changed, 21 insertions, 1 deletions
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; } |